|
|
9ae3a8 |
From 38d5e0867780e352a3890792f684594deb7afd7e Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: Max Reitz <mreitz@redhat.com>
|
|
|
9ae3a8 |
Date: Sun, 19 Jan 2014 18:07:55 +0100
|
|
|
9ae3a8 |
Subject: [PATCH 21/34] blockdev: use bdrv_getlength() in qmp_drive_mirror()
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Max Reitz <mreitz@redhat.com>
|
|
|
9ae3a8 |
Message-id: <1390154881-17140-2-git-send-email-mreitz@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 56814
|
|
|
9ae3a8 |
O-Subject: [RHEL-7.0 qemu-kvm PATCH v2 1/7] blockdev: use bdrv_getlength() in qmp_drive_mirror()
|
|
|
9ae3a8 |
Bugzilla: 921890
|
|
|
9ae3a8 |
RH-Acked-by: Fam Zheng <famz@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Jeffrey Cody <jcody@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
From: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
BZ: 921890
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Use bdrv_getlength() for its byte units and error return instead of
|
|
|
9ae3a8 |
bdrv_get_geometry().
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Reported-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
9ae3a8 |
Reviewed-by: Eric Blake <eblake@redhat.com>
|
|
|
9ae3a8 |
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
9ae3a8 |
(cherry picked from commit ac3c5d831aa0ff796659300e186be1a35862dbd3)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Max Reitz <mreitz@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
blockdev.c | 10 +++++++---
|
|
|
9ae3a8 |
1 file changed, 7 insertions(+), 3 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
blockdev.c | 10 +++++++---
|
|
|
9ae3a8 |
1 files changed, 7 insertions(+), 3 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/blockdev.c b/blockdev.c
|
|
|
9ae3a8 |
index 33a5f5f..0ba2504 100644
|
|
|
9ae3a8 |
--- a/blockdev.c
|
|
|
9ae3a8 |
+++ b/blockdev.c
|
|
|
9ae3a8 |
@@ -1541,7 +1541,7 @@ void qmp_drive_mirror(const char *device, const char *target,
|
|
|
9ae3a8 |
BlockDriver *drv = NULL;
|
|
|
9ae3a8 |
Error *local_err = NULL;
|
|
|
9ae3a8 |
int flags;
|
|
|
9ae3a8 |
- uint64_t size;
|
|
|
9ae3a8 |
+ int64_t size;
|
|
|
9ae3a8 |
int ret;
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
if (!has_speed) {
|
|
|
9ae3a8 |
@@ -1605,8 +1605,12 @@ void qmp_drive_mirror(const char *device, const char *target,
|
|
|
9ae3a8 |
sync = MIRROR_SYNC_MODE_FULL;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
- bdrv_get_geometry(bs, &size);
|
|
|
9ae3a8 |
- size *= 512;
|
|
|
9ae3a8 |
+ size = bdrv_getlength(bs);
|
|
|
9ae3a8 |
+ if (size < 0) {
|
|
|
9ae3a8 |
+ error_setg_errno(errp, -size, "bdrv_getlength failed");
|
|
|
9ae3a8 |
+ return;
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
if (sync == MIRROR_SYNC_MODE_FULL && mode != NEW_IMAGE_MODE_EXISTING) {
|
|
|
9ae3a8 |
/* create new image w/o backing file */
|
|
|
9ae3a8 |
assert(format && drv);
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.7.1
|
|
|
9ae3a8 |
|