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

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@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

Signed-off-by: John Ferlan <jferlan@redhat.com> --- A libvirtd restart test found that my domain disappeared because there was no 'expected_secret_usage' type - this this patch needs to be reviewed as squashed into this patch. src/conf/domain_conf.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 36de844..b1ebfc8 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -6391,6 +6391,10 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt, expected_secret_usage = VIR_SECRET_USAGE_TYPE_ISCSI; else if (def->src->protocol == VIR_STORAGE_NET_PROTOCOL_RBD) expected_secret_usage = VIR_SECRET_USAGE_TYPE_CEPH; + } else if (def->src->type == VIR_STORAGE_TYPE_VOLUME) { + if (def->src->srcpool && + def->src->srcpool->pooltype == VIR_STORAGE_POOL_ISCSI) + expected_secret_usage = VIR_SECRET_USAGE_TYPE_ISCSI; } startupPolicy = virXMLPropString(cur, "startupPolicy"); -- 2.1.0

On 06/08/2015 07:00 PM, John Ferlan wrote:
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
Found yet another path that won't work quite right - tweaking now and will repost everything as a v2, so ignore this one... John
Signed-off-by: John Ferlan <jferlan@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;
participants (1)
-
John Ferlan