qemuBuildHostdevSCSIAttachPrepare is supposed to prepare the data
structure used for attaching the hostdev not preparing the hostdev
definition itself. Move the corresponding bits to qemuDomainPrepareHostdev
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_command.c | 2 --
src/qemu/qemu_domain.c | 5 +++++
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 697a2db62b..5e7454a6e8 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -5134,7 +5134,6 @@ qemuBuildHostdevSCSIAttachPrepare(virDomainHostdevDefPtr hostdev,
src = scsisrc->u.host.src;
- src->type = VIR_STORAGE_TYPE_BLOCK;
src->path = g_strdup_printf("/dev/%s", devstr);
break;
@@ -5149,7 +5148,6 @@ qemuBuildHostdevSCSIAttachPrepare(virDomainHostdevDefPtr hostdev,
return NULL;
}
- src->readonly = hostdev->readonly;
ret->storageNodeName = src->nodestorage;
*backendAlias = src->nodestorage;
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 5e603284be..ddfdac657a 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -10408,6 +10408,9 @@ qemuDomainPrepareHostdev(virDomainHostdevDefPtr hostdev,
virObjectUnref(scsisrc->u.host.src);
scsisrc->u.host.src = virStorageSourceNew();
src = scsisrc->u.host.src;
+
+ src->type = VIR_STORAGE_TYPE_BLOCK;
+
break;
case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI:
@@ -10423,6 +10426,8 @@ qemuDomainPrepareHostdev(virDomainHostdevDefPtr hostdev,
if (src) {
const char *backendalias = hostdev->info->alias;
+ src->readonly = hostdev->readonly;
+
if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV_HOSTDEV_SCSI)) {
src->id = qemuDomainStorageIdNew(priv);
src->nodestorage = g_strdup_printf("libvirt-%d-backend",
src->id);
--
2.26.2