schema: add support for Windows file paths and device names

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Matt Coleman <matt@datto.com>
This commit is contained in:
Matt Coleman 2020-11-23 12:39:53 -05:00 committed by Daniel P. Berrangé
parent a7a1d1f59e
commit ce8fb26a66
7 changed files with 87 additions and 2 deletions

View File

@ -299,7 +299,7 @@
<define name="absFilePath">
<data type="string">
<param name="pattern">/.+</param>
<param name="pattern">(/|[a-zA-Z]:\\).+</param>
</data>
</define>

View File

@ -1691,7 +1691,10 @@
<interleave>
<optional>
<attribute name="dev">
<ref name="absFilePath"/>
<choice>
<ref name="absFilePath"/>
<ref name="deviceName"/>
</choice>
</attribute>
</optional>
<ref name="diskSourceCommon"/>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View 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");