Follow up of commit 340bb6b7 to add unit tests for the QED format
support. Also add missing QED case in xenFormatXLDisk()
---
 v2:
   * Separated the QED test files into another set ti make this
     test conditionnal
   * Removed useless #ifdef
 src/xenconfig/xen_xl.c               |  3 +++
 tests/xlconfigdata/test-disk-qed.cfg | 25 ++++++++++++++++++++
 tests/xlconfigdata/test-disk-qed.xml | 45 ++++++++++++++++++++++++++++++++++++
 tests/xlconfigtest.c                 |  3 +++
 4 files changed, 76 insertions(+)
 create mode 100644 tests/xlconfigdata/test-disk-qed.cfg
 create mode 100644 tests/xlconfigdata/test-disk-qed.xml

diff --git a/src/xenconfig/xen_xl.c b/src/xenconfig/xen_xl.c
index 048ecd579..18d9fe369 100644
--- a/src/xenconfig/xen_xl.c
+++ b/src/xenconfig/xen_xl.c
@@ -1050,6 +1050,9 @@ xenFormatXLDisk(virConfValuePtr list, virDomainDiskDefPtr 
disk)
         case VIR_STORAGE_FILE_QCOW2:
             virBufferAddLit(&buf, "qcow2");
             break;
+        case VIR_STORAGE_FILE_QED:
+            virBufferAddLit(&buf, "qed");
+            break;
       /* set default */
         default:
             virBufferAddLit(&buf, "raw");
diff --git a/tests/xlconfigdata/test-disk-qed.cfg 
b/tests/xlconfigdata/test-disk-qed.cfg
new file mode 100644
index 000000000..2a2c4fa84
--- /dev/null
+++ b/tests/xlconfigdata/test-disk-qed.cfg
@@ -0,0 +1,25 @@
+name = "XenGuest2"
+uuid = "c7a5fdb2-cdaf-9455-926a-d65c16db1809"
+maxmem = 579
+memory = 394
+vcpus = 1
+pae = 1
+acpi = 1
+apic = 1
+viridian = 0
+rtc_timeoffset = 0
+localtime = 0
+on_poweroff = "destroy"
+on_reboot = "restart"
+on_crash = "restart"
+device_model = "/usr/lib/xen/bin/qemu-system-i386"
+sdl = 0
+vnc = 1
+vncunused = 1
+vnclisten = "127.0.0.1"
+vif = [ "mac=00:16:3e:66:92:9c,bridge=xenbr1,script=vif-bridge,model=e1000" ]
+parallel = "none"
+serial = "none"
+builder = "hvm"
+boot = "d"
+disk = [ "/var/lib/libvirt/images/XenGuest2,qed,hda,rw", ]
diff --git a/tests/xlconfigdata/test-disk-qed.xml 
b/tests/xlconfigdata/test-disk-qed.xml
new file mode 100644
index 000000000..230382dd5
--- /dev/null
+++ b/tests/xlconfigdata/test-disk-qed.xml
@@ -0,0 +1,45 @@
+<domain type='xen'>
+  <name>XenGuest2</name>
+  <uuid>c7a5fdb2-cdaf-9455-926a-d65c16db1809</uuid>
+  <memory unit='KiB'>592896</memory>
+  <currentMemory unit='KiB'>403456</currentMemory>
+  <vcpu placement='static'>1</vcpu>
+  <os>
+    <type arch='x86_64' machine='xenfv'>hvm</type>
+    <loader type='rom'>/usr/lib/xen/boot/hvmloader</loader>
+    <boot dev='cdrom'/>
+  </os>
+  <features>
+    <acpi/>
+    <apic/>
+    <pae/>
+  </features>
+  <clock offset='variable' adjustment='0' basis='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>restart</on_crash>
+  <devices>
+    <emulator>/usr/lib/xen/bin/qemu-system-i386</emulator>
+    <disk type='file' device='disk'>
+      <driver name='qemu' type='qed'/>
+      <source file='/var/lib/libvirt/images/XenGuest2'/>
+      <target dev='hda' bus='ide'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <controller type='ide' index='0'/>
+    <interface type='bridge'>
+      <mac address='00:16:3e:66:92:9c'/>
+      <source bridge='xenbr1'/>
+      <script path='vif-bridge'/>
+      <model type='e1000'/>
+    </interface>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1'>
+      <listen type='address' address='127.0.0.1'/>
+    </graphics>
+    <video>
+      <model type='cirrus' vram='8192' heads='1' primary='yes'/>
+    </video>
+  </devices>
+</domain>
diff --git a/tests/xlconfigtest.c b/tests/xlconfigtest.c
index 31892da69..cab0c0d47 100644
--- a/tests/xlconfigtest.c
+++ b/tests/xlconfigtest.c
@@ -258,6 +258,9 @@ mymain(void)
     DO_TEST("new-disk");
     DO_TEST_FORMAT("disk-positional-parms-full", false);
     DO_TEST_FORMAT("disk-positional-parms-partial", false);
+#ifdef LIBXL_HAVE_QED
+    DO_TEST_FORMAT("disk-qed", false);
+#endif
     DO_TEST("spice");
     DO_TEST("spice-features");
     DO_TEST("vif-rate");
-- 
2.11.0

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

Reply via email to