]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
schema: add support for Windows file paths and device names
authorMatt Coleman <mcoleman@datto.com>
Mon, 23 Nov 2020 17:39:53 +0000 (12:39 -0500)
committerDaniel P. Berrangé <berrange@redhat.com>
Tue, 24 Nov 2020 18:45:07 +0000 (18:45 +0000)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Matt Coleman <matt@datto.com>
docs/schemas/basictypes.rng
docs/schemas/domaincommon.rng
tests/genericxml2xmlindata/disk-hyperv-physical.xml [new file with mode: 0644]
tests/genericxml2xmlindata/disk-hyperv-virtual.xml [new file with mode: 0644]
tests/genericxml2xmloutdata/disk-hyperv-physical.xml [new file with mode: 0644]
tests/genericxml2xmloutdata/disk-hyperv-virtual.xml [new file with mode: 0644]
tests/genericxml2xmltest.c

index ea18b2d2fbd02eac4513d0405a5d723e35322a2f..fc52799466592cd18cb170ef987475fccf3ab583 100644 (file)
 
   <define name="absFilePath">
     <data type="string">
-      <param name="pattern">/.+</param>
+      <param name="pattern">(/|[a-zA-Z]:\\).+</param>
     </data>
   </define>
 
index 1ccc9759ea7824de7255606e8101256a36d27b51..795b654feb863891725e3aade9eb937d8e0577cf 100644 (file)
         <interleave>
           <optional>
             <attribute name="dev">
-              <ref name="absFilePath"/>
+              <choice>
+                <ref name="absFilePath"/>
+                <ref name="deviceName"/>
+              </choice>
             </attribute>
           </optional>
           <ref name="diskSourceCommon"/>
diff --git a/tests/genericxml2xmlindata/disk-hyperv-physical.xml b/tests/genericxml2xmlindata/disk-hyperv-physical.xml
new file mode 100644 (file)
index 0000000..a7f34c1
--- /dev/null
@@ -0,0 +1,17 @@
+<domain type='hyperv'>
+  <name>test_disk-hyperv</name>
+  <uuid>deadbeef-dead-beef-dead-beefdeadbeef</uuid>
+  <memory unit='KiB'>1048576</memory>
+  <vcpu placement='static'>3</vcpu>
+  <os>
+    <type>hvm</type>
+  </os>
+  <devices>
+    <disk type='block' device='disk'>
+      <source dev='2'/>
+      <target dev='sdb' bus='scsi'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <controller type='scsi' index='0'/>
+  </devices>
+</domain>
diff --git a/tests/genericxml2xmlindata/disk-hyperv-virtual.xml b/tests/genericxml2xmlindata/disk-hyperv-virtual.xml
new file mode 100644 (file)
index 0000000..bbc56c9
--- /dev/null
@@ -0,0 +1,17 @@
+<domain type='hyperv'>
+  <name>test_disk-hyperv</name>
+  <uuid>deadbeef-dead-beef-dead-beefdeadbeef</uuid>
+  <memory unit='KiB'>1048576</memory>
+  <vcpu placement='static'>3</vcpu>
+  <os>
+    <type>hvm</type>
+  </os>
+  <devices>
+    <disk type='file' device='disk'>
+      <source file='X:\test_disk-hyperv.vhdx'/>
+      <target dev='sda' bus='scsi'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <controller type='scsi' index='0'/>
+  </devices>
+</domain>
diff --git a/tests/genericxml2xmloutdata/disk-hyperv-physical.xml b/tests/genericxml2xmloutdata/disk-hyperv-physical.xml
new file mode 100644 (file)
index 0000000..112a508
--- /dev/null
@@ -0,0 +1,23 @@
+<domain type='hyperv'>
+  <name>test_disk-hyperv</name>
+  <uuid>deadbeef-dead-beef-dead-beefdeadbeef</uuid>
+  <memory unit='KiB'>1048576</memory>
+  <currentMemory unit='KiB'>1048576</currentMemory>
+  <vcpu placement='static'>3</vcpu>
+  <os>
+    <type arch='x86_64'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <disk type='block' device='disk'>
+      <source dev='2'/>
+      <target dev='sdb' bus='scsi'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <controller type='scsi' index='0'/>
+  </devices>
+</domain>
diff --git a/tests/genericxml2xmloutdata/disk-hyperv-virtual.xml b/tests/genericxml2xmloutdata/disk-hyperv-virtual.xml
new file mode 100644 (file)
index 0000000..dadd331
--- /dev/null
@@ -0,0 +1,23 @@
+<domain type='hyperv'>
+  <name>test_disk-hyperv</name>
+  <uuid>deadbeef-dead-beef-dead-beefdeadbeef</uuid>
+  <memory unit='KiB'>1048576</memory>
+  <currentMemory unit='KiB'>1048576</currentMemory>
+  <vcpu placement='static'>3</vcpu>
+  <os>
+    <type arch='x86_64'>hvm</type>
+    <boot dev='hd'/>
+  </os>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>destroy</on_crash>
+  <devices>
+    <disk type='file' device='disk'>
+      <source file='X:\test_disk-hyperv.vhdx'/>
+      <target dev='sda' bus='scsi'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <controller type='scsi' index='0'/>
+  </devices>
+</domain>
index 5110bfba8667a44dc3c0c040eab8ae91c4cd1264..5e8f58b4a2a62e693c34038b19431787cc051d54 100644 (file)
@@ -154,6 +154,8 @@ mymain(void)
     DO_TEST_FULL(name, 1, false, TEST_COMPARE_DOM_XML2XML_RESULT_SUCCESS)
 
     DO_TEST_DIFFERENT("disk-virtio");
+    DO_TEST_DIFFERENT("disk-hyperv-physical");
+    DO_TEST_DIFFERENT("disk-hyperv-virtual");
 
     DO_TEST_DIFFERENT("graphics-vnc-minimal");
     DO_TEST_DIFFERENT("graphics-vnc-manual-port");