[libvirt] [PATCH] storage: Need to set secrettype for direct iscsi disk volume

John Ferlan jferlan at redhat.com
Mon Jun 8 23:00:41 UTC 2015


https://bugzilla.redhat.com/show_bug.cgi?id=1200206

Commit id '1b4eaa61' added the ability to have a mode='direct' for
an iscsi disk volume.  It relied on virStorageTranslateDiskSourcePool
in order to copy any disk source pool authentication information to
the direct disk volume, but it neglected to also copy the 'secrettype'
field which ends up being used in the domain volume formatting code.
Adding a secrettype for this case will allow for proper formatting later
and allow disk snapshotting to work properly

Signed-off-by: John Ferlan <jferlan at redhat.com>
---
 src/storage/storage_driver.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index ab8675d..57060ab 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -3310,6 +3310,16 @@ virStorageTranslateDiskSourcePool(virConnectPtr conn,
                                                      &pooldef->source) < 0)
                goto cleanup;
 
+           /* Source pool may not fill in the secrettype field,
+            * so we need to do so here
+            */
+           if (def->src->auth && !def->src->auth->secrettype) {
+               const char *secrettype =
+                   virSecretUsageTypeToString(VIR_SECRET_USAGE_TYPE_ISCSI);
+               if (VIR_STRDUP(def->src->auth->secrettype, secrettype) < 0)
+                   goto cleanup;
+           }
+
            if (virStorageAddISCSIPoolSourceHost(def, pooldef) < 0)
                goto cleanup;
            break;
-- 
2.1.0




More information about the libvir-list mailing list