cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
0a122b
From cf918fe08d1cf84f3825cea464c93278c647df52 Mon Sep 17 00:00:00 2001
0a122b
Message-Id: <cf918fe08d1cf84f3825cea464c93278c647df52.1389014116.git.minovotn@redhat.com>
0a122b
In-Reply-To: <c8cc35838d42aa286242772d97e3a9be7bb786ba.1389014116.git.minovotn@redhat.com>
0a122b
References: <c8cc35838d42aa286242772d97e3a9be7bb786ba.1389014116.git.minovotn@redhat.com>
0a122b
From: Paolo Bonzini <pbonzini@redhat.com>
0a122b
Date: Mon, 9 Dec 2013 14:09:09 +0100
0a122b
Subject: [PATCH 21/50] qemu-img: add support for fully allocated images
0a122b
0a122b
RH-Author: Paolo Bonzini <pbonzini@redhat.com>
0a122b
Message-id: <1386598178-11845-24-git-send-email-pbonzini@redhat.com>
0a122b
Patchwork-id: 56060
0a122b
O-Subject: [RHEL 7.0 qemu-kvm PATCH 23/52] qemu-img: add support for fully allocated images
0a122b
Bugzilla: 1007815
0a122b
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
0a122b
RH-Acked-by: Fam Zheng <famz@redhat.com>
0a122b
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
0a122b
0a122b
From: Peter Lieven <pl@kamp.de>
0a122b
0a122b
Signed-off-by: Peter Lieven <pl@kamp.de>
0a122b
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
0a122b
(cherry picked from commit 11b6699af59b8684128debacfc7c44cbaa6ac53b)
0a122b
---
0a122b
 qemu-img.c    | 10 +++++++---
0a122b
 qemu-img.texi |  6 ++++++
0a122b
 2 files changed, 13 insertions(+), 3 deletions(-)
0a122b
0a122b
Signed-off-by: Michal Novotny <minovotn@redhat.com>
0a122b
---
0a122b
 qemu-img.c    | 10 +++++++---
0a122b
 qemu-img.texi |  6 ++++++
0a122b
 2 files changed, 13 insertions(+), 3 deletions(-)
0a122b
0a122b
diff --git a/qemu-img.c b/qemu-img.c
0a122b
index fa0fd0e..dfd8a92 100644
0a122b
--- a/qemu-img.c
0a122b
+++ b/qemu-img.c
0a122b
@@ -99,8 +99,12 @@ static void help(void)
0a122b
            "  '-h' with or without a command shows this help and lists the supported formats\n"
0a122b
            "  '-p' show progress of command (only certain commands)\n"
0a122b
            "  '-q' use Quiet mode - do not print any output (except errors)\n"
0a122b
-           "  '-S' indicates the consecutive number of bytes that must contain only zeros\n"
0a122b
-           "       for qemu-img to create a sparse image during conversion\n"
0a122b
+           "  '-S' indicates the consecutive number of bytes (defaults to 4k) that must\n"
0a122b
+           "       contain only zeros for qemu-img to create a sparse image during\n"
0a122b
+           "       conversion. If the number of bytes is 0, the source will not be scanned for\n"
0a122b
+           "       unallocated or zero sectors, and the destination image will always be\n"
0a122b
+           "       fully allocated\n"
0a122b
+           "       images will always be fully allocated\n"
0a122b
            "  '--output' takes the format in which the output must be done (human or json)\n"
0a122b
            "  '-n' skips the target volume creation (useful if the volume is created\n"
0a122b
            "       prior to running qemu-img)\n"
0a122b
@@ -1463,7 +1467,7 @@ static int img_convert(int argc, char **argv)
0a122b
         /* signal EOF to align */
0a122b
         bdrv_write_compressed(out_bs, 0, NULL, 0);
0a122b
     } else {
0a122b
-        int has_zero_init = bdrv_has_zero_init(out_bs);
0a122b
+        int has_zero_init = min_sparse ? bdrv_has_zero_init(out_bs) : 0;
0a122b
 
0a122b
         sector_num = 0; // total number of sectors converted so far
0a122b
         nb_sectors = total_sectors - sector_num;
0a122b
diff --git a/qemu-img.texi b/qemu-img.texi
0a122b
index 43ee4eb..dc578bb 100644
0a122b
--- a/qemu-img.texi
0a122b
+++ b/qemu-img.texi
0a122b
@@ -193,6 +193,12 @@ Image conversion is also useful to get smaller image when using a
0a122b
 growable format such as @code{qcow} or @code{cow}: the empty sectors
0a122b
 are detected and suppressed from the destination image.
0a122b
 
0a122b
+@var{sparse_size} indicates the consecutive number of bytes (defaults to 4k)
0a122b
+that must contain only zeros for qemu-img to create a sparse image during
0a122b
+conversion. If @var{sparse_size} is 0, the source will not be scanned for
0a122b
+unallocated or zero sectors, and the destination image will always be
0a122b
+fully allocated.
0a122b
+
0a122b
 You can use the @var{backing_file} option to force the output image to be
0a122b
 created as a copy on write image of the specified base image; the
0a122b
 @var{backing_file} should have the same content as the input's base image,
0a122b
-- 
0a122b
1.7.11.7
0a122b