[PATCH 2/3] qemu: domain: Assume 'raw' default storage format also for network storage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 src/qemu/qemu_domain.c                                         | 3 +--
 tests/qemuxml2argvdata/disk-network-gluster.args               | 2 +-
 tests/qemuxml2argvdata/disk-network-gluster.x86_64-2.12.0.args | 2 +-
 tests/qemuxml2argvdata/disk-network-gluster.x86_64-latest.args | 2 +-
 tests/qemuxml2argvdata/disk-network-iscsi.args                 | 3 ++-
 tests/qemuxml2argvdata/disk-network-iscsi.x86_64-2.12.0.args   | 2 +-
 tests/qemuxml2argvdata/disk-network-iscsi.x86_64-latest.args   | 2 +-
 tests/qemuxml2argvdata/disk-network-nbd.args                   | 3 ++-
 tests/qemuxml2argvdata/disk-network-nbd.x86_64-2.12.0.args     | 3 ++-
 tests/qemuxml2argvdata/disk-network-nbd.x86_64-latest.args     | 3 ++-
 tests/qemuxml2xmloutdata/disk-network-gluster.xml              | 2 +-
 tests/qemuxml2xmloutdata/disk-network-iscsi.xml                | 2 +-
 tests/qemuxml2xmloutdata/disk-network-nbd.xml                  | 2 +-
 13 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 5bfe4fe14e..20ce9330e5 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -6639,8 +6639,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 */
diff --git a/tests/qemuxml2argvdata/disk-network-gluster.args b/tests/qemuxml2argvdata/disk-network-gluster.args
index 9952402d92..1538df9068 100644
--- a/tests/qemuxml2argvdata/disk-network-gluster.args
+++ b/tests/qemuxml2argvdata/disk-network-gluster.args
@@ -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,\
diff --git a/tests/qemuxml2argvdata/disk-network-gluster.x86_64-2.12.0.args b/tests/qemuxml2argvdata/disk-network-gluster.x86_64-2.12.0.args
index a904ff5c70..c463db0ed5 100644
--- a/tests/qemuxml2argvdata/disk-network-gluster.x86_64-2.12.0.args
+++ b/tests/qemuxml2argvdata/disk-network-gluster.x86_64-2.12.0.args
@@ -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,\
diff --git a/tests/qemuxml2argvdata/disk-network-gluster.x86_64-latest.args b/tests/qemuxml2argvdata/disk-network-gluster.x86_64-latest.args
index a4e968b917..9b99db8715 100644
--- a/tests/qemuxml2argvdata/disk-network-gluster.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/disk-network-gluster.x86_64-latest.args
@@ -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,\
diff --git a/tests/qemuxml2argvdata/disk-network-iscsi.args b/tests/qemuxml2argvdata/disk-network-iscsi.args
index 45da3a9de9..3cd3b5e03e 100644
--- a/tests/qemuxml2argvdata/disk-network-iscsi.args
+++ b/tests/qemuxml2argvdata/disk-network-iscsi.args
@@ -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@xxxxxxxxxxx:\
-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@xxxxxxxxxxx:\
diff --git a/tests/qemuxml2argvdata/disk-network-iscsi.x86_64-2.12.0.args b/tests/qemuxml2argvdata/disk-network-iscsi.x86_64-2.12.0.args
index e298220e09..4b648a985d 100644
--- a/tests/qemuxml2argvdata/disk-network-iscsi.x86_64-2.12.0.args
+++ b/tests/qemuxml2argvdata/disk-network-iscsi.x86_64-2.12.0.args
@@ -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 \
diff --git a/tests/qemuxml2argvdata/disk-network-iscsi.x86_64-latest.args b/tests/qemuxml2argvdata/disk-network-iscsi.x86_64-latest.args
index e7cc4cd1fd..be9ab18314 100644
--- a/tests/qemuxml2argvdata/disk-network-iscsi.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/disk-network-iscsi.x86_64-latest.args
@@ -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 \
diff --git a/tests/qemuxml2argvdata/disk-network-nbd.args b/tests/qemuxml2argvdata/disk-network-nbd.args
index df4436b027..4abff25a0e 100644
--- a/tests/qemuxml2argvdata/disk-network-nbd.args
+++ b/tests/qemuxml2argvdata/disk-network-nbd.args
@@ -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' \
diff --git a/tests/qemuxml2argvdata/disk-network-nbd.x86_64-2.12.0.args b/tests/qemuxml2argvdata/disk-network-nbd.x86_64-2.12.0.args
index 330aadea4b..86bde153ee 100644
--- a/tests/qemuxml2argvdata/disk-network-nbd.x86_64-2.12.0.args
+++ b/tests/qemuxml2argvdata/disk-network-nbd.x86_64-2.12.0.args
@@ -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' \
diff --git a/tests/qemuxml2argvdata/disk-network-nbd.x86_64-latest.args b/tests/qemuxml2argvdata/disk-network-nbd.x86_64-latest.args
index f7e8502385..85452e715a 100644
--- a/tests/qemuxml2argvdata/disk-network-nbd.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/disk-network-nbd.x86_64-latest.args
@@ -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' \
diff --git a/tests/qemuxml2xmloutdata/disk-network-gluster.xml b/tests/qemuxml2xmloutdata/disk-network-gluster.xml
index ae2899040f..2c7c46b013 100644
--- a/tests/qemuxml2xmloutdata/disk-network-gluster.xml
+++ b/tests/qemuxml2xmloutdata/disk-network-gluster.xml
@@ -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>
diff --git a/tests/qemuxml2xmloutdata/disk-network-iscsi.xml b/tests/qemuxml2xmloutdata/disk-network-iscsi.xml
index b089b2950d..f1348d583e 100644
--- a/tests/qemuxml2xmloutdata/disk-network-iscsi.xml
+++ b/tests/qemuxml2xmloutdata/disk-network-iscsi.xml
@@ -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>
diff --git a/tests/qemuxml2xmloutdata/disk-network-nbd.xml b/tests/qemuxml2xmloutdata/disk-network-nbd.xml
index bb4223a3f0..818e8d7d7c 100644
--- a/tests/qemuxml2xmloutdata/disk-network-nbd.xml
+++ b/tests/qemuxml2xmloutdata/disk-network-nbd.xml
@@ -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>
-- 
2.20.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux