mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-02 01:45:17 +00:00
qemuDomainPrepareHostdev: Allocate backend nodenames in the prepare function
Allocate the nodename in the setup function rather than in the command line generator. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
c17e4907fe
commit
ca495825a3
@ -5105,9 +5105,11 @@ qemuBuildHostdevSCSIAttachPrepare(virDomainHostdevDefPtr hostdev,
|
|||||||
|
|
||||||
switch ((virDomainHostdevSCSIProtocolType) scsisrc->protocol) {
|
switch ((virDomainHostdevSCSIProtocolType) scsisrc->protocol) {
|
||||||
case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_NONE:
|
case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_NONE:
|
||||||
if (!scsisrc->u.host.src &&
|
if (!scsisrc->u.host.src) {
|
||||||
!(scsisrc->u.host.src = virStorageSourceNew()))
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
|
_("SCSI host device data structure was not initialized"));
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (!(devstr = qemuBuildSCSIHostHostdevDrvStr(hostdev)))
|
if (!(devstr = qemuBuildSCSIHostHostdevDrvStr(hostdev)))
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -5130,7 +5132,6 @@ qemuBuildHostdevSCSIAttachPrepare(virDomainHostdevDefPtr hostdev,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
src->nodestorage = g_strdup_printf("libvirt-%s-backend", hostdev->info->alias);
|
|
||||||
ret->storageNodeName = src->nodestorage;
|
ret->storageNodeName = src->nodestorage;
|
||||||
*backendAlias = src->nodestorage;
|
*backendAlias = src->nodestorage;
|
||||||
|
|
||||||
|
@ -10409,6 +10409,10 @@ qemuDomainPrepareHostdev(virDomainHostdevDefPtr hostdev,
|
|||||||
|
|
||||||
switch ((virDomainHostdevSCSIProtocolType) scsisrc->protocol) {
|
switch ((virDomainHostdevSCSIProtocolType) scsisrc->protocol) {
|
||||||
case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_NONE:
|
case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_NONE:
|
||||||
|
virObjectUnref(scsisrc->u.host.src);
|
||||||
|
if (!(scsisrc->u.host.src = virStorageSourceNew()))
|
||||||
|
return -1;
|
||||||
|
src = scsisrc->u.host.src;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI:
|
case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI:
|
||||||
@ -10422,6 +10426,10 @@ qemuDomainPrepareHostdev(virDomainHostdevDefPtr hostdev,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (src) {
|
if (src) {
|
||||||
|
if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV_HOSTDEV_SCSI)) {
|
||||||
|
src->nodestorage = g_strdup_printf("libvirt-%s-backend", hostdev->info->alias);
|
||||||
|
}
|
||||||
|
|
||||||
if (src->auth) {
|
if (src->auth) {
|
||||||
bool iscsiHasPS = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_ISCSI_PASSWORD_SECRET);
|
bool iscsiHasPS = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_ISCSI_PASSWORD_SECRET);
|
||||||
virSecretUsageType usageType = VIR_SECRET_USAGE_TYPE_ISCSI;
|
virSecretUsageType usageType = VIR_SECRET_USAGE_TYPE_ISCSI;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user