Check the generated OVF for -o rhv and -o vdsm outputs. Variable UUIDs
and date/times are filtered out. Make sure the the important UUIDs
(disk, volume, VM) are where we think they should be.
Signed-off-by: Tomáš Golembiovský <tgolembi(a)redhat.com>
---
v2v/Makefile.am | 2 +
v2v/test-v2v-o-rhv.ovf.expected | 92 ++++++++++++++++++++++++++++++++
v2v/test-v2v-o-rhv.sh | 21 ++++++++
v2v/test-v2v-o-vdsm-options.ovf.expected | 92 ++++++++++++++++++++++++++++++++
v2v/test-v2v-o-vdsm-options.sh | 17 ++++++
5 files changed, 224 insertions(+)
create mode 100644 v2v/test-v2v-o-rhv.ovf.expected
create mode 100644 v2v/test-v2v-o-vdsm-options.ovf.expected
diff --git a/v2v/Makefile.am b/v2v/Makefile.am
index 3a978d727..8ec002fd3 100644
--- a/v2v/Makefile.am
+++ b/v2v/Makefile.am
@@ -472,7 +472,9 @@ EXTRA_DIST += \
test-v2v-o-libvirt.sh \
test-v2v-o-null.sh \
test-v2v-o-qemu.sh \
+ test-v2v-o-rhv.ovf.expected \
test-v2v-o-rhv.sh \
+ test-v2v-o-vdsm-options.ovf.expected \
test-v2v-o-vdsm-options.sh \
test-v2v-oa-option.sh \
test-v2v-of-option.sh \
diff --git a/v2v/test-v2v-o-rhv.ovf.expected b/v2v/test-v2v-o-rhv.ovf.expected
new file mode 100644
index 000000000..f2f7839dc
--- /dev/null
+++ b/v2v/test-v2v-o-rhv.ovf.expected
@@ -0,0 +1,92 @@
+<?xml version='1.0' encoding='utf-8'?>
+<ovf:Envelope
xmlns:rasd='http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_Res...
xmlns:vssd='http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_Vir...
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xmlns:ovf='http://schemas.dmtf.org/ovf/envelope/1/' ovf:version='0.9'>
+ <!-- generated by virt-v2v -->
+ <References>
+ <File ovf:href='#DISK_ID#/#VOL_ID#' ovf:id='#VOL_ID#'
ovf:size='536870912' ovf:description='generated by virt-v2v'/>
+ </References>
+ <Section xsi:type='ovf:NetworkSection_Type'>
+ <Info>List of networks</Info>
+ <Network ovf:name='default'/>
+ </Section>
+ <Section xsi:type='ovf:DiskSection_Type'>
+ <Info>List of Virtual Disks</Info>
+ <Disk ovf:diskId='#VOL_ID#' ovf:size='1'
ovf:fileRef='#DISK_ID#/#VOL_ID#' ovf:parentRef=''
ovf:vm_snapshot_id='#UUID#' ovf:volume-format='RAW'
ovf:volume-type='Sparse'
ovf:format='http://en.wikipedia.org/wiki/Byte'
ovf:disk-interface='IDE' ovf:disk-type='System' ovf:boot='True'
ovf:actual_size='1'/>
+ </Section>
+ <Content ovf:id='out' xsi:type='ovf:VirtualSystem_Type'>
+ <Name>windows</Name>
+ <TemplateId>00000000-0000-0000-0000-000000000000</TemplateId>
+ <TemplateName>Blank</TemplateName>
+ <Description>generated by virt-v2v</Description>
+ <Domain/>
+ <CreationDate>#DATE#</CreationDate>
+ <IsInitilized>True</IsInitilized>
+ <IsAutoSuspend>False</IsAutoSuspend>
+ <TimeZone/>
+ <IsStateless>False</IsStateless>
+ <VmType>0</VmType>
+ <DefaultDisplayType>1</DefaultDisplayType>
+ <Section ovf:id='#VM_ID#' ovf:required='false'
xsi:type='ovf:OperatingSystemSection_Type'>
+ <Info>Microsoft Windows 7 Phony Edition</Info>
+ <Description>Windows7</Description>
+ </Section>
+ <Section xsi:type='ovf:VirtualHardwareSection_Type'>
+ <Info>1 CPU, 1024 Memory</Info>
+ <Item>
+ <rasd:Caption>1 virtual cpu</rasd:Caption>
+ <rasd:Description>Number of virtual CPU</rasd:Description>
+ <rasd:InstanceId>1</rasd:InstanceId>
+ <rasd:ResourceType>3</rasd:ResourceType>
+ <rasd:num_of_sockets>1</rasd:num_of_sockets>
+ <rasd:cpu_per_socket>1</rasd:cpu_per_socket>
+ </Item>
+ <Item>
+ <rasd:Caption>1024 MB of memory</rasd:Caption>
+ <rasd:Description>Memory Size</rasd:Description>
+ <rasd:InstanceId>2</rasd:InstanceId>
+ <rasd:ResourceType>4</rasd:ResourceType>
+ <rasd:AllocationUnits>MegaBytes</rasd:AllocationUnits>
+ <rasd:VirtualQuantity>1024</rasd:VirtualQuantity>
+ </Item>
+ <Item>
+ <rasd:Caption>USB Controller</rasd:Caption>
+ <rasd:InstanceId>3</rasd:InstanceId>
+ <rasd:ResourceType>23</rasd:ResourceType>
+ <rasd:UsbPolicy>Disabled</rasd:UsbPolicy>
+ </Item>
+ <Item>
+ <rasd:Caption>Graphical Controller</rasd:Caption>
+ <rasd:InstanceId>#UUID#</rasd:InstanceId>
+ <rasd:ResourceType>20</rasd:ResourceType>
+ <Type>video</Type>
+ <rasd:VirtualQuantity>1</rasd:VirtualQuantity>
+ <rasd:Device>qxl</rasd:Device>
+ </Item>
+ <Item>
+ <rasd:Caption>Drive 1</rasd:Caption>
+ <rasd:InstanceId>#VOL_ID#</rasd:InstanceId>
+ <rasd:ResourceType>17</rasd:ResourceType>
+ <Type>disk</Type>
+ <rasd:HostResource>#DISK_ID#/#VOL_ID#</rasd:HostResource>
+ <rasd:Parent>00000000-0000-0000-0000-000000000000</rasd:Parent>
+ <rasd:Template>00000000-0000-0000-0000-000000000000</rasd:Template>
+ <rasd:ApplicationList/>
+
<rasd:StorageId>12345678-1234-1234-1234-123456789abc</rasd:StorageId>
+
<rasd:StoragePoolId>00000000-0000-0000-0000-000000000000</rasd:StoragePoolId>
+ <rasd:CreationDate>#DATE#</rasd:CreationDate>
+ <rasd:LastModified>#DATE#</rasd:LastModified>
+ <rasd:last_modified_date>#DATE#</rasd:last_modified_date>
+ <BootOrder>1</BootOrder>
+ </Item>
+ <Item>
+ <rasd:InstanceId>#UUID#</rasd:InstanceId>
+ <rasd:Caption>Ethernet adapter on default</rasd:Caption>
+ <rasd:ResourceType>10</rasd:ResourceType>
+ <rasd:ResourceSubType>1</rasd:ResourceSubType>
+ <Type>interface</Type>
+ <rasd:Connection>default</rasd:Connection>
+ <rasd:Name>eth0</rasd:Name>
+ <rasd:MACAddress>00:11:22:33:44:55</rasd:MACAddress>
+ </Item>
+ </Section>
+ </Content>
+</ovf:Envelope>
diff --git a/v2v/test-v2v-o-rhv.sh b/v2v/test-v2v-o-rhv.sh
index 413e01348..d653caa1a 100755
--- a/v2v/test-v2v-o-rhv.sh
+++ b/v2v/test-v2v-o-rhv.sh
@@ -60,4 +60,25 @@ test -f $vol
popd
+# Compare resulting OVF
+VM_ID=$(basename $(ls -1d $d/12345678-1234-1234-1234-123456789abc/master/vms/*))
+DISK_ID=$(basename $(ls -1d $d/12345678-1234-1234-1234-123456789abc/images/*))
+VOL_ID=$(basename $(ls -1d
$d/12345678-1234-1234-1234-123456789abc/images/$DISK_ID/*.meta) .meta)
+OVF=$(ls -1d $d/12345678-1234-1234-1234-123456789abc/master/vms/$VM_ID/$VM_ID.ovf)
+
+RE_UUID='\<[0-9a-fA-F]\{8\}-[0-9a-fA-F]\{4\}-[0-9a-fA-F]\{4\}-[0-9a-fA-F]\{4\}-[0-9a-fA-F]\{12\}\>'
+
+# Filter variable strings
+sed -i \
+ -e "s/$DISK_ID/#DISK_ID#/g" \
+ -e "s/$VM_ID/#VM_ID#/g" \
+ -e "s/$VOL_ID/#VOL_ID#/g" \
+ -e 's/\(\<generated by virt-v2v\) [^
<'"'\""']*/\1/' \
+ -e
's/<rasd:InstanceId>'"$RE_UUID"'</<rasd:InstanceId>#UUID#</'
\
+ -e
's/<\(rasd:\)\?\(CreationDate\|LastModified\|last_modified_date\)>[^<]*</<\1\2>#DATE#</'
\
+ -e
's/\<ovf:vm_snapshot_id='"'$RE_UUID'/ovf:vm_snapshot_id='#UUID#'/g"
\
+ "$OVF"
+
+diff -u test-v2v-o-rhv.ovf.expected "$OVF"
+
rm -r $d
diff --git a/v2v/test-v2v-o-vdsm-options.ovf.expected
b/v2v/test-v2v-o-vdsm-options.ovf.expected
new file mode 100644
index 000000000..372469e21
--- /dev/null
+++ b/v2v/test-v2v-o-vdsm-options.ovf.expected
@@ -0,0 +1,92 @@
+<?xml version='1.0' encoding='utf-8'?>
+<ovf:Envelope
xmlns:rasd='http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_Res...
xmlns:vssd='http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_Vir...
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xmlns:ovf='http://schemas.dmtf.org/ovf/envelope/1/' ovf:version='0.9'>
+ <!-- generated by virt-v2v -->
+ <References>
+ <File ovf:href='IMAGE/VOL' ovf:id='VOL'
ovf:size='536870912' ovf:description='generated by virt-v2v'/>
+ </References>
+ <Section xsi:type='ovf:NetworkSection_Type'>
+ <Info>List of networks</Info>
+ <Network ovf:name='default'/>
+ </Section>
+ <Section xsi:type='ovf:DiskSection_Type'>
+ <Info>List of Virtual Disks</Info>
+ <Disk ovf:diskId='VOL' ovf:size='1'
ovf:fileRef='IMAGE/VOL' ovf:parentRef=''
ovf:vm_snapshot_id='#UUID#' ovf:volume-format='COW'
ovf:volume-type='Sparse'
ovf:format='http://en.wikipedia.org/wiki/Byte'
ovf:disk-interface='IDE' ovf:disk-type='System' ovf:boot='True'
ovf:actual_size='1'/>
+ </Section>
+ <Content ovf:id='out' xsi:type='ovf:VirtualSystem_Type'>
+ <Name>windows</Name>
+ <TemplateId>00000000-0000-0000-0000-000000000000</TemplateId>
+ <TemplateName>Blank</TemplateName>
+ <Description>generated by virt-v2v</Description>
+ <Domain/>
+ <CreationDate>#DATE#</CreationDate>
+ <IsInitilized>True</IsInitilized>
+ <IsAutoSuspend>False</IsAutoSuspend>
+ <TimeZone/>
+ <IsStateless>False</IsStateless>
+ <VmType>0</VmType>
+ <DefaultDisplayType>1</DefaultDisplayType>
+ <Section ovf:id='VM' ovf:required='false'
xsi:type='ovf:OperatingSystemSection_Type'>
+ <Info>Microsoft Windows 7 Phony Edition</Info>
+ <Description>Windows7</Description>
+ </Section>
+ <Section xsi:type='ovf:VirtualHardwareSection_Type'>
+ <Info>1 CPU, 1024 Memory</Info>
+ <Item>
+ <rasd:Caption>1 virtual cpu</rasd:Caption>
+ <rasd:Description>Number of virtual CPU</rasd:Description>
+ <rasd:InstanceId>1</rasd:InstanceId>
+ <rasd:ResourceType>3</rasd:ResourceType>
+ <rasd:num_of_sockets>1</rasd:num_of_sockets>
+ <rasd:cpu_per_socket>1</rasd:cpu_per_socket>
+ </Item>
+ <Item>
+ <rasd:Caption>1024 MB of memory</rasd:Caption>
+ <rasd:Description>Memory Size</rasd:Description>
+ <rasd:InstanceId>2</rasd:InstanceId>
+ <rasd:ResourceType>4</rasd:ResourceType>
+ <rasd:AllocationUnits>MegaBytes</rasd:AllocationUnits>
+ <rasd:VirtualQuantity>1024</rasd:VirtualQuantity>
+ </Item>
+ <Item>
+ <rasd:Caption>USB Controller</rasd:Caption>
+ <rasd:InstanceId>3</rasd:InstanceId>
+ <rasd:ResourceType>23</rasd:ResourceType>
+ <rasd:UsbPolicy>Disabled</rasd:UsbPolicy>
+ </Item>
+ <Item>
+ <rasd:Caption>Graphical Controller</rasd:Caption>
+ <rasd:InstanceId>#UUID#</rasd:InstanceId>
+ <rasd:ResourceType>20</rasd:ResourceType>
+ <Type>video</Type>
+ <rasd:VirtualQuantity>1</rasd:VirtualQuantity>
+ <rasd:Device>qxl</rasd:Device>
+ </Item>
+ <Item>
+ <rasd:Caption>Drive 1</rasd:Caption>
+ <rasd:InstanceId>VOL</rasd:InstanceId>
+ <rasd:ResourceType>17</rasd:ResourceType>
+ <Type>disk</Type>
+ <rasd:HostResource>IMAGE/VOL</rasd:HostResource>
+ <rasd:Parent>00000000-0000-0000-0000-000000000000</rasd:Parent>
+ <rasd:Template>00000000-0000-0000-0000-000000000000</rasd:Template>
+ <rasd:ApplicationList/>
+
<rasd:StorageId>12345678-1234-1234-1234-123456789abc</rasd:StorageId>
+
<rasd:StoragePoolId>00000000-0000-0000-0000-000000000000</rasd:StoragePoolId>
+ <rasd:CreationDate>#DATE#</rasd:CreationDate>
+ <rasd:LastModified>#DATE#</rasd:LastModified>
+ <rasd:last_modified_date>#DATE#</rasd:last_modified_date>
+ <BootOrder>1</BootOrder>
+ </Item>
+ <Item>
+ <rasd:InstanceId>#UUID#</rasd:InstanceId>
+ <rasd:Caption>Ethernet adapter on default</rasd:Caption>
+ <rasd:ResourceType>10</rasd:ResourceType>
+ <rasd:ResourceSubType>1</rasd:ResourceSubType>
+ <Type>interface</Type>
+ <rasd:Connection>default</rasd:Connection>
+ <rasd:Name>eth0</rasd:Name>
+ <rasd:MACAddress>00:11:22:33:44:55</rasd:MACAddress>
+ </Item>
+ </Section>
+ </Content>
+</ovf:Envelope>
diff --git a/v2v/test-v2v-o-vdsm-options.sh b/v2v/test-v2v-o-vdsm-options.sh
index 1da252f17..44ad79a36 100755
--- a/v2v/test-v2v-o-vdsm-options.sh
+++ b/v2v/test-v2v-o-vdsm-options.sh
@@ -73,4 +73,21 @@ qemu-img info VOL | grep 'compat: 1.1'
popd
+# Compare resulting OVF
+OVF="$d/12345678-1234-1234-1234-123456789abc/master/vms/VM/VM.ovf"
+
+RE_UUID='\<[0-9a-fA-F]\{8\}-[0-9a-fA-F]\{4\}-[0-9a-fA-F]\{4\}-[0-9a-fA-F]\{4\}-[0-9a-fA-F]\{12\}\>'
+
+# Filter variable strings
+sed -i \
+ -e 's/\(\<generated by virt-v2v\) [^
<'"'\""']*/\1/' \
+ -e
's/<rasd:InstanceId>'"$RE_UUID"'</<rasd:InstanceId>#UUID#</'
\
+ -e
's/<\(rasd:\)\?\(CreationDate\|LastModified\|last_modified_date\)>[^<]*</<\1\2>#DATE#</'
\
+ -e
's/\<ovf:vm_snapshot_id='"'$RE_UUID'/ovf:vm_snapshot_id='#UUID#'/g"
\
+ "$OVF"
+
+
+diff -u test-v2v-o-vdsm-options.ovf.expected \
+ "$OVF"
+
rm -r $d
--
2.16.1