virDomainDiskTranslateISCSIDirect: Take virStorageSourcePtr instead of virDomainDiskDefPtr

Only 'def->src' was ever used in this function. Use the source directly.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2020-02-05 12:39:41 +01:00
parent 4fca8299c5
commit bc42d88ffd

View File

@ -31394,30 +31394,30 @@ virDomainDiskTranslateSourcePoolAuth(virStorageSourcePtr src,
static int static int
virDomainDiskTranslateISCSIDirect(virDomainDiskDefPtr def, virDomainDiskTranslateISCSIDirect(virStorageSourcePtr src,
virStoragePoolDefPtr pooldef) virStoragePoolDefPtr pooldef)
{ {
def->src->srcpool->actualtype = VIR_STORAGE_TYPE_NETWORK; src->srcpool->actualtype = VIR_STORAGE_TYPE_NETWORK;
def->src->protocol = VIR_STORAGE_NET_PROTOCOL_ISCSI; src->protocol = VIR_STORAGE_NET_PROTOCOL_ISCSI;
if (virDomainDiskTranslateSourcePoolAuth(def->src, if (virDomainDiskTranslateSourcePoolAuth(src,
&pooldef->source) < 0) &pooldef->source) < 0)
return -1; return -1;
/* Source pool may not fill in the secrettype field, /* Source pool may not fill in the secrettype field,
* so we need to do so here * so we need to do so here
*/ */
if (def->src->auth && !def->src->auth->secrettype) { if (src->auth && !src->auth->secrettype) {
const char *secrettype = const char *secrettype =
virSecretUsageTypeToString(VIR_SECRET_USAGE_TYPE_ISCSI); virSecretUsageTypeToString(VIR_SECRET_USAGE_TYPE_ISCSI);
def->src->auth->secrettype = g_strdup(secrettype); src->auth->secrettype = g_strdup(secrettype);
} }
if (virDomainDiskAddISCSIPoolSourceHost(def->src, pooldef) < 0) if (virDomainDiskAddISCSIPoolSourceHost(src, pooldef) < 0)
return -1; return -1;
if (!def->src->initiator.iqn && pooldef->source.initiator.iqn && if (!src->initiator.iqn && pooldef->source.initiator.iqn &&
virStorageSourceInitiatorCopy(&def->src->initiator, virStorageSourceInitiatorCopy(&src->initiator,
&pooldef->source.initiator) < 0) { &pooldef->source.initiator) < 0) {
return -1; return -1;
} }
@ -31542,7 +31542,7 @@ virDomainDiskTranslateSourcePool(virDomainDiskDefPtr def)
return -1; return -1;
} }
if (virDomainDiskTranslateISCSIDirect(def, pooldef) < 0) if (virDomainDiskTranslateISCSIDirect(def->src, pooldef) < 0)
return -1; return -1;
break; break;
@ -31567,7 +31567,7 @@ virDomainDiskTranslateSourcePool(virDomainDiskDefPtr def)
break; break;
case VIR_STORAGE_SOURCE_POOL_MODE_DIRECT: case VIR_STORAGE_SOURCE_POOL_MODE_DIRECT:
if (virDomainDiskTranslateISCSIDirect(def, pooldef) < 0) if (virDomainDiskTranslateISCSIDirect(def->src, pooldef) < 0)
return -1; return -1;
break; break;
} }