The secret object is used to pass data to the backend so it's better
fitting to base the secret object name on the SCSI host device backend
name.
Since we store the object alias in the status XML this modification is
safe in regards to existing guests.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_domain.c | 5 ++++-
.../qemuxml2argvdata/hostdev-scsi-lsi.x86_64-latest.args | 8 ++++----
.../hostdev-scsi-virtio-scsi.x86_64-latest.args | 8 ++++----
3 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index d570ba892b..46f7caeb09 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -10426,8 +10426,11 @@ qemuDomainPrepareHostdev(virDomainHostdevDefPtr hostdev,
}
if (src) {
+ const char *backendalias = hostdev->info->alias;
+
if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV_HOSTDEV_SCSI)) {
src->nodestorage = g_strdup_printf("libvirt-%s-backend",
hostdev->info->alias);
+ backendalias = src->nodestorage;
}
if (src->auth) {
@@ -10441,7 +10444,7 @@ qemuDomainPrepareHostdev(virDomainHostdevDefPtr hostdev,
&src->auth->seclookupdef);
} else {
srcPriv->secinfo = qemuDomainSecretAESSetupFromSecret(priv,
-
hostdev->info->alias,
+ backendalias,
NULL,
usageType,
src->auth->username,
diff --git a/tests/qemuxml2argvdata/hostdev-scsi-lsi.x86_64-latest.args
b/tests/qemuxml2argvdata/hostdev-scsi-lsi.x86_64-latest.args
index d4599f6002..f768c2471b 100644
--- a/tests/qemuxml2argvdata/hostdev-scsi-lsi.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/hostdev-scsi-lsi.x86_64-latest.args
@@ -52,21 +52,21 @@ id=hostdev2 \
"node-name":"libvirt-hostdev3-backend","read-only":false}'
\
-device scsi-generic,bus=scsi0.0,scsi-id=5,drive=libvirt-hostdev3-backend,\
id=hostdev3 \
--object secret,id=hostdev4-secret0,\
+-object secret,id=libvirt-hostdev4-backend-secret0,\
data=9eao5F8qtkGt+seB1HYivWIxbtwUu6MQtg1zpj/oDtUsPr1q8wBYM91uEHCn6j/1,\
keyid=masterKey0,iv=AAECAwQFBgcICQoLDA0ODw==,format=base64 \
-blockdev
'{"driver":"iscsi","portal":"example.org:3260",\
"target":"iqn.1992-01.com.example:storage","lun":1,"transport":"tcp",\
-"user":"myname","password-secret":"hostdev4-secret0",\
+"user":"myname","password-secret":"libvirt-hostdev4-backend-secret0",\
"node-name":"libvirt-hostdev4-backend","read-only":false}'
\
-device scsi-generic,bus=scsi0.0,scsi-id=3,drive=libvirt-hostdev4-backend,\
id=hostdev4 \
--object secret,id=hostdev5-secret0,\
+-object secret,id=libvirt-hostdev5-backend-secret0,\
data=9eao5F8qtkGt+seB1HYivWIxbtwUu6MQtg1zpj/oDtUsPr1q8wBYM91uEHCn6j/1,\
keyid=masterKey0,iv=AAECAwQFBgcICQoLDA0ODw==,format=base64 \
-blockdev
'{"driver":"iscsi","portal":"example.org:3260",\
"target":"iqn.1992-01.com.example:storage","lun":2,"transport":"tcp",\
-"user":"myname","password-secret":"hostdev5-secret0",\
+"user":"myname","password-secret":"libvirt-hostdev5-backend-secret0",\
"node-name":"libvirt-hostdev5-backend","read-only":false}'
\
-device scsi-generic,bus=scsi0.0,scsi-id=2,drive=libvirt-hostdev5-backend,\
id=hostdev5 \
diff --git a/tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.x86_64-latest.args
b/tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.x86_64-latest.args
index a2302d1089..0beefabd27 100644
--- a/tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.x86_64-latest.args
@@ -56,21 +56,21 @@ drive=libvirt-hostdev2-backend,id=hostdev2 \
"node-name":"libvirt-hostdev3-backend","read-only":false}'
\
-device scsi-generic,bus=scsi0.0,channel=0,scsi-id=2,lun=5,\
drive=libvirt-hostdev3-backend,id=hostdev3 \
--object secret,id=hostdev4-secret0,\
+-object secret,id=libvirt-hostdev4-backend-secret0,\
data=9eao5F8qtkGt+seB1HYivWIxbtwUu6MQtg1zpj/oDtUsPr1q8wBYM91uEHCn6j/1,\
keyid=masterKey0,iv=AAECAwQFBgcICQoLDA0ODw==,format=base64 \
-blockdev
'{"driver":"iscsi","portal":"example.org:3260",\
"target":"iqn.1992-01.com.example:storage","lun":1,"transport":"tcp",\
-"user":"myname","password-secret":"hostdev4-secret0",\
+"user":"myname","password-secret":"libvirt-hostdev4-backend-secret0",\
"node-name":"libvirt-hostdev4-backend","read-only":false}'
\
-device scsi-generic,bus=scsi0.0,channel=0,scsi-id=3,lun=4,\
drive=libvirt-hostdev4-backend,id=hostdev4 \
--object secret,id=hostdev5-secret0,\
+-object secret,id=libvirt-hostdev5-backend-secret0,\
data=9eao5F8qtkGt+seB1HYivWIxbtwUu6MQtg1zpj/oDtUsPr1q8wBYM91uEHCn6j/1,\
keyid=masterKey0,iv=AAECAwQFBgcICQoLDA0ODw==,format=base64 \
-blockdev
'{"driver":"iscsi","portal":"example.org:3260",\
"target":"iqn.1992-01.com.example:storage","lun":2,"transport":"tcp",\
-"user":"myname","password-secret":"hostdev5-secret0",\
+"user":"myname","password-secret":"libvirt-hostdev5-backend-secret0",\
"initiator-name":"iqn.2020-07.com.example:test",\
"node-name":"libvirt-hostdev5-backend","read-only":false}'
\
-device scsi-generic,bus=scsi0.0,channel=0,scsi-id=3,lun=5,\
--
2.26.2