[virt-tools-list] [PATCH 2/2 V2] test: Add a test for converting ovf+compressed files.
Lin Ma
lma at suse.com
Fri Mar 4 07:58:57 UTC 2016
Signed-off-by: Lin Ma <lma at suse.com>
---
I'm not familiar with how to write a test, If there is anything wrong,
Please forgive me and let me know.
.../ovf2libvirt_gzip_ovf_directory.libvirt | 79 ++++++++++++++
.../ovf_input/ovf_directory/test_gzip.ovf | 121 +++++++++++++++++++++
.../ovf_directory/test_gzip.ovf-disk1.vmdk.gz | Bin 0 -> 114 bytes
3 files changed, 200 insertions(+)
create mode 100644 tests/virtconv-files/libvirt_output/ovf2libvirt_gzip_ovf_directory.libvirt
create mode 100644 tests/virtconv-files/ovf_input/ovf_directory/test_gzip.ovf
create mode 100644 tests/virtconv-files/ovf_input/ovf_directory/test_gzip.ovf-disk1.vmdk.gz
diff --git a/tests/virtconv-files/libvirt_output/ovf2libvirt_gzip_ovf_directory.libvirt b/tests/virtconv-files/libvirt_output/ovf2libvirt_gzip_ovf_directory.libvirt
new file mode 100644
index 0000000..b74f415
--- /dev/null
+++ b/tests/virtconv-files/libvirt_output/ovf2libvirt_gzip_ovf_directory.libvirt
@@ -0,0 +1,79 @@
+<domain type='kvm'>
+ <name>test_gzip.ovf</name>
+ <uuid>00000000-1111-2222-3333-444444444444</uuid>
+ <memory unit='KiB'>4194304</memory>
+ <currentMemory unit='KiB'>4194304</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <resource>
+ <partition>/machine</partition>
+ </resource>
+ <os>
+ <type arch='x86_64'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <features>
+ <acpi/>
+ <apic/>
+ <vmport state='off'/>
+ </features>
+ <cpu mode='custom' match='exact'>
+ <model fallback='allow'>Haswell-noTSX</model>
+ </cpu>
+ <clock offset='utc'>
+ <timer name='rtc' tickpolicy='catchup'/>
+ <timer name='pit' tickpolicy='delay'/>
+ <timer name='hpet' present='no'/>
+ </clock>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>restart</on_crash>
+ <pm>
+ <suspend-to-mem enabled='no'/>
+ <suspend-to-disk enabled='no'/>
+ </pm>
+ <devices>
+ <emulator>/usr/bin/qemu-kvm</emulator>
+ <disk type='file' device='disk'>
+ <driver name='qemu' type='raw'/>
+ <source file='/var/lib/libvirt/images/test_gzip.ovf-disk1.vmdk.raw'/>
+ <backingStore/>
+ <target dev='sda' bus='scsi'/>
+ <alias name='scsi0-0-0'/>
+ </disk>
+ <controller type="usb" index="0" model="ich9-ehci1"/>
+ <controller type="usb" index="0" model="ich9-uhci1">
+ <master startport="0"/>
+ </controller>
+ <controller type="usb" index="0" model="ich9-uhci2">
+ <master startport="2"/>
+ </controller>
+ <controller type="usb" index="0" model="ich9-uhci3">
+ <master startport="4"/>
+ </controller>
+ <controller type='scsi' index='0'>
+ <alias name='scsi0'/>
+ </controller>
+ <interface type='network'>
+ <mac address='52:54:00:a9:14:45'/>
+ <source network='default' bridge='virbr0'/>
+ <model type='e1000'/>
+ </interface>
+ <input type="mouse" bus="ps2"/>
+ <graphics type="spice" port="-1" tlsPort="-1" autoport="yes">
+ <image compression="off"/>
+ </graphics>
+ <console type="pty"/>
+ <channel type="spicevmc">
+ <target type="virtio" name="com.redhat.spice.0"/>
+ </channel>
+ <sound model="ich6"/>
+ <video>
+ <model type="qxl"/>
+ </video>
+ <redirdev bus='usb' type='spicevmc/'>
+ <redirdev bus='usb' type='spicevmc'/>
+ </devices>
+</domain>
+
+
+Copying test_gzip.ovf-disk1.vmdk to /var/lib/libvirt/images/test_gzip.ovf-disk1.vmdk.raw
diff --git a/tests/virtconv-files/ovf_input/ovf_directory/test_gzip.ovf b/tests/virtconv-files/ovf_input/ovf_directory/test_gzip.ovf
new file mode 100644
index 0000000..a6fdfff
--- /dev/null
+++ b/tests/virtconv-files/ovf_input/ovf_directory/test_gzip.ovf
@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--Generated by VMware ovftool 3.0.1 (build-801290), UTC time: 2015-04-24T07:28:57.485693Z-->
+<Envelope vmw:buildId="build-801290" xmlns="http://schemas.dmtf.org/ovf/envelope/1" xmlns:cim="http://schemas.dmtf.org/wbem/wscim/1/common" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" xmlns:rasd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData" xmlns:vmw="http://www.vmware.com/schema/ovf" xmlns:vssd="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <References>
+ <File ovf:compression="gzip" ovf:href="test_gzip.ovf-disk1.vmdk.gz" ovf:id="file1" ovf:size="848847459"/>
+ </References>
+ <DiskSection>
+ <Info>Virtual disk information</Info>
+ <Disk ovf:capacity="20" ovf:capacityAllocationUnits="byte * 2^30" ovf:diskId="vmdisk1" ovf:fileRef="file1" ovf:format="http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized" ovf:populatedSize="1587937280"/>
+ </DiskSection>
+ <NetworkSection>
+ <Info>The list of logical networks</Info>
+ <Network ovf:name="bridged">
+ <Description>The bridged network</Description>
+ </Network>
+ </NetworkSection>
+ <VirtualSystem ovf:id="vm">
+ <Info>A virtual machine</Info>
+ <Name>test_gzip.ovf</Name>
+ <OperatingSystemSection ovf:id="85" ovf:version="11" vmw:osType="sles11_64Guest">
+ <Info>The kind of installed guest operating system</Info>
+ </OperatingSystemSection>
+ <VirtualHardwareSection>
+ <Info>Virtual hardware requirements</Info>
+ <System>
+ <vssd:ElementName>Virtual Hardware Family</vssd:ElementName>
+ <vssd:InstanceID>0</vssd:InstanceID>
+ <vssd:VirtualSystemIdentifier>test_gzip.ovf</vssd:VirtualSystemIdentifier>
+ <vssd:VirtualSystemType>vmx-04</vssd:VirtualSystemType>
+ </System>
+ <Item>
+ <rasd:AllocationUnits>hertz * 10^6</rasd:AllocationUnits>
+ <rasd:Description>Number of Virtual CPUs</rasd:Description>
+ <rasd:ElementName>1 virtual CPU(s)</rasd:ElementName>
+ <rasd:InstanceID>1</rasd:InstanceID>
+ <rasd:ResourceType>3</rasd:ResourceType>
+ <rasd:VirtualQuantity>1</rasd:VirtualQuantity>
+ </Item>
+ <Item>
+ <rasd:AllocationUnits>byte * 2^20</rasd:AllocationUnits>
+ <rasd:Description>Memory Size</rasd:Description>
+ <rasd:ElementName>4096MB of memory</rasd:ElementName>
+ <rasd:InstanceID>2</rasd:InstanceID>
+ <rasd:ResourceType>4</rasd:ResourceType>
+ <rasd:VirtualQuantity>4096</rasd:VirtualQuantity>
+ </Item>
+ <Item ovf:required="false">
+ <rasd:Address>0</rasd:Address>
+ <rasd:Description>USB Controller (EHCI)</rasd:Description>
+ <rasd:ElementName>usb</rasd:ElementName>
+ <rasd:InstanceID>3</rasd:InstanceID>
+ <rasd:ResourceSubType>vmware.usb.ehci</rasd:ResourceSubType>
+ <rasd:ResourceType>23</rasd:ResourceType>
+ <vmw:Config ovf:required="false" vmw:key="ehciEnabled" vmw:value="false"/>
+ </Item>
+ <Item>
+ <rasd:Address>0</rasd:Address>
+ <rasd:Description>SCSI Controller</rasd:Description>
+ <rasd:ElementName>scsiController0</rasd:ElementName>
+ <rasd:InstanceID>4</rasd:InstanceID>
+ <rasd:ResourceSubType>lsilogic</rasd:ResourceSubType>
+ <rasd:ResourceType>6</rasd:ResourceType>
+ </Item>
+ <Item>
+ <rasd:Address>0</rasd:Address>
+ <rasd:Description>IDE Controller</rasd:Description>
+ <rasd:ElementName>ideController0</rasd:ElementName>
+ <rasd:InstanceID>5</rasd:InstanceID>
+ <rasd:ResourceType>5</rasd:ResourceType>
+ </Item>
+ <Item ovf:required="false">
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
+ <rasd:Description>Floppy Drive</rasd:Description>
+ <rasd:ElementName>floppy0</rasd:ElementName>
+ <rasd:InstanceID>6</rasd:InstanceID>
+ <rasd:ResourceType>14</rasd:ResourceType>
+ </Item>
+ <Item ovf:required="false">
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
+ <rasd:ElementName>cdrom1</rasd:ElementName>
+ <rasd:InstanceID>7</rasd:InstanceID>
+ <rasd:Parent>5</rasd:Parent>
+ <rasd:ResourceType>15</rasd:ResourceType>
+ </Item>
+ <Item>
+ <rasd:AddressOnParent>0</rasd:AddressOnParent>
+ <rasd:ElementName>disk1</rasd:ElementName>
+ <rasd:HostResource>ovf:/disk/vmdisk1</rasd:HostResource>
+ <rasd:InstanceID>8</rasd:InstanceID>
+ <rasd:Parent>4</rasd:Parent>
+ <rasd:ResourceType>17</rasd:ResourceType>
+ </Item>
+ <Item>
+ <rasd:AddressOnParent>2</rasd:AddressOnParent>
+ <rasd:AutomaticAllocation>true</rasd:AutomaticAllocation>
+ <rasd:Connection>bridged</rasd:Connection>
+ <rasd:Description>E1000 ethernet adapter on "bridged"</rasd:Description>
+ <rasd:ElementName>ethernet0</rasd:ElementName>
+ <rasd:InstanceID>9</rasd:InstanceID>
+ <rasd:ResourceSubType>E1000</rasd:ResourceSubType>
+ <rasd:ResourceType>10</rasd:ResourceType>
+ </Item>
+ <Item ovf:required="false">
+ <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
+ <rasd:ElementName>video</rasd:ElementName>
+ <rasd:InstanceID>10</rasd:InstanceID>
+ <rasd:ResourceType>24</rasd:ResourceType>
+ </Item>
+ <Item ovf:required="false">
+ <rasd:AutomaticAllocation>false</rasd:AutomaticAllocation>
+ <rasd:ElementName>vmci</rasd:ElementName>
+ <rasd:InstanceID>11</rasd:InstanceID>
+ <rasd:ResourceSubType>vmware.vmci</rasd:ResourceSubType>
+ <rasd:ResourceType>1</rasd:ResourceType>
+ </Item>
+ <vmw:Config ovf:required="false" vmw:key="tools.syncTimeWithHost" vmw:value="true"/>
+ </VirtualHardwareSection>
+ </VirtualSystem>
+</Envelope>
diff --git a/tests/virtconv-files/ovf_input/ovf_directory/test_gzip.ovf-disk1.vmdk.gz b/tests/virtconv-files/ovf_input/ovf_directory/test_gzip.ovf-disk1.vmdk.gz
new file mode 100644
index 0000000000000000000000000000000000000000..21f1dbd7fd81a14ec15de54ab0034bb2ad6ac3e6
GIT binary patch
literal 114
zcmb2|=HO72z8S{CT#{N`5}#g`S)i9+mZqDMS)6UCSC*TS&G7buAtM6=!=VLV{d0Nw
eI~)=ZG%zx=@kkgX5YO1d&-12BwTr=kfdK%~iy$We
literal 0
HcmV?d00001
--
2.6.3
More information about the virt-tools-list
mailing list