2018-03-21 14:15:59 +03:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Alexandre Derumier <aderumier@odiso.com>
|
|
|
|
Date: Wed, 21 Mar 2018 08:51:34 +0100
|
2018-08-30 16:00:07 +03:00
|
|
|
Subject: [PATCH] PVE: [Up] qemu-img dd : add -n skip_create
|
2018-03-21 14:15:59 +03:00
|
|
|
|
|
|
|
---
|
|
|
|
qemu-img.c | 23 ++++++++++++++---------
|
|
|
|
1 file changed, 14 insertions(+), 9 deletions(-)
|
|
|
|
|
|
|
|
diff --git a/qemu-img.c b/qemu-img.c
|
2019-04-19 10:53:37 +03:00
|
|
|
index 1f623f5bba..5d9322db33 100644
|
2018-03-21 14:15:59 +03:00
|
|
|
--- a/qemu-img.c
|
|
|
|
+++ b/qemu-img.c
|
2019-04-19 10:53:37 +03:00
|
|
|
@@ -4431,7 +4431,7 @@ static int img_dd(int argc, char **argv)
|
2018-03-21 14:15:59 +03:00
|
|
|
const char *fmt = NULL;
|
|
|
|
int64_t size = 0, readsize = 0;
|
|
|
|
int64_t block_count = 0, out_pos, in_pos;
|
|
|
|
- bool force_share = false;
|
|
|
|
+ bool force_share = false, skip_create = false;
|
|
|
|
struct DdInfo dd = {
|
|
|
|
.flags = 0,
|
|
|
|
.count = 0,
|
2019-04-19 10:53:37 +03:00
|
|
|
@@ -4469,7 +4469,7 @@ static int img_dd(int argc, char **argv)
|
2018-03-21 14:15:59 +03:00
|
|
|
{ 0, 0, 0, 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
- while ((c = getopt_long(argc, argv, ":hf:O:U", long_options, NULL))) {
|
|
|
|
+ while ((c = getopt_long(argc, argv, ":hf:O:U:n", long_options, NULL))) {
|
|
|
|
if (c == EOF) {
|
|
|
|
break;
|
|
|
|
}
|
2019-04-19 10:53:37 +03:00
|
|
|
@@ -4489,6 +4489,9 @@ static int img_dd(int argc, char **argv)
|
2018-03-21 14:15:59 +03:00
|
|
|
case 'h':
|
|
|
|
help();
|
|
|
|
break;
|
|
|
|
+ case 'n':
|
|
|
|
+ skip_create = true;
|
|
|
|
+ break;
|
|
|
|
case 'U':
|
|
|
|
force_share = true;
|
|
|
|
break;
|
2019-04-19 10:53:37 +03:00
|
|
|
@@ -4629,13 +4632,15 @@ static int img_dd(int argc, char **argv)
|
2018-03-21 14:15:59 +03:00
|
|
|
size - in.bsz * in.offset, &error_abort);
|
|
|
|
}
|
|
|
|
|
|
|
|
- ret = bdrv_create(drv, out.filename, opts, &local_err);
|
|
|
|
- if (ret < 0) {
|
|
|
|
- error_reportf_err(local_err,
|
|
|
|
- "%s: error while creating output image: ",
|
|
|
|
- out.filename);
|
|
|
|
- ret = -1;
|
|
|
|
- goto out;
|
|
|
|
+ if (!skip_create) {
|
|
|
|
+ ret = bdrv_create(drv, out.filename, opts, &local_err);
|
|
|
|
+ if (ret < 0) {
|
|
|
|
+ error_reportf_err(local_err,
|
|
|
|
+ "%s: error while creating output image: ",
|
|
|
|
+ out.filename);
|
|
|
|
+ ret = -1;
|
|
|
|
+ goto out;
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
|
|
|
|
/* TODO, we can't honour --image-opts for the target,
|
|
|
|
--
|
|
|
|
2.11.0
|
|
|
|
|