[pve-devel] [PATCH pve-qemu 1/1] qemu-img : add -n option to dd to skip destination image create

Wolfgang Bumiller w.bumiller at proxmox.com
Wed Mar 21 15:59:35 CET 2018


applied

On Wed, Mar 21, 2018 at 12:15:59PM +0100, Alexandre Derumier wrote:
> ---
>  .../pve/0030-qemu-img-dd-add-n-skip_create.patch   | 67 ++++++++++++++++++++++
>  debian/patches/series                              |  1 +
>  2 files changed, 68 insertions(+)
>  create mode 100644 debian/patches/pve/0030-qemu-img-dd-add-n-skip_create.patch
> 
> diff --git a/debian/patches/pve/0030-qemu-img-dd-add-n-skip_create.patch b/debian/patches/pve/0030-qemu-img-dd-add-n-skip_create.patch
> new file mode 100644
> index 0000000..bb17605
> --- /dev/null
> +++ b/debian/patches/pve/0030-qemu-img-dd-add-n-skip_create.patch
> @@ -0,0 +1,67 @@
> +From ab1205eeb568a994cee6b43fbd59f70b10cc924a Mon Sep 17 00:00:00 2001
> +From: Alexandre Derumier <aderumier at odiso.com>
> +Date: Wed, 21 Mar 2018 08:51:34 +0100
> +Subject: [PATCH] qemu-img dd : add -n skip_create
> +
> +---
> + qemu-img.c | 23 ++++++++++++++---------
> + 1 file changed, 14 insertions(+), 9 deletions(-)
> +
> +diff --git a/qemu-img.c b/qemu-img.c
> +index 2605367..3d8c58d 100644
> +--- a/qemu-img.c
> ++++ b/qemu-img.c
> +@@ -4218,7 +4218,7 @@ static int img_dd(int argc, char **argv)
> +     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,
> +@@ -4256,7 +4256,7 @@ static int img_dd(int argc, char **argv)
> +         { 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;
> +         }
> +@@ -4276,6 +4276,9 @@ static int img_dd(int argc, char **argv)
> +         case 'h':
> +             help();
> +             break;
> ++        case 'n':
> ++            skip_create = true;
> ++            break;
> +         case 'U':
> +             force_share = true;
> +             break;
> +@@ -4416,13 +4419,15 @@ static int img_dd(int argc, char **argv)
> +                                 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
> +
> diff --git a/debian/patches/series b/debian/patches/series
> index 6f5a6c7..ca31fa3 100644
> --- a/debian/patches/series
> +++ b/debian/patches/series
> @@ -27,5 +27,6 @@ pve/0026-backup-introduce-vma-archive-format.patch
>  pve/0027-adding-old-vma-files.patch
>  pve/0028-vma-add-throttling-options-to-drive-mapping-fifo-pro.patch
>  pve/0029-qemu-img-dd-add-isize-parameter.patch
> +pve/0030-qemu-img-dd-add-n-skip_create.patch
>  extra/0001-Revert-target-i386-disable-LINT0-after-reset.patch
>  extra/0002-ratelimit-don-t-align-wait-time-with-slices.patch
> -- 
> 2.11.0




More information about the pve-devel mailing list