1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-23 21:34:54 +03:00

qemu: domain: Assume 'raw' default storage format also for network storage

Post parse callback adds the 'raw' type only for local files. Remote
files can also have backing store (even local) so we should do this also
for network backed storage.

Note that virStorageFileGetMetadata always considers files with no type
as raw so we will not accidentally traverse the backing chain and allow
unexpected files being labelled with svirt labels.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2018-10-04 14:43:46 +02:00
parent 6b618d2d5f
commit 2f78ca803a
13 changed files with 17 additions and 14 deletions

View File

@ -6642,8 +6642,7 @@ qemuDomainDeviceDiskDefPostParse(virDomainDiskDefPtr disk,
/* default disk format for drives */
if (virDomainDiskGetFormat(disk) == VIR_STORAGE_FILE_NONE &&
(virDomainDiskGetType(disk) == VIR_STORAGE_TYPE_FILE ||
virDomainDiskGetType(disk) == VIR_STORAGE_TYPE_BLOCK))
virDomainDiskGetType(disk) != VIR_STORAGE_TYPE_VOLUME)
virDomainDiskSetFormat(disk, VIR_STORAGE_FILE_RAW);
/* default disk format for mirrored drive */

View File

@ -26,7 +26,7 @@ if=none,id=drive-virtio-disk0 \
-device virtio-blk-pci,bus=pci.0,addr=0x3,drive=drive-virtio-disk0,\
id=virtio-disk0,bootindex=1 \
-drive 'file=gluster+unix:///Volume2/Image?socket=/path/to/sock,file.debug=4,\
if=none,id=drive-virtio-disk1' \
format=raw,if=none,id=drive-virtio-disk1' \
-device virtio-blk-pci,bus=pci.0,addr=0x4,drive=drive-virtio-disk1,\
id=virtio-disk1 \
-drive file.driver=gluster,file.volume=Volume3,file.path=Image.qcow2,\

View File

@ -29,7 +29,7 @@ if=none,id=drive-virtio-disk0 \
-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x2,drive=drive-virtio-disk0,\
id=virtio-disk0,bootindex=1 \
-drive 'file=gluster+unix:///Volume2/Image?socket=/path/to/sock,file.debug=4,\
if=none,id=drive-virtio-disk1' \
format=raw,if=none,id=drive-virtio-disk1' \
-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x3,drive=drive-virtio-disk1,\
id=virtio-disk1 \
-drive file.driver=gluster,file.volume=Volume3,file.path=Image.qcow2,\

View File

@ -29,7 +29,7 @@ if=none,id=drive-virtio-disk0 \
-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x2,drive=drive-virtio-disk0,\
id=virtio-disk0,bootindex=1 \
-drive 'file=gluster+unix:///Volume2/Image?socket=/path/to/sock,file.debug=4,\
if=none,id=drive-virtio-disk1' \
format=raw,if=none,id=drive-virtio-disk1' \
-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x3,drive=drive-virtio-disk1,\
id=virtio-disk1 \
-drive file.driver=gluster,file.volume=Volume3,file.path=Image.qcow2,\

View File

@ -31,7 +31,8 @@ if=none,id=drive-virtio-disk1 \
-device virtio-blk-pci,bus=pci.0,addr=0x5,drive=drive-virtio-disk1,\
id=virtio-disk1 \
-drive file=iscsi://myname:AQCVn5hO6HzFAhAAq0NCv8jtJcIcE+HOBlMQ1A@example.org:\
6000/iqn.1992-01.com.example%3Astorage/1,if=none,id=drive-virtio-disk2 \
6000/iqn.1992-01.com.example%3Astorage/1,format=raw,if=none,\
id=drive-virtio-disk2 \
-device virtio-blk-pci,bus=pci.0,addr=0x6,drive=drive-virtio-disk2,\
id=virtio-disk2 \
-drive file=iscsi://myname:AQCVn5hO6HzFAhAAq0NCv8jtJcIcE+HOBlMQ1A@example.org:\

View File

@ -40,7 +40,7 @@ data=9eao5F8qtkGt+seB1HYivWIxbtwUu6MQtg1zpj/oDtUsPr1q8wBYM91uEHCn6j/1,\
keyid=masterKey0,iv=AAECAwQFBgcICQoLDA0ODw==,format=base64 \
-drive file.driver=iscsi,file.portal=example.org:6000,\
file.target=iqn.1992-01.com.example:storage,file.lun=1,file.transport=tcp,\
file.user=myname,file.password-secret=virtio-disk2-secret0,if=none,\
file.user=myname,file.password-secret=virtio-disk2-secret0,format=raw,if=none,\
id=drive-virtio-disk2 \
-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x5,drive=drive-virtio-disk2,\
id=virtio-disk2 \

View File

@ -40,7 +40,7 @@ data=9eao5F8qtkGt+seB1HYivWIxbtwUu6MQtg1zpj/oDtUsPr1q8wBYM91uEHCn6j/1,\
keyid=masterKey0,iv=AAECAwQFBgcICQoLDA0ODw==,format=base64 \
-drive file.driver=iscsi,file.portal=example.org:6000,\
file.target=iqn.1992-01.com.example:storage,file.lun=1,file.transport=tcp,\
file.user=myname,file.password-secret=virtio-disk2-secret0,if=none,\
file.user=myname,file.password-secret=virtio-disk2-secret0,format=raw,if=none,\
id=drive-virtio-disk2 \
-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x5,drive=drive-virtio-disk2,\
id=virtio-disk2 \

View File

@ -24,7 +24,8 @@ server,nowait \
-drive file=nbd:example.org:6000,format=raw,if=none,id=drive-virtio-disk0 \
-device virtio-blk-pci,bus=pci.0,addr=0x3,drive=drive-virtio-disk0,\
id=virtio-disk0,bootindex=1 \
-drive file=nbd:example.org:6000:exportname=bar,if=none,id=drive-virtio-disk1 \
-drive file=nbd:example.org:6000:exportname=bar,format=raw,if=none,\
id=drive-virtio-disk1 \
-device virtio-blk-pci,bus=pci.0,addr=0x4,drive=drive-virtio-disk1,\
id=virtio-disk1 \
-drive 'file=nbd://[::1]:6000,format=raw,if=none,id=drive-virtio-disk2' \

View File

@ -27,7 +27,8 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
-drive file=nbd:example.org:6000,format=raw,if=none,id=drive-virtio-disk0 \
-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x2,drive=drive-virtio-disk0,\
id=virtio-disk0,bootindex=1 \
-drive file=nbd:example.org:6000:exportname=bar,if=none,id=drive-virtio-disk1 \
-drive file=nbd:example.org:6000:exportname=bar,format=raw,if=none,\
id=drive-virtio-disk1 \
-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x3,drive=drive-virtio-disk1,\
id=virtio-disk1 \
-drive 'file=nbd://[::1]:6000,format=raw,if=none,id=drive-virtio-disk2' \

View File

@ -27,7 +27,8 @@ file=/tmp/lib/domain--1-QEMUGuest1/master-key.aes \
-drive file=nbd:example.org:6000,format=raw,if=none,id=drive-virtio-disk0 \
-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x2,drive=drive-virtio-disk0,\
id=virtio-disk0,bootindex=1 \
-drive file=nbd:example.org:6000:exportname=bar,if=none,id=drive-virtio-disk1 \
-drive file=nbd:example.org:6000:exportname=bar,format=raw,if=none,\
id=drive-virtio-disk1 \
-device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x3,drive=drive-virtio-disk1,\
id=virtio-disk1 \
-drive 'file=nbd://[::1]:6000,format=raw,if=none,id=drive-virtio-disk2' \

View File

@ -23,7 +23,7 @@
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</disk>
<disk type='network' device='disk'>
<driver name='qemu'/>
<driver name='qemu' type='raw'/>
<source protocol='gluster' name='Volume2/Image'>
<host transport='unix' socket='/path/to/sock'/>
</source>

View File

@ -31,7 +31,7 @@
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</disk>
<disk type='network' device='disk'>
<driver name='qemu'/>
<driver name='qemu' type='raw'/>
<auth username='myname'>
<secret type='iscsi' usage='mycluster_myname'/>
</auth>

View File

@ -23,7 +23,7 @@
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</disk>
<disk type='network' device='disk'>
<driver name='qemu'/>
<driver name='qemu' type='raw'/>
<source protocol='nbd' name='bar'>
<host name='example.org' port='6000'/>
</source>