qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Allow custom file sizes for backed files
@ 2009-05-11 15:33 alex
  0 siblings, 0 replies; only message in thread
From: alex @ 2009-05-11 15:33 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alexander Graf

From: Alexander Graf <alex@csgraf.de>

Currently when creating an image with a backing file enabled, the size
of the file is the same as the size of the backing file.

I don't see any reason why it has to be that way. Qcow2 even contains
code to handle the case where the backing file doesn't contain the data
we want to read from it, so we're fine here.

This patch allows to specify a size option even when using a backing
file. I tested that it works with a raw backed qcow2 file.

Signed-off-by: Alexander Graf <alex@csgraf.de>
---
 qemu-img.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/qemu-img.c b/qemu-img.c
index 29149a2..01fa059 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -271,9 +271,10 @@ static int img_create(int argc, char **argv)
         bdrv_get_geometry(bs, &size);
         size *= 512;
         bdrv_delete(bs);
-    } else {
-        if (optind >= argc)
-            help();
+    } else if (optind >= argc) {
+        help();
+    }
+    if (optind < argc) {
         p = argv[optind];
         sizef = strtod(p, (char **)&p);
         if (*p == 'M') {
-- 
1.6.0.2

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2009-05-11 15:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-11 15:33 [Qemu-devel] [PATCH] Allow custom file sizes for backed files alex

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).