[libvirt] [PATCH v2 04/12] qemu: domain: Assume 'raw' default storage format also for network storage

Peter Krempa pkrempa at redhat.com
Fri Oct 5 12:14:03 UTC 2018


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.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/qemu/qemu_domain.c                             | 4 +---
 tests/qemuxml2argvdata/disk-source-pool-mode.args  | 6 +++---
 tests/qemuxml2argvdata/disk-source-pool.args       | 4 ++--
 tests/qemuxml2xmloutdata/disk-source-pool-mode.xml | 6 +++---
 tests/qemuxml2xmloutdata/disk-source-pool.xml      | 2 +-
 5 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index f00f1b3fdb..82737bcdee 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -6364,9 +6364,7 @@ qemuDomainDeviceDiskDefPostParse(virDomainDiskDefPtr disk,
         return -1;

     /* default disk format for drives */
-    if (virDomainDiskGetFormat(disk) == VIR_STORAGE_FILE_NONE &&
-        (virDomainDiskGetType(disk) == VIR_STORAGE_TYPE_FILE ||
-         virDomainDiskGetType(disk) == VIR_STORAGE_TYPE_BLOCK))
+    if (virDomainDiskGetFormat(disk) == VIR_STORAGE_FILE_NONE)
         virDomainDiskSetFormat(disk, VIR_STORAGE_FILE_RAW);

     /* default disk format for mirrored drive */
diff --git a/tests/qemuxml2argvdata/disk-source-pool-mode.args b/tests/qemuxml2argvdata/disk-source-pool-mode.args
index e8d9aacd77..930d360d16 100644
--- a/tests/qemuxml2argvdata/disk-source-pool-mode.args
+++ b/tests/qemuxml2argvdata/disk-source-pool-mode.args
@@ -21,16 +21,16 @@ server,nowait \
 -no-shutdown \
 -no-acpi \
 -usb \
--drive file=/some/block/device/unit:0:0:1,if=none,id=drive-ide0-0-1,\
+-drive file=/some/block/device/unit:0:0:1,format=raw,if=none,id=drive-ide0-0-1,\
 media=cdrom,readonly=on \
 -device ide-drive,bus=ide.0,unit=1,drive=drive-ide0-0-1,id=ide0-0-1 \
--drive file=iscsi://iscsi.example.com:3260/demo-target/2,if=none,\
+-drive file=iscsi://iscsi.example.com:3260/demo-target/2,format=raw,if=none,\
 id=drive-ide0-0-2,media=cdrom,readonly=on \
 -device ide-drive,bus=ide.0,unit=2,drive=drive-ide0-0-2,id=ide0-0-2 \
 -drive file=/tmp/idedisk.img,format=raw,if=none,id=drive-ide0-0-3 \
 -device ide-drive,bus=ide.0,unit=3,drive=drive-ide0-0-3,id=ide0-0-3,\
 bootindex=1 \
--drive file=iscsi://iscsi.example.com:3260/demo-target/3,if=none,\
+-drive file=iscsi://iscsi.example.com:3260/demo-target/3,format=raw,if=none,\
 id=drive-ide0-0-4,media=cdrom,readonly=on \
 -device ide-drive,bus=ide.0,unit=4,drive=drive-ide0-0-4,id=ide0-0-4 \
 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git a/tests/qemuxml2argvdata/disk-source-pool.args b/tests/qemuxml2argvdata/disk-source-pool.args
index 49dc853bcd..fe95aa2250 100644
--- a/tests/qemuxml2argvdata/disk-source-pool.args
+++ b/tests/qemuxml2argvdata/disk-source-pool.args
@@ -21,8 +21,8 @@ server,nowait \
 -no-shutdown \
 -no-acpi \
 -usb \
--drive file=/some/block/device/cdrom,if=none,id=drive-ide0-0-1,media=cdrom,\
-readonly=on \
+-drive file=/some/block/device/cdrom,format=raw,if=none,id=drive-ide0-0-1,\
+media=cdrom,readonly=on \
 -device ide-drive,bus=ide.0,unit=1,drive=drive-ide0-0-1,id=ide0-0-1 \
 -drive if=none,id=drive-ide0-1-0,media=cdrom,readonly=on \
 -device ide-drive,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0 \
diff --git a/tests/qemuxml2xmloutdata/disk-source-pool-mode.xml b/tests/qemuxml2xmloutdata/disk-source-pool-mode.xml
index 29706200db..4d039102fd 100644
--- a/tests/qemuxml2xmloutdata/disk-source-pool-mode.xml
+++ b/tests/qemuxml2xmloutdata/disk-source-pool-mode.xml
@@ -15,7 +15,7 @@
   <devices>
     <emulator>/usr/bin/qemu-system-i686</emulator>
     <disk type='volume' device='cdrom'>
-      <driver name='qemu'/>
+      <driver name='qemu' type='raw'/>
       <source pool='pool-iscsi-auth' volume='unit:0:0:1' mode='host'>
         <seclabel model='selinux' relabel='yes'>
           <label>system_u:system_r:public_content_t:s0</label>
@@ -26,7 +26,7 @@
       <address type='drive' controller='0' bus='0' target='0' unit='1'/>
     </disk>
     <disk type='volume' device='cdrom'>
-      <driver name='qemu'/>
+      <driver name='qemu' type='raw'/>
       <source pool='pool-iscsi' volume='unit:0:0:2' mode='direct'>
         <seclabel model='selinux' relabel='yes'>
           <label>system_u:system_r:public_content_t:s0</label>
@@ -43,7 +43,7 @@
       <address type='drive' controller='0' bus='0' target='0' unit='3'/>
     </disk>
     <disk type='volume' device='cdrom'>
-      <driver name='qemu'/>
+      <driver name='qemu' type='raw'/>
       <auth username='myname'>
         <secret type='iscsi' usage='mycluster_myname'/>
       </auth>
diff --git a/tests/qemuxml2xmloutdata/disk-source-pool.xml b/tests/qemuxml2xmloutdata/disk-source-pool.xml
index 567b22db84..51851b220a 100644
--- a/tests/qemuxml2xmloutdata/disk-source-pool.xml
+++ b/tests/qemuxml2xmloutdata/disk-source-pool.xml
@@ -15,7 +15,7 @@
   <devices>
     <emulator>/usr/bin/qemu-system-i686</emulator>
     <disk type='volume' device='cdrom'>
-      <driver name='qemu'/>
+      <driver name='qemu' type='raw'/>
       <source pool='pool-disk' volume='block+cdrom'>
         <seclabel model='selinux' relabel='yes'>
           <label>system_u:system_r:public_content_t:s0</label>
-- 
2.17.1




More information about the libvir-list mailing list