All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-trivial] [PATCH] block: Create proper size file for disk mirror
@ 2013-01-24 18:00 Vishvananda Ishaya
  2013-01-25  9:18 ` Kevin Wolf
  2013-01-25  9:31 ` [Qemu-trivial] [PATCH] block: Create proper size file for disk mirror Stefan Hajnoczi
  0 siblings, 2 replies; 9+ messages in thread
From: Vishvananda Ishaya @ 2013-01-24 18:00 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, Kevin Wolf, Vishvananda Ishaya, Stefan Hajnoczi

The qmp monitor command to mirror a disk was passing -1 for size
along with the disk's backing file. This size of the resulting disk
is the size of the backing file, which is incorrect if the disk
has been resized. Therefore we should always pass in the size of
the current disk.

Signed-off-by: Vishvananda Ishaya <vishvananda@gmail.com>
---
Fixes https://bugs.launchpad.net/qemu/+bug/1103903

 blockdev.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/blockdev.c b/blockdev.c
index 9126587..bb63162 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -1259,11 +1259,11 @@ void qmp_drive_mirror(const char *device, const char *target,
         return;
     }
 
+    bdrv_get_geometry(bs, &size);
+    size *= 512;
     if (sync == MIRROR_SYNC_MODE_FULL && mode != NEW_IMAGE_MODE_EXISTING) {
         /* create new image w/o backing file */
         assert(format && drv);
-        bdrv_get_geometry(bs, &size);
-        size *= 512;
         bdrv_img_create(target, format,
                         NULL, NULL, NULL, size, flags, &local_err);
     } else {
@@ -1276,7 +1276,7 @@ void qmp_drive_mirror(const char *device, const char *target,
             bdrv_img_create(target, format,
                             source->filename,
                             source->drv->format_name,
-                            NULL, -1, flags, &local_err);
+                            NULL, size, flags, &local_err);
             break;
         default:
             abort();
-- 
1.7.9.5



^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-01-29 14:52 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-24 18:00 [Qemu-trivial] [PATCH] block: Create proper size file for disk mirror Vishvananda Ishaya
2013-01-25  9:18 ` Kevin Wolf
2013-01-25 18:10   ` Vishvananda Ishaya
2013-01-25 18:13     ` [Qemu-trivial] [Qemu-devel] " Eric Blake
2013-01-25 18:28       ` Kevin Wolf
2013-01-25 18:57   ` [Qemu-trivial] [PATCH] block: Adds mirroring tests for resized images Vishvananda Ishaya
2013-01-25 22:42     ` Paolo Bonzini
2013-01-29 14:52     ` Stefan Hajnoczi
2013-01-25  9:31 ` [Qemu-trivial] [PATCH] block: Create proper size file for disk mirror Stefan Hajnoczi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.