提交 47cad725 编写于 作者: P Peter Krempa

virDomainDiskAddISCSIPoolSourceHost: Take virStorageSourcePtr instead of virDomainDiskDefPtr

Only 'def->src' was ever used in this function. Use the source directly.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 e20c5b17
...@@ -31325,7 +31325,7 @@ virDomainNetResolveActualType(virDomainNetDefPtr iface) ...@@ -31325,7 +31325,7 @@ virDomainNetResolveActualType(virDomainNetDefPtr iface)
static int static int
virDomainDiskAddISCSIPoolSourceHost(virDomainDiskDefPtr def, virDomainDiskAddISCSIPoolSourceHost(virStorageSourcePtr src,
virStoragePoolDefPtr pooldef) virStoragePoolDefPtr pooldef)
{ {
VIR_AUTOSTRINGLIST tokens = NULL; VIR_AUTOSTRINGLIST tokens = NULL;
...@@ -31339,38 +31339,38 @@ virDomainDiskAddISCSIPoolSourceHost(virDomainDiskDefPtr def, ...@@ -31339,38 +31339,38 @@ virDomainDiskAddISCSIPoolSourceHost(virDomainDiskDefPtr def,
} }
/* iscsi pool only supports one host */ /* iscsi pool only supports one host */
def->src->nhosts = 1; src->nhosts = 1;
def->src->hosts = g_new0(virStorageNetHostDef, 1); src->hosts = g_new0(virStorageNetHostDef, 1);
def->src->hosts[0].name = g_strdup(pooldef->source.hosts[0].name); src->hosts[0].name = g_strdup(pooldef->source.hosts[0].name);
if (pooldef->source.hosts[0].port != 0) if (pooldef->source.hosts[0].port != 0)
def->src->hosts[0].port = pooldef->source.hosts[0].port; src->hosts[0].port = pooldef->source.hosts[0].port;
else else
def->src->hosts[0].port = 3260; src->hosts[0].port = 3260;
/* iscsi volume has name like "unit:0:0:1" */ /* iscsi volume has name like "unit:0:0:1" */
if (!(tokens = virStringSplitCount(def->src->srcpool->volume, ":", 0, &ntokens))) if (!(tokens = virStringSplitCount(src->srcpool->volume, ":", 0, &ntokens)))
return -1; return -1;
if (ntokens != 4) { if (ntokens != 4) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected iscsi volume name '%s'"), _("unexpected iscsi volume name '%s'"),
def->src->srcpool->volume); src->srcpool->volume);
return -1; return -1;
} }
/* iscsi pool has only one source device path */ /* iscsi pool has only one source device path */
def->src->path = g_strdup_printf("%s/%s", pooldef->source.devices[0].path, src->path = g_strdup_printf("%s/%s", pooldef->source.devices[0].path,
tokens[3]); tokens[3]);
/* Storage pool have not supported these 2 attributes yet, /* Storage pool have not supported these 2 attributes yet,
* use the defaults. * use the defaults.
*/ */
def->src->hosts[0].transport = VIR_STORAGE_NET_HOST_TRANS_TCP; src->hosts[0].transport = VIR_STORAGE_NET_HOST_TRANS_TCP;
def->src->hosts[0].socket = NULL; src->hosts[0].socket = NULL;
def->src->protocol = VIR_STORAGE_NET_PROTOCOL_ISCSI; src->protocol = VIR_STORAGE_NET_PROTOCOL_ISCSI;
return 0; return 0;
} }
...@@ -31413,7 +31413,7 @@ virDomainDiskTranslateISCSIDirect(virDomainDiskDefPtr def, ...@@ -31413,7 +31413,7 @@ virDomainDiskTranslateISCSIDirect(virDomainDiskDefPtr def,
def->src->auth->secrettype = g_strdup(secrettype); def->src->auth->secrettype = g_strdup(secrettype);
} }
if (virDomainDiskAddISCSIPoolSourceHost(def, pooldef) < 0) if (virDomainDiskAddISCSIPoolSourceHost(def->src, pooldef) < 0)
return -1; return -1;
if (!def->src->initiator.iqn && pooldef->source.initiator.iqn && if (!def->src->initiator.iqn && pooldef->source.initiator.iqn &&
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册