qemuBuildHostdevSCSIAttachPrepare: Propagate 'readonly' flag also for iSCSI

The 'readonly' hostdev property is stored separately from the
virStorageSource as some hostdevs are not described by a virStorage
source. We need to propagate the flag to the virStorage source also for
iSCSI backends as it's used to generate the backend properties.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1868856

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Peter Krempa 2020-09-15 17:58:04 +02:00
parent c58c970586
commit f2d90b558f
2 changed files with 2 additions and 2 deletions

View File

@ -5117,7 +5117,6 @@ qemuBuildHostdevSCSIAttachPrepare(virDomainHostdevDefPtr hostdev,
src = scsisrc->u.host.src;
src->type = VIR_STORAGE_TYPE_BLOCK;
src->readonly = hostdev->readonly;
src->path = g_strdup_printf("/dev/%s", devstr);
break;
@ -5132,6 +5131,7 @@ qemuBuildHostdevSCSIAttachPrepare(virDomainHostdevDefPtr hostdev,
return NULL;
}
src->readonly = hostdev->readonly;
ret->storageNodeName = src->nodestorage;
*backendAlias = src->nodestorage;

View File

@ -53,7 +53,7 @@ drive=libvirt-4-backend,id=ua-7996c8dc-a4fa-4012-b76f-043d20144263 \
drive=libvirt-5-backend,id=hostdev2 \
-blockdev '{"driver":"iscsi","portal":"example.org:3260",\
"target":"iqn.1992-01.com.example","lun":1,"transport":"tcp",\
"node-name":"libvirt-6-backend","read-only":false}' \
"node-name":"libvirt-6-backend","read-only":true}' \
-device scsi-generic,bus=scsi0.0,channel=0,scsi-id=2,lun=5,\
drive=libvirt-6-backend,id=hostdev3 \
-object secret,id=libvirt-7-backend-secret0,\