]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemuBuildHostdevSCSIAttachPrepare: Propagate 'readonly' flag also for iSCSI
authorPeter Krempa <pkrempa@redhat.com>
Tue, 15 Sep 2020 15:58:04 +0000 (17:58 +0200)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 16 Sep 2020 07:08:56 +0000 (09:08 +0200)
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>
src/qemu/qemu_command.c
tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.x86_64-latest.args

index c5c587b97d09d318a8d1b3732e73341a316c0f39..0ba348e911d314292f9b225798ed756cf07cc30c 100644 (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;
 
index 47c3f09db55edf6b3a731bbbee337bb29beef3ec..bd0d790b08ce7b472d8174afd77ac8a3ac0f7fdd 100644 (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,\