218e99
From 4aeb6d14385793a46b11d4d129bbad6c9fe9132b Mon Sep 17 00:00:00 2001
218e99
From: Laszlo Ersek <lersek@redhat.com>
218e99
Date: Thu, 31 Oct 2013 16:29:26 +0100
218e99
Subject: [PATCH 07/29] blockdev: use error_setg_file_open()
218e99
218e99
RH-Author: Laszlo Ersek <lersek@redhat.com>
218e99
Message-id: <1383236971-6067-4-git-send-email-lersek@redhat.com>
218e99
Patchwork-id: 55193
218e99
O-Subject: [RHEL-7 qemu-kvm PATCH 3/8] blockdev: use error_setg_file_open()
218e99
Bugzilla: 907743
218e99
RH-Acked-by: Luiz Capitulino <lcapitulino@redhat.com>
218e99
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
218e99
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
218e99
218e99
From: Luiz Capitulino <lcapitulino@redhat.com>
218e99
218e99
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
218e99
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
218e99
Acked-by: Kevin Wolf <kwolf@redhat.com>
218e99
(cherry picked from commit 0eef407c7b4130d13138c1f75d9975165433f654)
218e99
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
218e99
---
218e99
 blockdev.c | 11 +++++++----
218e99
 1 file changed, 7 insertions(+), 4 deletions(-)
218e99
218e99
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
218e99
---
218e99
 blockdev.c |   11 +++++++----
218e99
 1 files changed, 7 insertions(+), 4 deletions(-)
218e99
218e99
diff --git a/blockdev.c b/blockdev.c
218e99
index 073f553..f65aff4 100644
218e99
--- a/blockdev.c
218e99
+++ b/blockdev.c
218e99
@@ -950,7 +950,7 @@ static void external_snapshot_prepare(BlkTransactionStates *common,
218e99
     ret = bdrv_open(states->new_bs, new_image_file, NULL,
218e99
                     flags | BDRV_O_NO_BACKING, drv);
218e99
     if (ret != 0) {
218e99
-        error_set(errp, QERR_OPEN_FILE_FAILED, new_image_file);
218e99
+        error_setg_file_open(errp, -ret, new_image_file);
218e99
     }
218e99
 }
218e99
 
218e99
@@ -1113,8 +1113,11 @@ static void qmp_bdrv_open_encrypted(BlockDriverState *bs, const char *filename,
218e99
                                     int bdrv_flags, BlockDriver *drv,
218e99
                                     const char *password, Error **errp)
218e99
 {
218e99
-    if (bdrv_open(bs, filename, NULL, bdrv_flags, drv) < 0) {
218e99
-        error_set(errp, QERR_OPEN_FILE_FAILED, filename);
218e99
+    int ret;
218e99
+
218e99
+    ret = bdrv_open(bs, filename, NULL, bdrv_flags, drv);
218e99
+    if (ret < 0) {
218e99
+        error_setg_file_open(errp, -ret, filename);
218e99
         return;
218e99
     }
218e99
 
218e99
@@ -1526,7 +1529,7 @@ void qmp_drive_mirror(const char *device, const char *target,
218e99
     ret = bdrv_open(target_bs, target, NULL, flags | BDRV_O_NO_BACKING, drv);
218e99
     if (ret < 0) {
218e99
         bdrv_delete(target_bs);
218e99
-        error_set(errp, QERR_OPEN_FILE_FAILED, target);
218e99
+        error_setg_file_open(errp, -ret, target);
218e99
         return;
218e99
     }
218e99
 
218e99
-- 
218e99
1.7.1
218e99