Read-only iscsi disk? Or hot-plug?

Peter Krempa pkrempa at redhat.com
Mon Sep 7 08:35:41 UTC 2020


On Mon, Sep 07, 2020 at 10:07:29 +0200, Paul van der Vlis wrote:
> Hello,
> 
> I have an iSCSI disk with a backup. I want to use that backup on another
> machine to test putting back data.
> 
> What I use now is this:
> ----
>     <disk type='block' device='disk'>
>       <driver name='qemu' type='raw' cache='directsync' io='native'/>
>       <source dev='/dev/disk/by-id/scsi-36e843b6afdddf65dc4e9d4dc2dab66de'/>
>       <target dev='vdh' bus='virtio'/>
>       <address type='pci' domain='0x0000' bus='0x00' slot='0x0c'
> function='0x0'/>
>     </disk>
> ----
> 
> Is it possible to do this read-only?

Yes, you can add a <readonly/> element under disk to make it read only.

You'll also need to use <shareable/> on the VM where it's read-write so
that both VMs can access it.

Note that, if the VM in read-mode is actively writing to the device, the
read-only VM may not know about that and may have the data changed while
reading.

> What I also could do is to hot-unplug the disk at the production
> machine, and then hot-plug it at the test-machine. But the machines are
> Windows, and I don't know Windows well.

Windows should support unplug of the virtio device, so this should work
as well.




More information about the libvirt-users mailing list