]>
Commit | Line | Data |
---|---|---|
46598e97 AD |
1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
2 | From: Alexandre Derumier <aderumier@odiso.com> | |
6402d961 TL |
3 | Date: Tue, 10 Mar 2020 12:55:10 +0100 |
4 | Subject: [PATCH 13/32] PVE: [Up] qemu-img dd : add -n skip_create | |
46598e97 | 5 | |
b855dce7 | 6 | Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com> |
46598e97 AD |
7 | --- |
8 | qemu-img.c | 23 ++++++++++++++--------- | |
9 | 1 file changed, 14 insertions(+), 9 deletions(-) | |
10 | ||
11 | diff --git a/qemu-img.c b/qemu-img.c | |
6402d961 | 12 | index 8da1ea3951..ea3edb4f04 100644 |
46598e97 AD |
13 | --- a/qemu-img.c |
14 | +++ b/qemu-img.c | |
6402d961 | 15 | @@ -4535,7 +4535,7 @@ static int img_dd(int argc, char **argv) |
46598e97 AD |
16 | const char *fmt = NULL; |
17 | int64_t size = 0, readsize = 0; | |
18 | int64_t block_count = 0, out_pos, in_pos; | |
19 | - bool force_share = false; | |
20 | + bool force_share = false, skip_create = false; | |
21 | struct DdInfo dd = { | |
22 | .flags = 0, | |
23 | .count = 0, | |
6402d961 | 24 | @@ -4573,7 +4573,7 @@ static int img_dd(int argc, char **argv) |
46598e97 AD |
25 | { 0, 0, 0, 0 } |
26 | }; | |
27 | ||
28 | - while ((c = getopt_long(argc, argv, ":hf:O:U", long_options, NULL))) { | |
29 | + while ((c = getopt_long(argc, argv, ":hf:O:U:n", long_options, NULL))) { | |
30 | if (c == EOF) { | |
31 | break; | |
32 | } | |
6402d961 | 33 | @@ -4593,6 +4593,9 @@ static int img_dd(int argc, char **argv) |
46598e97 AD |
34 | case 'h': |
35 | help(); | |
36 | break; | |
37 | + case 'n': | |
38 | + skip_create = true; | |
39 | + break; | |
40 | case 'U': | |
41 | force_share = true; | |
42 | break; | |
6402d961 | 43 | @@ -4733,13 +4736,15 @@ static int img_dd(int argc, char **argv) |
46598e97 AD |
44 | size - in.bsz * in.offset, &error_abort); |
45 | } | |
46 | ||
47 | - ret = bdrv_create(drv, out.filename, opts, &local_err); | |
48 | - if (ret < 0) { | |
49 | - error_reportf_err(local_err, | |
50 | - "%s: error while creating output image: ", | |
51 | - out.filename); | |
52 | - ret = -1; | |
53 | - goto out; | |
54 | + if (!skip_create) { | |
55 | + ret = bdrv_create(drv, out.filename, opts, &local_err); | |
56 | + if (ret < 0) { | |
57 | + error_reportf_err(local_err, | |
58 | + "%s: error while creating output image: ", | |
59 | + out.filename); | |
60 | + ret = -1; | |
61 | + goto out; | |
62 | + } | |
63 | } | |
64 | ||
65 | /* TODO, we can't honour --image-opts for the target, |