thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
Blob Blame History Raw
From 865f21e1199cf38bc461b91c30d97bf1baceb8ba Mon Sep 17 00:00:00 2001
From: Jeffrey Cody <jcody@redhat.com>
Date: Tue, 28 Jan 2014 14:21:57 +0100
Subject: [PATCH 22/22] block: add .bdrv_reopen_prepare() stub for iscsi

RH-Author: Jeffrey Cody <jcody@redhat.com>
Message-id: <884dd65be83603e336fac7a2fd2640ec52fe095d.1390918756.git.jcody@redhat.com>
Patchwork-id: 57003
O-Subject: [RHEL7 qemu-kvm PATCH v2 1/1] block: add .bdrv_reopen_prepare() stub for iscsi
Bugzilla: 1030301
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>

To suppport reopen(), the .bdrv_reopen_prepare() stub must exist.
iSCSI does not have anything that needs to be done to support reopen,
so we can just implement the _prepare() stub.

Signed-off-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit dc6afb99b39a78cf416c6d19e35f680f202016be)

RHEL7 Note:  It should be noted that this _prepare() empty stub
             is all that is needed when performing a reopen, because
             the bdrv flags are ignored by iscsi_open.  Specifically, in
             this form, reopen will not reconnect to an iSCSI target.

---
 block/iscsi.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
 block/iscsi.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/block/iscsi.c b/block/iscsi.c
index fa6f7c4..1c5b0a2 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -1506,6 +1506,14 @@ static void iscsi_close(BlockDriverState *bs)
     memset(iscsilun, 0, sizeof(IscsiLun));
 }
 
+/* We have nothing to do for iSCSI reopen, stub just returns
+ * success */
+static int iscsi_reopen_prepare(BDRVReopenState *state,
+                                BlockReopenQueue *queue, Error **errp)
+{
+    return 0;
+}
+
 static int iscsi_truncate(BlockDriverState *bs, int64_t offset)
 {
     IscsiLun *iscsilun = bs->opaque;
@@ -1613,6 +1621,7 @@ static BlockDriver bdrv_iscsi = {
     .bdrv_close      = iscsi_close,
     .bdrv_create     = iscsi_create,
     .create_options  = iscsi_create_options,
+    .bdrv_reopen_prepare  = iscsi_reopen_prepare,
 
     .bdrv_getlength  = iscsi_getlength,
     .bdrv_get_info   = iscsi_get_info,
-- 
1.7.1