* tests/.gitignore: ignore new test binaries * tests/Makefile.am: add new tests * tests/esxutilstest.c: test esxVMX_IndexToDiskName() * tests/vmx2xmldata/*: config files for the VMX to domain XML test * tests/vmx2xmltest.c: test the VMX to domain XML mapping * tests/xml2vmxdata/*: config files for the domain XML to VMX test * tests/xml2vmxtest.c: test the domain XML to VMX mapping
diff --git a/tests/.gitignore b/tests/.gitignore index 466ec13..6d67c2a 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -27,3 +27,6 @@ object-locking object-locking.cmi object-locking.cmx object-locking-files.txt +esxutilstest +vmx2xmltest +xml2vmxtest diff --git a/tests/Makefile.am b/tests/Makefile.am index 74e98d1..8df2ea0 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -73,6 +73,10 @@ if WITH_QEMU noinst_PROGRAMS += qemuxml2argvtest qemuxml2xmltest qemuargv2xmltest qemuhelptest endif +if WITH_ESX +noinst_PROGRAMS += esxutilstest vmx2xmltest xml2vmxtest +endif + if WITH_SECDRIVER_SELINUX noinst_PROGRAMS += seclabeltest endif @@ -134,6 +138,10 @@ if WITH_QEMU TESTS += qemuxml2argvtest qemuxml2xmltest qemuargv2xmltest qemuhelptest endif +if WITH_ESX +TESTS += esxutilstest vmx2xmltest xml2vmxtest +endif + if WITH_SECDRIVER_SELINUX TESTS += seclabeltest endif @@ -220,6 +228,25 @@ else EXTRA_DIST += qemuxml2argvtest.c qemuxml2xmltest.c qemuargv2xmltest.c qemuhelptest.c testutilsqemu.c testutilsqemu.h endif +if WITH_ESX +esxutilstest_SOURCES = \ + esxutilstest.c \ + testutils.c testutils.h +esxutilstest_LDADD = ../src/libvirt_driver_esx.la $(LDADDS) + +vmx2xmltest_SOURCES = \ + vmx2xmltest.c \ + testutils.c testutils.h +vmx2xmltest_LDADD = ../src/libvirt_driver_esx.la $(LDADDS) + +xml2vmxtest_SOURCES = \ + xml2vmxtest.c \ + testutils.c testutils.h +xml2vmxtest_LDADD = ../src/libvirt_driver_esx.la $(LDADDS) +else +EXTRA_DIST += esxutilstest.c vmx2xmltest.c xml2vmxtest.c +endif + nodedevxml2xmltest_SOURCES = \ nodedevxml2xmltest.c \ testutils.c testutils.h diff --git a/tests/esxutilstest.c b/tests/esxutilstest.c new file mode 100644 index 0000000..7eca1be --- /dev/null +++ b/tests/esxutilstest.c @@ -0,0 +1,99 @@ +#include <config.h> + +#ifdef WITH_ESX + +#include <stdio.h> +#include <string.h> +#include <unistd.h> + +#include "internal.h" +#include "memory.h" +#include "testutils.h" +#include "esx/esx_vmx.h" + +static char *progname; + +struct testInfo { + const char *input; + const char *output; + esxVI_APIVersion version; +}; + +static const char* names[] = { + "sda", "sdb", "sdc", "sdd", "sde", "sdf", "sdg", "sdh", "sdi", "sdj", "sdk", "sdl", "sdm", "sdn", "sdo", "sdp", "sdq", "sdr", "sds", "sdt", "sdu", "sdv", "sdw", "sdx", "sdy", "sdz", + "sdaa", "sdab", "sdac", "sdad", "sdae", "sdaf", "sdag", "sdah", "sdai", "sdaj", "sdak", "sdal", "sdam", "sdan", "sdao", "sdap", "sdaq", "sdar", "sdas", "sdat", "sdau", "sdav", "sdaw", "sdax", "sday", "sdaz", + "sdba", "sdbb", "sdbc", "sdbd", "sdbe", "sdbf", "sdbg", "sdbh", "sdbi", "sdbj", "sdbk", "sdbl", "sdbm", "sdbn", "sdbo", "sdbp", "sdbq", "sdbr", "sdbs", "sdbt", "sdbu", "sdbv", "sdbw", "sdbx", "sdby", "sdbz", + "sdca", "sdcb", "sdcc", "sdcd", "sdce", "sdcf", "sdcg", "sdch", "sdci", "sdcj", "sdck", "sdcl", "sdcm", "sdcn", "sdco", "sdcp", "sdcq", "sdcr", "sdcs", "sdct", "sdcu", "sdcv", "sdcw", "sdcx", "sdcy", "sdcz", + "sdda", "sddb", "sddc", "sddd", "sdde", "sddf", "sddg", "sddh", "sddi", "sddj", "sddk", "sddl", "sddm", "sddn", "sddo", "sddp", "sddq", "sddr", "sdds", "sddt", "sddu", "sddv", "sddw", "sddx", "sddy", "sddz", + "sdea", "sdeb", "sdec", "sded", "sdee", "sdef", "sdeg", "sdeh", "sdei", "sdej", "sdek", "sdel", "sdem", "sden", "sdeo", "sdep", "sdeq", "sder", "sdes", "sdet", "sdeu", "sdev", "sdew", "sdex", "sdey", "sdez", + "sdfa", "sdfb", "sdfc", "sdfd", "sdfe", "sdff", "sdfg", "sdfh", "sdfi", "sdfj", "sdfk", "sdfl", "sdfm", "sdfn", "sdfo", "sdfp", "sdfq", "sdfr", "sdfs", "sdft", "sdfu", "sdfv", "sdfw", "sdfx", "sdfy", "sdfz", + "sdga", "sdgb", "sdgc", "sdgd", "sdge", "sdgf", "sdgg", "sdgh", "sdgi", "sdgj", "sdgk", "sdgl", "sdgm", "sdgn", "sdgo", "sdgp", "sdgq", "sdgr", "sdgs", "sdgt", "sdgu", "sdgv", "sdgw", "sdgx", "sdgy", "sdgz", + "sdha", "sdhb", "sdhc", "sdhd", "sdhe", "sdhf", "sdhg", "sdhh", "sdhi", "sdhj", "sdhk", "sdhl", "sdhm", "sdhn", "sdho", "sdhp", "sdhq", "sdhr", "sdhs", "sdht", "sdhu", "sdhv", "sdhw", "sdhx", "sdhy", "sdhz", + "sdia", "sdib", "sdic", "sdid", "sdie", "sdif", "sdig", "sdih", "sdii", "sdij", "sdik", "sdil", "sdim", "sdin", "sdio", "sdip", "sdiq", "sdir", "sdis", "sdit", "sdiu", "sdiv", "sdiw", "sdix", "sdiy", "sdiz" +}; + +static int +testIndexToDiskName(const void *data ATTRIBUTE_UNUSED) +{ + int i; + char *name = NULL; + + for (i = 0; i < ARRAY_CARDINALITY(names); ++i) { + VIR_FREE(name); + + name = esxVMX_IndexToDiskName(NULL, i, "sd"); + + if (STRNEQ(names[i], name)) { + virtTestDifference(stderr, names[i], name); + VIR_FREE(name); + + return -1; + } + + if (virDiskNameToIndex(name) != i) { + VIR_FREE(name); + + return -1; + } + } + + VIR_FREE(name); + + return 0; +} + +static int +mymain(int argc, char **argv) +{ + int result = 0; + + progname = argv[0]; + + if (argc > 1) { + fprintf(stderr, "Usage: %s\n", progname); + return EXIT_FAILURE; + } + + if (argc > 1) { + fprintf(stderr, "Usage: %s\n", progname); + return EXIT_FAILURE; + } + + if (virtTestRun("VMware IndexToDiskName", 1, testIndexToDiskName, + NULL) < 0) { + result = -1; + } + + return result == 0 ? EXIT_SUCCESS : EXIT_FAILURE; +} + +VIRT_TEST_MAIN(mymain) + +#else + +int main (void) +{ + return 77; /* means 'test skipped' for automake */ +} + +#endif /* WITH_ESX */ diff --git a/tests/vmx2xmldata/vmx2xml-cdrom-ide-device.vmx b/tests/vmx2xmldata/vmx2xml-cdrom-ide-device.vmx new file mode 100644 index 0000000..dc789d2 --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-cdrom-ide-device.vmx @@ -0,0 +1,6 @@ +config.version = "8" +virtualHW.version = "4" +guestOS = "other" +ide0:0.present = "true" +ide0:0.deviceType = "atapi-cdrom" +ide0:0.fileName = "/dev/scd0" diff --git a/tests/vmx2xmldata/vmx2xml-cdrom-ide-device.xml b/tests/vmx2xmldata/vmx2xml-cdrom-ide-device.xml new file mode 100644 index 0000000..12c431e --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-cdrom-ide-device.xml @@ -0,0 +1,19 @@ +<domain type='vmware'> + <uuid>00000000-0000-0000-0000-000000000000</uuid> + <memory>32768</memory> + <currentMemory>32768</currentMemory> + <vcpu>1</vcpu> + <os> + <type arch='i686'>hvm</type> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <disk type='block' device='cdrom'> + <source dev='/dev/scd0'/> + <target dev='hda' bus='ide'/> + </disk> + </devices> +</domain> diff --git a/tests/vmx2xmldata/vmx2xml-cdrom-ide-file.vmx b/tests/vmx2xmldata/vmx2xml-cdrom-ide-file.vmx new file mode 100644 index 0000000..edd3999 --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-cdrom-ide-file.vmx @@ -0,0 +1,5 @@ +config.version = "8" +virtualHW.version = "4" +ide0:0.present = "true" +ide0:0.deviceType = "cdrom-image" +ide0:0.fileName = "cdrom.iso" diff --git a/tests/vmx2xmldata/vmx2xml-cdrom-ide-file.xml b/tests/vmx2xmldata/vmx2xml-cdrom-ide-file.xml new file mode 100644 index 0000000..3745148 --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-cdrom-ide-file.xml @@ -0,0 +1,19 @@ +<domain type='vmware'> + <uuid>00000000-0000-0000-0000-000000000000</uuid> + <memory>32768</memory> + <currentMemory>32768</currentMemory> + <vcpu>1</vcpu> + <os> + <type arch='i686'>hvm</type> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <disk type='file' device='cdrom'> + <source file='cdrom.iso'/> + <target dev='hda' bus='ide'/> + </disk> + </devices> +</domain> diff --git a/tests/vmx2xmldata/vmx2xml-cdrom-scsi-device.vmx b/tests/vmx2xmldata/vmx2xml-cdrom-scsi-device.vmx new file mode 100644 index 0000000..721068a --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-cdrom-scsi-device.vmx @@ -0,0 +1,6 @@ +config.version = "8" +virtualHW.version = "4" +scsi0.present = "true" +scsi0:0.present = "true" +scsi0:0.deviceType = "atapi-cdrom" +scsi0:0.fileName = "/dev/scd0" diff --git a/tests/vmx2xmldata/vmx2xml-cdrom-scsi-device.xml b/tests/vmx2xmldata/vmx2xml-cdrom-scsi-device.xml new file mode 100644 index 0000000..55ea5e2 --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-cdrom-scsi-device.xml @@ -0,0 +1,19 @@ +<domain type='vmware'> + <uuid>00000000-0000-0000-0000-000000000000</uuid> + <memory>32768</memory> + <currentMemory>32768</currentMemory> + <vcpu>1</vcpu> + <os> + <type arch='i686'>hvm</type> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <disk type='block' device='cdrom'> + <source dev='/dev/scd0'/> + <target dev='sda' bus='scsi'/> + </disk> + </devices> +</domain> diff --git a/tests/vmx2xmldata/vmx2xml-cdrom-scsi-file.vmx b/tests/vmx2xmldata/vmx2xml-cdrom-scsi-file.vmx new file mode 100644 index 0000000..3422e0b --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-cdrom-scsi-file.vmx @@ -0,0 +1,6 @@ +config.version = "8" +virtualHW.version = "4" +scsi0.present = "true" +scsi0:0.present = "true" +scsi0:0.deviceType = "cdrom-image" +scsi0:0.fileName = "cdrom.iso" diff --git a/tests/vmx2xmldata/vmx2xml-cdrom-scsi-file.xml b/tests/vmx2xmldata/vmx2xml-cdrom-scsi-file.xml new file mode 100644 index 0000000..2d37bde --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-cdrom-scsi-file.xml @@ -0,0 +1,19 @@ +<domain type='vmware'> + <uuid>00000000-0000-0000-0000-000000000000</uuid> + <memory>32768</memory> + <currentMemory>32768</currentMemory> + <vcpu>1</vcpu> + <os> + <type arch='i686'>hvm</type> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <disk type='file' device='cdrom'> + <source file='cdrom.iso'/> + <target dev='sda' bus='scsi'/> + </disk> + </devices> +</domain> diff --git a/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-1.vmx b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-1.vmx new file mode 100644 index 0000000..4392062 --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-1.vmx @@ -0,0 +1,52 @@ +#!/usr/bin/vmware +config.version = "8" +virtualHW.version = "4" +floppy0.present = "false" +nvram = "Fedora11.nvram" +deploymentPlatform = "windows" +virtualHW.productCompatibility = "hosted" +tools.upgrade.policy = "useGlobal" +powerType.powerOff = "default" +powerType.powerOn = "default" +powerType.suspend = "default" +powerType.reset = "default" + +displayName = "Fedora11" +extendedConfigFile = "Fedora11.vmxf" + +scsi0.present = "true" +scsi0.sharedBus = "none" +scsi0.virtualDev = "lsilogic" +memsize = "1024" +scsi0:0.present = "true" +scsi0:0.fileName = "Fedora11.vmdk" +scsi0:0.deviceType = "scsi-hardDisk" +ide0:0.present = "true" +ide0:0.clientDevice = "true" +ide0:0.deviceType = "cdrom-raw" +ide0:0.startConnected = "false" +ethernet0.present = "true" +ethernet0.networkName = "VM Network" +ethernet0.addressType = "vpx" +ethernet0.generatedAddress = "00:50:56:91:48:c7" +chipset.onlineStandby = "false" +guestOSAltName = "Red Hat Enterprise Linux 5 (32-Bit)" +guestOS = "rhel5" +uuid.bios = "50 11 5e 16 9b dc 49 d7-f1 71 53 c4 d7 f9 17 10" +snapshot.action = "keep" +sched.cpu.min = "0" +sched.cpu.units = "mhz" +sched.cpu.shares = "normal" +sched.mem.minsize = "0" +sched.mem.shares = "normal" +toolScripts.afterPowerOn = "true" +toolScripts.afterResume = "true" +toolScripts.beforeSuspend = "true" +toolScripts.beforePowerOff = "true" + +scsi0:0.redo = "" +tools.syncTime = "FALSE" +uuid.location = "56 4d b5 06 a2 bd fb eb-ae 86 f7 d8 49 27 d0 c4" +sched.cpu.max = "unlimited" +sched.swap.derivedName = "/vmfs/volumes/498076b2-02796c1a-ef5b-000ae484a6a3/Fedora11/Fedora11-7de040d8.vswp" +tools.remindInstall = "TRUE" diff --git a/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-1.xml b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-1.xml new file mode 100644 index 0000000..8a00474 --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-1.xml @@ -0,0 +1,25 @@ +<domain type='vmware'> + <name>Fedora11</name> + <uuid>50115e16-9bdc-49d7-f171-53c4d7f91710</uuid> + <memory>1048576</memory> + <currentMemory>1048576</currentMemory> + <vcpu>1</vcpu> + <os> + <type arch='i686'>hvm</type> + </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'> + <driver name='lsilogic'/> + <source file='Fedora11.vmdk'/> + <target dev='sda' bus='scsi'/> + </disk> + <interface type='bridge'> + <mac address='00:50:56:91:48:c7'/> + <source bridge='VM Network'/> + </interface> + </devices> +</domain> diff --git a/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-2.vmx b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-2.vmx new file mode 100644 index 0000000..19e7afc --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-2.vmx @@ -0,0 +1,99 @@ +#!/usr/bin/vmware +config.version = "8" +virtualHW.version = "4" +nvram = "Debian1.nvram" +deploymentPlatform = "windows" +virtualHW.productCompatibility = "hosted" +tools.upgrade.policy = "useGlobal" +powerType.powerOff = "default" +powerType.powerOn = "default" +powerType.suspend = "default" +powerType.reset = "default" + +displayName = "virtDebian1" +extendedConfigFile = "Debian1.vmxf" + +memsize = "1000" + +scsi0.present = "true" +scsi0.virtualDev = "lsilogic" +scsi0.sharedBus = "none" + +scsi1.present = "true" +scsi1.virtualDev = "buslogic" + +scsi0:0.redo = "" +scsi0:0.present = "true" +scsi0:0.fileName = "Debian1.vmdk" +scsi0:0.deviceType = "scsi-hardDisk" +scsi0:0.writeThrough = "true" + +scsi1:0.present = "true" +scsi1:0.fileName = "Debian1-cdrom.iso" +scsi1:0.deviceType = "cdrom-image" + +ide0:0.present = "true" +ide0:0.startConnected = "FALSE" +ide0:0.clientDevice = "FALSE" +ide0:0.deviceType = "cdrom-image" +ide0:0.fileName = "/vmimages/tools-isoimages/linux.iso" + +ide0:1.present = "true" +ide0:1.clientDevice = "FALSE" +ide0:1.deviceType = "atapi-cdrom" +ide0:1.startConnected = "true" +ide0:1.fileName = "/dev/scd0" + +ide1:1.present = "true" +ide1:1.startConnected = "true" +ide1:1.deviceType = "ata-hardDisk" +ide1:1.fileName = "Debian1-IDE.vmdk" + +floppy1.present = "true" +floppy1.startConnected = "false" +floppy1.clientDevice = "true" +floppy1.fileName = "/dev/fd0" + +floppy0.present = "true" +floppy0.startConnected = "false" +floppy0.clientDevice = "false" +floppy0.fileType = "device" +floppy0.fileName = "/dev/fd0" + +ethernet0.present = "true" +ethernet0.virtualDev = "vlance" +ethernet0.networkName = "VM Network" +ethernet0.addressType = "generated" +ethernet0.generatedAddress = "00:0c:29:3c:98:3e" +ethernet0.generatedAddressOffset = "0" + +guestOSAltName = "Ubuntu Linux (64-bit)" +guestOS = "ubuntu-64" + +uuid.location = "56 4d cd 37 36 85 88 89-35 ea 71 9f c9 3c 98 3e" +uuid.bios = "56 4d cd 37 36 85 88 89-35 ea 71 9f c9 3c 98 3e" + +toolScripts.afterPowerOn = "true" +toolScripts.afterResume = "true" +toolScripts.beforeSuspend = "true" +toolScripts.beforePowerOff = "true" + + + +sched.swap.derivedName = "/vmfs/volumes/498076b2-02796c1a-ef5b-000ae484a6a3/Debian1/Debian1-04db0c59.vswp" + +tools.syncTime = "FALSE" +tools.remindInstall = "TRUE" + +checkpoint.vmState = "" + +numvcpus = "4" + +sched.cpu.max = "1104" +sched.cpu.units = "mhz" + +sched.cpu.min = "368" + +sched.cpu.affinity = "0,1,2,5,6,7" + +sched.mem.max = "118" diff --git a/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-2.xml b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-2.xml new file mode 100644 index 0000000..62e8bb4 --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-2.xml @@ -0,0 +1,47 @@ +<domain type='vmware'> + <name>virtDebian1</name> + <uuid>564dcd37-3685-8889-35ea-719fc93c983e</uuid> + <memory>1024000</memory> + <currentMemory>120832</currentMemory> + <vcpu cpuset='0-2,5-7'>4</vcpu> + <os> + <type arch='x86_64'>hvm</type> + </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'> + <driver name='lsilogic' cache='writethrough'/> + <source file='Debian1.vmdk'/> + <target dev='sda' bus='scsi'/> + </disk> + <disk type='file' device='cdrom'> + <driver name='buslogic'/> + <source file='Debian1-cdrom.iso'/> + <target dev='sdp' bus='scsi'/> + </disk> + <disk type='file' device='cdrom'> + <source file='/vmimages/tools-isoimages/linux.iso'/> + <target dev='hda' bus='ide'/> + </disk> + <disk type='block' device='cdrom'> + <source dev='/dev/scd0'/> + <target dev='hdb' bus='ide'/> + </disk> + <disk type='file' device='disk'> + <source file='Debian1-IDE.vmdk'/> + <target dev='hdd' bus='ide'/> + </disk> + <disk type='block' device='floppy'> + <source dev='/dev/fd0'/> + <target dev='fda' bus='fdc'/> + </disk> + <interface type='bridge'> + <mac address='00:0c:29:3c:98:3e'/> + <source bridge='VM Network'/> + <model type='vlance'/> + </interface> + </devices> +</domain> diff --git a/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-3.vmx b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-3.vmx new file mode 100644 index 0000000..8727950 --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-3.vmx @@ -0,0 +1,70 @@ +#!/usr/bin/vmware +config.version = "8" +virtualHW.version = "4" +floppy0.present = "true" +nvram = "Debian2.nvram" +deploymentPlatform = "windows" +virtualHW.productCompatibility = "hosted" +tools.upgrade.policy = "useGlobal" +powerType.powerOff = "default" +powerType.powerOn = "default" +powerType.suspend = "default" +powerType.reset = "default" + +displayName = "virtDebian2" +extendedConfigFile = "Debian2.vmxf" + +numvcpus = "2" +scsi0.present = "true" +scsi0.sharedBus = "none" +scsi0.virtualDev = "lsilogic" + +memsize = "1024" + +scsi0:0.present = "true" +scsi0:0.fileName = "Debian2.vmdk" +scsi0:0.deviceType = "scsi-hardDisk" + +ide0:0.present = "true" +ide0:0.clientDevice = "FALSE" +ide0:0.deviceType = "cdrom-image" +ide0:0.startConnected = "true" + +floppy0.startConnected = "false" +floppy0.clientDevice = "true" + +ethernet0.present = "true" +ethernet0.networkName = "VM Network" +ethernet0.addressType = "generated" + +guestOSAltName = "Ubuntu Linux (64-bit)" +guestOS = "ubuntu-64" + +uuid.location = "56 4d b7 68 f3 32 42 ee-62 01 06 97 3c f5 c3 0c" +uuid.bios = "56 4d b7 68 f3 32 42 ee-62 01 06 97 3c f5 c3 0c" + +toolScripts.afterPowerOn = "true" +toolScripts.afterResume = "true" +toolScripts.beforeSuspend = "true" +toolScripts.beforePowerOff = "true" + +floppy0.fileName = "/dev/fd0" + +ide0:0.fileName = "/vmfs/volumes/498076b2-02796c1a-ef5b-000ae484a6a3/Isos/debian-testing-amd64-netinst.iso" + +scsi0:0.redo = "" +ethernet0.generatedAddress = "00:0c:29:f5:c3:0c" +tools.syncTime = "false" +sched.swap.derivedName = "/vmfs/volumes/498076b2-02796c1a-ef5b-000ae484a6a3/Debian2/Debian2-04db0c5a.vswp" +ethernet0.generatedAddressOffset = "0" +tools.remindInstall = "TRUE" + +sched.cpu.min = "0" +sched.cpu.units = "mhz" + +sched.cpu.affinity = "5,4,3,0" + +floppy1.present = "true" +floppy1.fileType = "file" +floppy1.fileName = "/vmfs/volumes/498076b2-02796c1a-ef5b-000ae484a6a3/Debian2/dummy.flp" +floppy1.clientDevice = "FALSE" diff --git a/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-3.xml b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-3.xml new file mode 100644 index 0000000..3f85cb4 --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-3.xml @@ -0,0 +1,33 @@ +<domain type='vmware'> + <name>virtDebian2</name> + <uuid>564db768-f332-42ee-6201-06973cf5c30c</uuid> + <memory>1048576</memory> + <currentMemory>1048576</currentMemory> + <vcpu cpuset='0,3-5'>2</vcpu> + <os> + <type arch='x86_64'>hvm</type> + </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'> + <driver name='lsilogic'/> + <source file='Debian2.vmdk'/> + <target dev='sda' bus='scsi'/> + </disk> + <disk type='file' device='cdrom'> + <source file='/vmfs/volumes/498076b2-02796c1a-ef5b-000ae484a6a3/Isos/debian-testing-amd64-netinst.iso'/> + <target dev='hda' bus='ide'/> + </disk> + <disk type='file' device='floppy'> + <source file='/vmfs/volumes/498076b2-02796c1a-ef5b-000ae484a6a3/Debian2/dummy.flp'/> + <target dev='fdb' bus='fdc'/> + </disk> + <interface type='bridge'> + <mac address='00:0c:29:f5:c3:0c'/> + <source bridge='VM Network'/> + </interface> + </devices> +</domain> diff --git a/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-4.vmx b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-4.vmx new file mode 100644 index 0000000..6558fd3 --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-4.vmx @@ -0,0 +1,65 @@ +#!/usr/bin/vmware +config.version = "8" +virtualHW.version = "4" +floppy0.present = "false" +nvram = "virtMonServ1.nvram" +deploymentPlatform = "windows" +virtualHW.productCompatibility = "hosted" +tools.upgrade.policy = "useGlobal" +powerType.powerOff = "default" +powerType.powerOn = "default" +powerType.suspend = "default" +powerType.reset = "default" + +displayName = "virtMonServ1" +extendedConfigFile = "virtMonServ1.vmxf" + +scsi0.present = "true" +scsi0.sharedBus = "none" +scsi0.virtualDev = "lsilogic" +memsize = "512" +scsi0:0.present = "true" +scsi0:0.fileName = "virtMonServ1.vmdk" +scsi0:0.deviceType = "scsi-hardDisk" +ide0:0.present = "true" +ide0:0.clientDevice = "true" +ide0:0.deviceType = "cdrom-raw" +ide0:0.startConnected = "false" +ethernet0.present = "true" +ethernet0.networkName = "VM Network" +ethernet0.addressType = "vpx" +chipset.onlineStandby = "false" +guestOSAltName = "Ubuntu Linux (32-bit)" +guestOS = "ubuntu" +uuid.location = "56 4d 9b ef ac d9 b4 e0-c8 f0 ae a8 b9 10 35 15" +uuid.bios = "56 4d 9b ef ac d9 b4 e0-c8 f0 ae a8 b9 10 35 15" +snapshot.action = "keep" +sched.cpu.min = "17666" +sched.cpu.max = "18034" +sched.cpu.units = "mhz" +sched.cpu.shares = "normal" +sched.mem.minsize = "0" +sched.mem.shares = "normal" +toolScripts.afterPowerOn = "true" +toolScripts.afterResume = "true" +toolScripts.beforeSuspend = "true" +toolScripts.beforePowerOff = "true" + +scsi0:0.redo = "" +ethernet0.generatedAddress = "00:50:56:91:66:d4" +tools.syncTime = "false" +sched.swap.derivedName = "/vmfs/volumes/498076b2-02796c1a-ef5b-000ae484a6a3/virtMonServ1/virtMonServ1-66723d05.vswp" +ethernet0.generatedAddressOffset = "0" +tools.remindInstall = "TRUE" + +ethernet1.present = "true" +ethernet1.networkName = "VM Switch 2" +ethernet1.addressType = "vpx" +ethernet1.generatedAddress = "00:50:56:91:0c:51" +serial0.present = "true" +serial0.yieldOnMsrRead = "true" +serial0.fileType = "file" +serial0.fileName = "/vmfs/volumes/498076b2-02796c1a-ef5b-000ae484a6a3/virtMonServ1/serial1.file" +parallel0.present = "true" +parallel0.fileType = "file" +parallel0.fileName = "/vmfs/volumes/498076b2-02796c1a-ef5b-000ae484a6a3/virtMonServ1/parallel1.file" diff --git a/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-4.xml b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-4.xml new file mode 100644 index 0000000..f539dce --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-4.xml @@ -0,0 +1,41 @@ +<domain type='vmware'> + <name>virtMonServ1</name> + <uuid>564d9bef-acd9-b4e0-c8f0-aea8b9103515</uuid> + <memory>524288</memory> + <currentMemory>524288</currentMemory> + <vcpu>1</vcpu> + <os> + <type arch='i686'>hvm</type> + </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'> + <driver name='lsilogic'/> + <source file='virtMonServ1.vmdk'/> + <target dev='sda' bus='scsi'/> + </disk> + <interface type='bridge'> + <mac address='00:50:56:91:66:d4'/> + <source bridge='VM Network'/> + </interface> + <interface type='bridge'> + <mac address='00:50:56:91:0c:51'/> + <source bridge='VM Switch 2'/> + </interface> + <serial type='file'> + <source path='/vmfs/volumes/498076b2-02796c1a-ef5b-000ae484a6a3/virtMonServ1/serial1.file'/> + <target port='0'/> + </serial> + <parallel type='file'> + <source path='/vmfs/volumes/498076b2-02796c1a-ef5b-000ae484a6a3/virtMonServ1/parallel1.file'/> + <target port='0'/> + </parallel> + <console type='file'> + <source path='/vmfs/volumes/498076b2-02796c1a-ef5b-000ae484a6a3/virtMonServ1/serial1.file'/> + <target port='0'/> + </console> + </devices> +</domain> diff --git a/tests/vmx2xmldata/vmx2xml-ethernet-bridged.vmx b/tests/vmx2xmldata/vmx2xml-ethernet-bridged.vmx new file mode 100644 index 0000000..8b7a5b3 --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-ethernet-bridged.vmx @@ -0,0 +1,7 @@ +config.version = "8" +virtualHW.version = "4" +ethernet0.present = "true" +ethernet0.networkName = "VM Network" +ethernet0.connectionType = "bridged" +ethernet0.addressType = "static" +ethernet0.address = "00:50:56:11:22:33" diff --git a/tests/vmx2xmldata/vmx2xml-ethernet-bridged.xml b/tests/vmx2xmldata/vmx2xml-ethernet-bridged.xml new file mode 100644 index 0000000..7ef2d3d --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-ethernet-bridged.xml @@ -0,0 +1,19 @@ +<domain type='vmware'> + <uuid>00000000-0000-0000-0000-000000000000</uuid> + <memory>32768</memory> + <currentMemory>32768</currentMemory> + <vcpu>1</vcpu> + <os> + <type arch='i686'>hvm</type> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <interface type='bridge'> + <mac address='00:50:56:11:22:33'/> + <source bridge='VM Network'/> + </interface> + </devices> +</domain> diff --git a/tests/vmx2xmldata/vmx2xml-ethernet-custom.vmx b/tests/vmx2xmldata/vmx2xml-ethernet-custom.vmx new file mode 100644 index 0000000..bab8aa1 --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-ethernet-custom.vmx @@ -0,0 +1,8 @@ +config.version = "8" +virtualHW.version = "4" +ethernet0.present = "true" +ethernet0.networkName = "VM Network" +ethernet0.connectionType = "custom" +ethernet0.vnet = "vmnet7" +ethernet0.addressType = "static" +ethernet0.address = "00:50:56:11:22:33" diff --git a/tests/vmx2xmldata/vmx2xml-ethernet-custom.xml b/tests/vmx2xmldata/vmx2xml-ethernet-custom.xml new file mode 100644 index 0000000..e08a450 --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-ethernet-custom.xml @@ -0,0 +1,20 @@ +<domain type='vmware'> + <uuid>00000000-0000-0000-0000-000000000000</uuid> + <memory>32768</memory> + <currentMemory>32768</currentMemory> + <vcpu>1</vcpu> + <os> + <type arch='i686'>hvm</type> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <interface type='bridge'> + <mac address='00:50:56:11:22:33'/> + <source bridge='VM Network'/> + <target dev='vmnet7'/> + </interface> + </devices> +</domain> diff --git a/tests/vmx2xmldata/vmx2xml-ethernet-e1000.vmx b/tests/vmx2xmldata/vmx2xml-ethernet-e1000.vmx new file mode 100644 index 0000000..eb7c484 --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-ethernet-e1000.vmx @@ -0,0 +1,8 @@ +config.version = "8" +virtualHW.version = "4" +ethernet0.present = "true" +ethernet0.virtualDev = "e1000" +ethernet0.networkName = "VM Network" +ethernet0.connectionType = "bridged" +ethernet0.addressType = "static" +ethernet0.address = "00:50:56:11:22:33" diff --git a/tests/vmx2xmldata/vmx2xml-ethernet-e1000.xml b/tests/vmx2xmldata/vmx2xml-ethernet-e1000.xml new file mode 100644 index 0000000..1e64c52 --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-ethernet-e1000.xml @@ -0,0 +1,20 @@ +<domain type='vmware'> + <uuid>00000000-0000-0000-0000-000000000000</uuid> + <memory>32768</memory> + <currentMemory>32768</currentMemory> + <vcpu>1</vcpu> + <os> + <type arch='i686'>hvm</type> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <interface type='bridge'> + <mac address='00:50:56:11:22:33'/> + <source bridge='VM Network'/> + <model type='e1000'/> + </interface> + </devices> +</domain> diff --git a/tests/vmx2xmldata/vmx2xml-floppy-device.vmx b/tests/vmx2xmldata/vmx2xml-floppy-device.vmx new file mode 100644 index 0000000..6c6358d --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-floppy-device.vmx @@ -0,0 +1,5 @@ +config.version = "8" +virtualHW.version = "4" +floppy0.present = "true" +floppy0.fileType = "device" +floppy0.fileName = "/dev/fd0" diff --git a/tests/vmx2xmldata/vmx2xml-floppy-device.xml b/tests/vmx2xmldata/vmx2xml-floppy-device.xml new file mode 100644 index 0000000..3991f73 --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-floppy-device.xml @@ -0,0 +1,19 @@ +<domain type='vmware'> + <uuid>00000000-0000-0000-0000-000000000000</uuid> + <memory>32768</memory> + <currentMemory>32768</currentMemory> + <vcpu>1</vcpu> + <os> + <type arch='i686'>hvm</type> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <disk type='block' device='floppy'> + <source dev='/dev/fd0'/> + <target dev='fda' bus='fdc'/> + </disk> + </devices> +</domain> diff --git a/tests/vmx2xmldata/vmx2xml-floppy-file.vmx b/tests/vmx2xmldata/vmx2xml-floppy-file.vmx new file mode 100644 index 0000000..b9ee81b --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-floppy-file.vmx @@ -0,0 +1,5 @@ +config.version = "8" +virtualHW.version = "4" +floppy0.present = "true" +floppy0.fileType = "file" +floppy0.fileName = "floppy.flp" diff --git a/tests/vmx2xmldata/vmx2xml-floppy-file.xml b/tests/vmx2xmldata/vmx2xml-floppy-file.xml new file mode 100644 index 0000000..03c7824 --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-floppy-file.xml @@ -0,0 +1,19 @@ +<domain type='vmware'> + <uuid>00000000-0000-0000-0000-000000000000</uuid> + <memory>32768</memory> + <currentMemory>32768</currentMemory> + <vcpu>1</vcpu> + <os> + <type arch='i686'>hvm</type> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <disk type='file' device='floppy'> + <source file='floppy.flp'/> + <target dev='fda' bus='fdc'/> + </disk> + </devices> +</domain> diff --git a/tests/vmx2xmldata/vmx2xml-gsx-in-the-wild-1.vmx b/tests/vmx2xmldata/vmx2xml-gsx-in-the-wild-1.vmx new file mode 100644 index 0000000..cee137b --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-gsx-in-the-wild-1.vmx @@ -0,0 +1,54 @@ +#!/usr/bin/vmware +config.version = "8" +virtualHW.version = "4" + +displayName = "Server1" +guestOS = "other26xlinux" +nvram = "Debian-System1.nvram" +memsize = "32" +MemAllowAutoScaleDown = "FALSE" + + +scsi0.present = "TRUE" +scsi0.virtualDev = "lsilogic" + +ide0:0.redo = "" +ide0:0.present = "TRUE" +ide0:0.fileName = "Debian-System1-0-cl2.vmdk" +ide0:0.writeThrough = "FALSE" +ide0:0.mode = "independent-persistent" + +ide1:0.present = "FALSE" +ide1:0.fileName = "/dev/hda" +ide1:0.deviceType = "cdrom-raw" + +floppy0.fileName = "/dev/fd0" +floppy0.startConnected = "FALSE" +floppy0.present = "FALSE" + +ethernet0.present = "TRUE" +ethernet0.connectionType = "custom" +ethernet0.addressType = "generated" +ethernet0.generatedAddress = "00:0c:29:d6:2b:d3" +ethernet0.generatedAddressOffset = "0" +ethernet0.startConnected = "TRUE" +ethernet0.pvnID = "52 f6 0b f2 77 27 eb 7b-a5 a0 16 7e a3 f0 57 aa" +ethernet0.vnet = "/dev/vmnet1" +ethernet0.networkName = "net1" + +usb.present = "TRUE" + +sound.startConnected = "FALSE" +sound.present = "FALSE" +sound.virtualDev = "es1371" + +uuid.action = "create" +uuid.location = "56 4d 12 23 f8 35 c4 b1-bb f6 e3 23 90 d6 2b d3" +uuid.bios = "56 4d 12 23 f8 35 c4 b1-bb f6 e3 23 90 d6 2b d3" + +tools.remindInstall = "TRUE" + + +checkpoint.vmState = "" + +workingDir = "" diff --git a/tests/vmx2xmldata/vmx2xml-gsx-in-the-wild-1.xml b/tests/vmx2xmldata/vmx2xml-gsx-in-the-wild-1.xml new file mode 100644 index 0000000..c1c2e05 --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-gsx-in-the-wild-1.xml @@ -0,0 +1,25 @@ +<domain type='vmware'> + <name>Server1</name> + <uuid>564d1223-f835-c4b1-bbf6-e32390d62bd3</uuid> + <memory>32768</memory> + <currentMemory>32768</currentMemory> + <vcpu>1</vcpu> + <os> + <type arch='i686'>hvm</type> + </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='Debian-System1-0-cl2.vmdk'/> + <target dev='hda' bus='ide'/> + </disk> + <interface type='bridge'> + <mac address='00:0c:29:d6:2b:d3'/> + <source bridge='net1'/> + <target dev='/dev/vmnet1'/> + </interface> + </devices> +</domain> diff --git a/tests/vmx2xmldata/vmx2xml-gsx-in-the-wild-2.vmx b/tests/vmx2xmldata/vmx2xml-gsx-in-the-wild-2.vmx new file mode 100644 index 0000000..111ed30 --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-gsx-in-the-wild-2.vmx @@ -0,0 +1,52 @@ +#!/usr/bin/vmware +config.version = "8" +virtualHW.version = "4" +scsi0.present = "TRUE" +scsi0.virtualDev = "lsilogic" +memsize = "32" +MemAllowAutoScaleDown = "FALSE" +ide0:0.present = "TRUE" +ide0:0.fileName = "Debian-System1-0-cl3.vmdk" +ide0:0.writeThrough = "FALSE" +ide1:0.present = "FALSE" +ide1:0.fileName = "/dev/hda" +ide1:0.deviceType = "cdrom-raw" +floppy0.fileName = "/dev/fd0" +ethernet0.present = "TRUE" +ethernet0.connectionType = "custom" +usb.present = "TRUE" +sound.present = "FALSE" +sound.virtualDev = "es1371" +displayName = "Server2" +guestOS = "other26xlinux" +nvram = "Server2.nvram" + +ide0:0.redo = "" +ethernet0.addressType = "generated" +uuid.location = "56 4d 33 01 26 7f a0 ef-8b 7d d4 5e 98 d6 cb a4" +uuid.bios = "56 4d 33 01 26 7f a0 ef-8b 7d d4 5e 98 d6 cb a4" +ethernet0.generatedAddress = "00:0c:29:d6:cb:a4" +ethernet0.generatedAddressOffset = "0" + +tools.remindInstall = "TRUE" + +ethernet0.startConnected = "TRUE" + +ethernet0.pvnID = "52 f6 0b f2 77 27 eb 7b-a5 a0 16 7e a3 f0 57 aa" + +floppy0.startConnected = "FALSE" + +ide0:0.mode = "independent-persistent" + +uuid.action = "create" + +sound.startConnected = "FALSE" + +checkpoint.vmState = "" +ethernet0.networkName = "net1" + +ethernet0.vnet = "/dev/vmnet1" + +floppy0.present = "FALSE" + +workingDir = "" diff --git a/tests/vmx2xmldata/vmx2xml-gsx-in-the-wild-2.xml b/tests/vmx2xmldata/vmx2xml-gsx-in-the-wild-2.xml new file mode 100644 index 0000000..d71dc16 --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-gsx-in-the-wild-2.xml @@ -0,0 +1,25 @@ +<domain type='vmware'> + <name>Server2</name> + <uuid>564d3301-267f-a0ef-8b7d-d45e98d6cba4</uuid> + <memory>32768</memory> + <currentMemory>32768</currentMemory> + <vcpu>1</vcpu> + <os> + <type arch='i686'>hvm</type> + </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='Debian-System1-0-cl3.vmdk'/> + <target dev='hda' bus='ide'/> + </disk> + <interface type='bridge'> + <mac address='00:0c:29:d6:cb:a4'/> + <source bridge='net1'/> + <target dev='/dev/vmnet1'/> + </interface> + </devices> +</domain> diff --git a/tests/vmx2xmldata/vmx2xml-gsx-in-the-wild-3.vmx b/tests/vmx2xmldata/vmx2xml-gsx-in-the-wild-3.vmx new file mode 100644 index 0000000..f7475ee --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-gsx-in-the-wild-3.vmx @@ -0,0 +1,59 @@ +#!/usr/bin/vmware +config.version = "8" +virtualHW.version = "4" +scsi0.present = "TRUE" +scsi0.virtualDev = "lsilogic" +memsize = "32" +MemAllowAutoScaleDown = "FALSE" +ide0:0.present = "TRUE" +ide0:0.fileName = "Debian-System1-0-cl1.vmdk" +ide0:0.writeThrough = "FALSE" +ide1:0.present = "FALSE" +ide1:0.fileName = "/dev/hda" +ide1:0.deviceType = "cdrom-raw" +floppy0.fileName = "/dev/fd0" +ethernet0.present = "TRUE" +ethernet0.connectionType = "custom" +usb.present = "TRUE" +sound.present = "FALSE" +sound.virtualDev = "es1371" +displayName = "Router" +guestOS = "other26xlinux" +nvram = "Debian-System3.nvram" + +ide0:0.redo = "" +ethernet0.addressType = "generated" +uuid.location = "56 4d de be e8 6f d5 86-08 54 a0 87 9c c4 be 5a" +uuid.bios = "56 4d de be e8 6f d5 86-08 54 a0 87 9c c4 be 5a" +ethernet0.generatedAddress = "00:0c:29:c4:be:5a" +ethernet0.generatedAddressOffset = "0" + +tools.remindInstall = "TRUE" + +ethernet0.pvnID = "52 f6 0b f2 77 27 eb 7b-a5 a0 16 7e a3 f0 57 aa" + +floppy0.startConnected = "FALSE" + +ethernet1.present = "TRUE" +ethernet1.connectionType = "custom" +ethernet1.pvnID = "52 e3 67 11 22 b9 90 a3-df 09 e3 9c c3 64 b1 22" + +ethernet1.addressType = "generated" +ethernet1.generatedAddress = "00:0c:29:c4:be:64" +ethernet1.generatedAddressOffset = "10" + +ide0:0.mode = "independent-persistent" + +sound.startConnected = "FALSE" + +ethernet0.networkName = "net1" +ethernet0.vnet = "/dev/vmnet1" + +ethernet1.vnet = "/dev/vmnet2" +ethernet1.networkName = "net2" + +checkpoint.vmState = "" + +floppy0.present = "FALSE" + +uuid.action = "create" diff --git a/tests/vmx2xmldata/vmx2xml-gsx-in-the-wild-3.xml b/tests/vmx2xmldata/vmx2xml-gsx-in-the-wild-3.xml new file mode 100644 index 0000000..370dd57 --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-gsx-in-the-wild-3.xml @@ -0,0 +1,30 @@ +<domain type='vmware'> + <name>Router</name> + <uuid>564ddebe-e86f-d586-0854-a0879cc4be5a</uuid> + <memory>32768</memory> + <currentMemory>32768</currentMemory> + <vcpu>1</vcpu> + <os> + <type arch='i686'>hvm</type> + </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='Debian-System1-0-cl1.vmdk'/> + <target dev='hda' bus='ide'/> + </disk> + <interface type='bridge'> + <mac address='00:0c:29:c4:be:5a'/> + <source bridge='net1'/> + <target dev='/dev/vmnet1'/> + </interface> + <interface type='bridge'> + <mac address='00:0c:29:c4:be:64'/> + <source bridge='net2'/> + <target dev='/dev/vmnet2'/> + </interface> + </devices> +</domain> diff --git a/tests/vmx2xmldata/vmx2xml-gsx-in-the-wild-4.vmx b/tests/vmx2xmldata/vmx2xml-gsx-in-the-wild-4.vmx new file mode 100644 index 0000000..5eae715 --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-gsx-in-the-wild-4.vmx @@ -0,0 +1,54 @@ +#!/usr/bin/vmware +config.version = "8" +virtualHW.version = "4" +scsi0.present = "TRUE" +scsi0.virtualDev = "lsilogic" +memsize = "264" +MemAllowAutoScaleDown = "FALSE" +ide0:0.present = "TRUE" +ide0:0.fileName = "Debian-System1-0-cl2.vmdk" +ide0:0.writeThrough = "FALSE" +ide1:0.present = "FALSE" +ide1:0.fileName = "/dev/hda" +ide1:0.deviceType = "cdrom-raw" +floppy0.fileName = "/dev/fd0" +ethernet0.present = "TRUE" +ethernet0.connectionType = "custom" +usb.present = "TRUE" +sound.present = "FALSE" +sound.virtualDev = "es1371" +displayName = "Client" +guestOS = "other26xlinux" +nvram = "Debian-System4.nvram" + +ide0:0.redo = "" +ethernet0.addressType = "generated" +uuid.location = "56 4d ad 58 06 29 d3 e6-ec fe 8f f8 39 c5 e3 5d" +uuid.bios = "56 4d ad 58 06 29 d3 e6-ec fe 8f f8 39 c5 e3 5d" +ethernet0.generatedAddress = "00:0c:29:c5:e3:5d" +ethernet0.generatedAddressOffset = "0" + +tools.remindInstall = "TRUE" + +extendedConfigFile = "Debian-System4.vmxf" + +inVMTeam = "FALSE" + +ethernet0.startConnected = "TRUE" + +ethernet0.pvnID = "52 f9 2a ec 52 26 01 54-fe ab 09 d1 48 32 95 c5" + +floppy0.startConnected = "FALSE" + +ide0:0.mode = "independent-persistent" + +sound.startConnected = "FALSE" + +ethernet0.vnet = "/dev/vmnet2" +ethernet0.networkName = "net2" + +floppy0.present = "FALSE" + +usb.generic.autoconnect = "FALSE" + +uuid.action = "create" diff --git a/tests/vmx2xmldata/vmx2xml-gsx-in-the-wild-4.xml b/tests/vmx2xmldata/vmx2xml-gsx-in-the-wild-4.xml new file mode 100644 index 0000000..3b01392 --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-gsx-in-the-wild-4.xml @@ -0,0 +1,25 @@ +<domain type='vmware'> + <name>Client</name> + <uuid>564dad58-0629-d3e6-ecfe-8ff839c5e35d</uuid> + <memory>270336</memory> + <currentMemory>270336</currentMemory> + <vcpu>1</vcpu> + <os> + <type arch='i686'>hvm</type> + </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='Debian-System1-0-cl2.vmdk'/> + <target dev='hda' bus='ide'/> + </disk> + <interface type='bridge'> + <mac address='00:0c:29:c5:e3:5d'/> + <source bridge='net2'/> + <target dev='/dev/vmnet2'/> + </interface> + </devices> +</domain> diff --git a/tests/vmx2xmldata/vmx2xml-harddisk-ide-file.vmx b/tests/vmx2xmldata/vmx2xml-harddisk-ide-file.vmx new file mode 100644 index 0000000..a8c71f1 --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-harddisk-ide-file.vmx @@ -0,0 +1,5 @@ +config.version = "8" +virtualHW.version = "4" +ide0:0.present = "true" +ide0:0.deviceType = "ata-hardDisk" +ide0:0.fileName = "harddisk.vmdk" diff --git a/tests/vmx2xmldata/vmx2xml-harddisk-ide-file.xml b/tests/vmx2xmldata/vmx2xml-harddisk-ide-file.xml new file mode 100644 index 0000000..c507ea2 --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-harddisk-ide-file.xml @@ -0,0 +1,19 @@ +<domain type='vmware'> + <uuid>00000000-0000-0000-0000-000000000000</uuid> + <memory>32768</memory> + <currentMemory>32768</currentMemory> + <vcpu>1</vcpu> + <os> + <type arch='i686'>hvm</type> + </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='harddisk.vmdk'/> + <target dev='hda' bus='ide'/> + </disk> + </devices> +</domain> diff --git a/tests/vmx2xmldata/vmx2xml-harddisk-scsi-file.vmx b/tests/vmx2xmldata/vmx2xml-harddisk-scsi-file.vmx new file mode 100644 index 0000000..933707c --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-harddisk-scsi-file.vmx @@ -0,0 +1,6 @@ +config.version = "8" +virtualHW.version = "4" +scsi0.present = "true" +scsi0:0.present = "true" +scsi0:0.deviceType = "scsi-hardDisk" +scsi0:0.fileName = "harddisk.vmdk" diff --git a/tests/vmx2xmldata/vmx2xml-harddisk-scsi-file.xml b/tests/vmx2xmldata/vmx2xml-harddisk-scsi-file.xml new file mode 100644 index 0000000..6b8b4fc --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-harddisk-scsi-file.xml @@ -0,0 +1,19 @@ +<domain type='vmware'> + <uuid>00000000-0000-0000-0000-000000000000</uuid> + <memory>32768</memory> + <currentMemory>32768</currentMemory> + <vcpu>1</vcpu> + <os> + <type arch='i686'>hvm</type> + </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='harddisk.vmdk'/> + <target dev='sda' bus='scsi'/> + </disk> + </devices> +</domain> diff --git a/tests/vmx2xmldata/vmx2xml-minimal-64bit.vmx b/tests/vmx2xmldata/vmx2xml-minimal-64bit.vmx new file mode 100644 index 0000000..73d3972 --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-minimal-64bit.vmx @@ -0,0 +1,3 @@ +config.version = "8" +virtualHW.version = "4" +guestOS = "other-64" diff --git a/tests/vmx2xmldata/vmx2xml-minimal-64bit.xml b/tests/vmx2xmldata/vmx2xml-minimal-64bit.xml new file mode 100644 index 0000000..cec8ba0 --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-minimal-64bit.xml @@ -0,0 +1,15 @@ +<domain type='vmware'> + <uuid>00000000-0000-0000-0000-000000000000</uuid> + <memory>32768</memory> + <currentMemory>32768</currentMemory> + <vcpu>1</vcpu> + <os> + <type arch='x86_64'>hvm</type> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + </devices> +</domain> diff --git a/tests/vmx2xmldata/vmx2xml-minimal.vmx b/tests/vmx2xmldata/vmx2xml-minimal.vmx new file mode 100644 index 0000000..a8e5db3 --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-minimal.vmx @@ -0,0 +1,2 @@ +config.version = "8" +virtualHW.version = "4" diff --git a/tests/vmx2xmldata/vmx2xml-minimal.xml b/tests/vmx2xmldata/vmx2xml-minimal.xml new file mode 100644 index 0000000..acfd9bd --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-minimal.xml @@ -0,0 +1,15 @@ +<domain type='vmware'> + <uuid>00000000-0000-0000-0000-000000000000</uuid> + <memory>32768</memory> + <currentMemory>32768</currentMemory> + <vcpu>1</vcpu> + <os> + <type arch='i686'>hvm</type> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + </devices> +</domain> diff --git a/tests/vmx2xmldata/vmx2xml-parallel-device.vmx b/tests/vmx2xmldata/vmx2xml-parallel-device.vmx new file mode 100644 index 0000000..ee2eb74 --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-parallel-device.vmx @@ -0,0 +1,5 @@ +config.version = "8" +virtualHW.version = "4" +parallel0.present = "true" +parallel0.fileType = "device" +parallel0.fileName = "/dev/parallel0" diff --git a/tests/vmx2xmldata/vmx2xml-parallel-device.xml b/tests/vmx2xmldata/vmx2xml-parallel-device.xml new file mode 100644 index 0000000..28c2302 --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-parallel-device.xml @@ -0,0 +1,19 @@ +<domain type='vmware'> + <uuid>00000000-0000-0000-0000-000000000000</uuid> + <memory>32768</memory> + <currentMemory>32768</currentMemory> + <vcpu>1</vcpu> + <os> + <type arch='i686'>hvm</type> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <parallel type='dev'> + <source path='/dev/parallel0'/> + <target port='0'/> + </parallel> + </devices> +</domain> diff --git a/tests/vmx2xmldata/vmx2xml-parallel-file.vmx b/tests/vmx2xmldata/vmx2xml-parallel-file.vmx new file mode 100644 index 0000000..e91906a --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-parallel-file.vmx @@ -0,0 +1,5 @@ +config.version = "8" +virtualHW.version = "4" +parallel0.present = "true" +parallel0.fileType = "file" +parallel0.fileName = "parallel0.file" diff --git a/tests/vmx2xmldata/vmx2xml-parallel-file.xml b/tests/vmx2xmldata/vmx2xml-parallel-file.xml new file mode 100644 index 0000000..77c8119 --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-parallel-file.xml @@ -0,0 +1,19 @@ +<domain type='vmware'> + <uuid>00000000-0000-0000-0000-000000000000</uuid> + <memory>32768</memory> + <currentMemory>32768</currentMemory> + <vcpu>1</vcpu> + <os> + <type arch='i686'>hvm</type> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <parallel type='file'> + <source path='parallel0.file'/> + <target port='0'/> + </parallel> + </devices> +</domain> diff --git a/tests/vmx2xmldata/vmx2xml-scsi-buslogic.vmx b/tests/vmx2xmldata/vmx2xml-scsi-buslogic.vmx new file mode 100644 index 0000000..1725051 --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-scsi-buslogic.vmx @@ -0,0 +1,7 @@ +config.version = "8" +virtualHW.version = "4" +scsi0.present = "true" +scsi0.virtualDev = "buslogic" +scsi0:0.present = "true" +scsi0:0.deviceType = "scsi-hardDisk" +scsi0:0.fileName = "harddisk.vmdk" diff --git a/tests/vmx2xmldata/vmx2xml-scsi-buslogic.xml b/tests/vmx2xmldata/vmx2xml-scsi-buslogic.xml new file mode 100644 index 0000000..2c12348 --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-scsi-buslogic.xml @@ -0,0 +1,20 @@ +<domain type='vmware'> + <uuid>00000000-0000-0000-0000-000000000000</uuid> + <memory>32768</memory> + <currentMemory>32768</currentMemory> + <vcpu>1</vcpu> + <os> + <type arch='i686'>hvm</type> + </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'> + <driver name='buslogic'/> + <source file='harddisk.vmdk'/> + <target dev='sda' bus='scsi'/> + </disk> + </devices> +</domain> diff --git a/tests/vmx2xmldata/vmx2xml-scsi-writethrough.vmx b/tests/vmx2xmldata/vmx2xml-scsi-writethrough.vmx new file mode 100644 index 0000000..54ac49c --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-scsi-writethrough.vmx @@ -0,0 +1,8 @@ +config.version = "8" +virtualHW.version = "4" +scsi0.present = "true" +scsi0.virtualDev = "buslogic" +scsi0:0.present = "true" +scsi0:0.deviceType = "scsi-hardDisk" +scsi0:0.fileName = "harddisk.vmdk" +scsi0:0.writeThrough = "true" diff --git a/tests/vmx2xmldata/vmx2xml-scsi-writethrough.xml b/tests/vmx2xmldata/vmx2xml-scsi-writethrough.xml new file mode 100644 index 0000000..3c3a8e0 --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-scsi-writethrough.xml @@ -0,0 +1,20 @@ +<domain type='vmware'> + <uuid>00000000-0000-0000-0000-000000000000</uuid> + <memory>32768</memory> + <currentMemory>32768</currentMemory> + <vcpu>1</vcpu> + <os> + <type arch='i686'>hvm</type> + </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'> + <driver name='buslogic' cache='writethrough'/> + <source file='harddisk.vmdk'/> + <target dev='sda' bus='scsi'/> + </disk> + </devices> +</domain> diff --git a/tests/vmx2xmldata/vmx2xml-serial-device.vmx b/tests/vmx2xmldata/vmx2xml-serial-device.vmx new file mode 100644 index 0000000..8c101e3 --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-serial-device.vmx @@ -0,0 +1,5 @@ +config.version = "8" +virtualHW.version = "4" +serial0.present = "true" +serial0.fileType = "device" +serial0.fileName = "/dev/ttyS0" diff --git a/tests/vmx2xmldata/vmx2xml-serial-device.xml b/tests/vmx2xmldata/vmx2xml-serial-device.xml new file mode 100644 index 0000000..83e1ce9 --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-serial-device.xml @@ -0,0 +1,23 @@ +<domain type='vmware'> + <uuid>00000000-0000-0000-0000-000000000000</uuid> + <memory>32768</memory> + <currentMemory>32768</currentMemory> + <vcpu>1</vcpu> + <os> + <type arch='i686'>hvm</type> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <serial type='dev'> + <source path='/dev/ttyS0'/> + <target port='0'/> + </serial> + <console type='dev'> + <source path='/dev/ttyS0'/> + <target port='0'/> + </console> + </devices> +</domain> diff --git a/tests/vmx2xmldata/vmx2xml-serial-file.vmx b/tests/vmx2xmldata/vmx2xml-serial-file.vmx new file mode 100644 index 0000000..2c3bc39 --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-serial-file.vmx @@ -0,0 +1,5 @@ +config.version = "8" +virtualHW.version = "4" +serial0.present = "true" +serial0.fileType = "file" +serial0.fileName = "serial0.file" diff --git a/tests/vmx2xmldata/vmx2xml-serial-file.xml b/tests/vmx2xmldata/vmx2xml-serial-file.xml new file mode 100644 index 0000000..55b44c5 --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-serial-file.xml @@ -0,0 +1,23 @@ +<domain type='vmware'> + <uuid>00000000-0000-0000-0000-000000000000</uuid> + <memory>32768</memory> + <currentMemory>32768</currentMemory> + <vcpu>1</vcpu> + <os> + <type arch='i686'>hvm</type> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <serial type='file'> + <source path='serial0.file'/> + <target port='0'/> + </serial> + <console type='file'> + <source path='serial0.file'/> + <target port='0'/> + </console> + </devices> +</domain> diff --git a/tests/vmx2xmldata/vmx2xml-serial-pipe-client-app.vmx b/tests/vmx2xmldata/vmx2xml-serial-pipe-client-app.vmx new file mode 100644 index 0000000..f104aab --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-serial-pipe-client-app.vmx @@ -0,0 +1,7 @@ +config.version = "8" +virtualHW.version = "4" +serial0.present = "true" +serial0.fileType = "pipe" +serial0.fileName = "serial0.pipe" +serial0.pipe.endPoint = "client" +serial0.tryNoRxLoss = "true" diff --git a/tests/vmx2xmldata/vmx2xml-serial-pipe-client-vm.vmx b/tests/vmx2xmldata/vmx2xml-serial-pipe-client-vm.vmx new file mode 100644 index 0000000..3b487ee --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-serial-pipe-client-vm.vmx @@ -0,0 +1,6 @@ +config.version = "8" +virtualHW.version = "4" +serial0.present = "true" +serial0.fileType = "pipe" +serial0.fileName = "serial0.pipe" +serial0.pipe.endPoint = "client" diff --git a/tests/vmx2xmldata/vmx2xml-serial-pipe-server-app.vmx b/tests/vmx2xmldata/vmx2xml-serial-pipe-server-app.vmx new file mode 100644 index 0000000..27ee3bc --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-serial-pipe-server-app.vmx @@ -0,0 +1,7 @@ +config.version = "8" +virtualHW.version = "4" +serial0.present = "true" +serial0.fileType = "pipe" +serial0.fileName = "serial0.pipe" +serial0.pipe.endPoint = "server" +serial0.tryNoRxLoss = "true" diff --git a/tests/vmx2xmldata/vmx2xml-serial-pipe-server-vm.vmx b/tests/vmx2xmldata/vmx2xml-serial-pipe-server-vm.vmx new file mode 100644 index 0000000..b99c627 --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-serial-pipe-server-vm.vmx @@ -0,0 +1,6 @@ +config.version = "8" +virtualHW.version = "4" +serial0.present = "true" +serial0.fileType = "pipe" +serial0.fileName = "serial0.pipe" +serial0.pipe.endPoint = "server" diff --git a/tests/vmx2xmldata/vmx2xml-serial-pipe.xml b/tests/vmx2xmldata/vmx2xml-serial-pipe.xml new file mode 100644 index 0000000..38e69a6 --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-serial-pipe.xml @@ -0,0 +1,23 @@ +<domain type='vmware'> + <uuid>00000000-0000-0000-0000-000000000000</uuid> + <memory>32768</memory> + <currentMemory>32768</currentMemory> + <vcpu>1</vcpu> + <os> + <type arch='i686'>hvm</type> + </os> + <clock offset='utc'/> + <on_poweroff>destroy</on_poweroff> + <on_reboot>restart</on_reboot> + <on_crash>destroy</on_crash> + <devices> + <serial type='pipe'> + <source path='serial0.pipe'/> + <target port='0'/> + </serial> + <console type='pipe'> + <source path='serial0.pipe'/> + <target port='0'/> + </console> + </devices> +</domain> diff --git a/tests/vmx2xmltest.c b/tests/vmx2xmltest.c new file mode 100644 index 0000000..5c344d0 --- /dev/null +++ b/tests/vmx2xmltest.c @@ -0,0 +1,173 @@ +#include <config.h> + +#ifdef WITH_ESX + +#include <stdio.h> +#include <string.h> +#include <unistd.h> + +#include "internal.h" +#include "memory.h" +#include "testutils.h" +#include "esx/esx_vmx.h" + +static char *progname = NULL; +static char *abs_srcdir = NULL; + +#define MAX_FILE 4096 + +static int +testCompareFiles(const char *vmx, const char *xml, esxVI_APIVersion apiVersion) +{ + int result = -1; + char vmxData[MAX_FILE]; + char xmlData[MAX_FILE]; + char *formatted = NULL; + char *vmxPtr = &(vmxData[0]); + char *xmlPtr = &(xmlData[0]); + virDomainDefPtr def = NULL; + + if (virtTestLoadFile(vmx, &vmxPtr, MAX_FILE) < 0) { + goto failure; + } + + if (virtTestLoadFile(xml, &xmlPtr, MAX_FILE) < 0) { + goto failure; + } + + def = esxVMX_ParseConfig(NULL, vmxData, apiVersion); + + if (def == NULL) { + goto failure; + } + + formatted = virDomainDefFormat(NULL, def, 0); + + if (formatted == NULL) { + goto failure; + } + + if (STRNEQ(xmlData, formatted)) { + virtTestDifference(stderr, xmlData, formatted); + goto failure; + } + + result = 0; + + failure: + VIR_FREE(formatted); + virDomainDefFree(def); + + return result; +} + +struct testInfo { + const char *input; + const char *output; + esxVI_APIVersion version; +}; + +static int +testCompareHelper(const void *data) +{ + const struct testInfo *info = data; + char vmx[PATH_MAX]; + char xml[PATH_MAX]; + + snprintf(vmx, PATH_MAX, "%s/vmx2xmldata/vmx2xml-%s.vmx", abs_srcdir, + info->input); + snprintf(xml, PATH_MAX, "%s/vmx2xmldata/vmx2xml-%s.xml", abs_srcdir, + info->output); + + return testCompareFiles(vmx, xml, info->version); +} + +static int +mymain(int argc, char **argv) +{ + int result = 0; + char cwd[PATH_MAX]; + + progname = argv[0]; + + if (argc > 1) { + fprintf(stderr, "Usage: %s\n", progname); + return EXIT_FAILURE; + } + + abs_srcdir = getenv("abs_srcdir"); + + if (abs_srcdir == NULL) { + abs_srcdir = getcwd(cwd, sizeof(cwd)); + } + + if (argc > 1) { + fprintf(stderr, "Usage: %s\n", progname); + return EXIT_FAILURE; + } + + #define DO_TEST(_in, _out, _version) \ + do { \ + struct testInfo info = { _in, _out, _version }; \ + virResetLastError(); \ + if (virtTestRun("VMware VMX-2-XML "_in" -> "_out, 1, \ + testCompareHelper, &info) < 0) { \ + result = -1; \ + } \ + } while (0) + + DO_TEST("minimal", "minimal", esxVI_APIVersion_25); + DO_TEST("minimal-64bit", "minimal-64bit", esxVI_APIVersion_25); + + DO_TEST("scsi-buslogic", "scsi-buslogic", esxVI_APIVersion_25); + DO_TEST("scsi-writethrough", "scsi-writethrough", esxVI_APIVersion_25); + + DO_TEST("harddisk-scsi-file", "harddisk-scsi-file", esxVI_APIVersion_25); + DO_TEST("harddisk-ide-file", "harddisk-ide-file", esxVI_APIVersion_25); + + DO_TEST("cdrom-scsi-file", "cdrom-scsi-file", esxVI_APIVersion_25); + DO_TEST("cdrom-scsi-device", "cdrom-scsi-device", esxVI_APIVersion_25); + DO_TEST("cdrom-ide-file", "cdrom-ide-file", esxVI_APIVersion_25); + DO_TEST("cdrom-ide-device", "cdrom-ide-device", esxVI_APIVersion_25); + + DO_TEST("floppy-file", "floppy-file", esxVI_APIVersion_25); + DO_TEST("floppy-device", "floppy-device", esxVI_APIVersion_25); + + DO_TEST("ethernet-e1000", "ethernet-e1000", esxVI_APIVersion_25); + + DO_TEST("ethernet-custom", "ethernet-custom", esxVI_APIVersion_25); + DO_TEST("ethernet-bridged", "ethernet-bridged", esxVI_APIVersion_25); + + DO_TEST("serial-file", "serial-file", esxVI_APIVersion_25); + DO_TEST("serial-device", "serial-device", esxVI_APIVersion_25); + DO_TEST("serial-pipe-client-app", "serial-pipe", esxVI_APIVersion_25); + DO_TEST("serial-pipe-server-vm", "serial-pipe", esxVI_APIVersion_25); + DO_TEST("serial-pipe-client-app", "serial-pipe", esxVI_APIVersion_25); + DO_TEST("serial-pipe-server-vm", "serial-pipe", esxVI_APIVersion_25); + + DO_TEST("parallel-file", "parallel-file", esxVI_APIVersion_25); + DO_TEST("parallel-device", "parallel-device", esxVI_APIVersion_25); + + DO_TEST("esx-in-the-wild-1", "esx-in-the-wild-1", esxVI_APIVersion_25); + DO_TEST("esx-in-the-wild-2", "esx-in-the-wild-2", esxVI_APIVersion_25); + DO_TEST("esx-in-the-wild-3", "esx-in-the-wild-3", esxVI_APIVersion_25); + DO_TEST("esx-in-the-wild-4", "esx-in-the-wild-4", esxVI_APIVersion_25); + + DO_TEST("gsx-in-the-wild-1", "gsx-in-the-wild-1", esxVI_APIVersion_25); + DO_TEST("gsx-in-the-wild-2", "gsx-in-the-wild-2", esxVI_APIVersion_25); + DO_TEST("gsx-in-the-wild-3", "gsx-in-the-wild-3", esxVI_APIVersion_25); + DO_TEST("gsx-in-the-wild-4", "gsx-in-the-wild-4", esxVI_APIVersion_25); + + return result == 0 ? EXIT_SUCCESS : EXIT_FAILURE; +} + +VIRT_TEST_MAIN(mymain) + +#else + +int main (void) +{ + return 77; /* means 'test skipped' for automake */ +} + +#endif /* WITH_ESX */ diff --git a/tests/xml2vmxdata/xml2vmx-cdrom-ide-device.vmx b/tests/xml2vmxdata/xml2vmx-cdrom-ide-device.vmx new file mode 100644 index 0000000..8712e19 --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-cdrom-ide-device.vmx @@ -0,0 +1,10 @@ +config.version = "8" +virtualHW.version = "4" +guestOS = "other" +uuid.bios = "56 4d 9b ef ac d9 b4 e0-c8 f0 ae a8 b9 10 35 15" +displayName = "cdrom-ide-device" +memsize = "4" +numvcpus = "1" +ide0:0.present = "true" +ide0:0.deviceType = "atapi-cdrom" +ide0:0.fileName = "/dev/scd0" diff --git a/tests/xml2vmxdata/xml2vmx-cdrom-ide-device.xml b/tests/xml2vmxdata/xml2vmx-cdrom-ide-device.xml new file mode 100644 index 0000000..17199a9 --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-cdrom-ide-device.xml @@ -0,0 +1,14 @@ +<domain type='vmware'> + <name>cdrom-ide-device</name> + <uuid>564d9bef-acd9-b4e0-c8f0-aea8b9103515</uuid> + <memory>4096</memory> + <os> + <type>hvm</type> + </os> + <devices> + <disk type='block' device='cdrom'> + <source dev='/dev/scd0'/> + <target dev='hda' bus='ide'/> + </disk> + </devices> +</domain> diff --git a/tests/xml2vmxdata/xml2vmx-cdrom-ide-file.vmx b/tests/xml2vmxdata/xml2vmx-cdrom-ide-file.vmx new file mode 100644 index 0000000..efcff55 --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-cdrom-ide-file.vmx @@ -0,0 +1,10 @@ +config.version = "8" +virtualHW.version = "4" +guestOS = "other" +uuid.bios = "56 4d 9b ef ac d9 b4 e0-c8 f0 ae a8 b9 10 35 15" +displayName = "cdrom-ide-file" +memsize = "4" +numvcpus = "1" +ide0:0.present = "true" +ide0:0.deviceType = "cdrom-image" +ide0:0.fileName = "cdrom.iso" diff --git a/tests/xml2vmxdata/xml2vmx-cdrom-ide-file.xml b/tests/xml2vmxdata/xml2vmx-cdrom-ide-file.xml new file mode 100644 index 0000000..f54bced --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-cdrom-ide-file.xml @@ -0,0 +1,14 @@ +<domain type='vmware'> + <name>cdrom-ide-file</name> + <uuid>564d9bef-acd9-b4e0-c8f0-aea8b9103515</uuid> + <memory>4096</memory> + <os> + <type>hvm</type> + </os> + <devices> + <disk type='file' device='cdrom'> + <source file='cdrom.iso'/> + <target dev='hda' bus='ide'/> + </disk> + </devices> +</domain> diff --git a/tests/xml2vmxdata/xml2vmx-cdrom-scsi-device.vmx b/tests/xml2vmxdata/xml2vmx-cdrom-scsi-device.vmx new file mode 100644 index 0000000..5121c36 --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-cdrom-scsi-device.vmx @@ -0,0 +1,11 @@ +config.version = "8" +virtualHW.version = "4" +guestOS = "other" +uuid.bios = "56 4d 9b ef ac d9 b4 e0-c8 f0 ae a8 b9 10 35 15" +displayName = "cdrom-scsi-device" +memsize = "4" +numvcpus = "1" +scsi0.present = "true" +scsi0:0.present = "true" +scsi0:0.deviceType = "atapi-cdrom" +scsi0:0.fileName = "/dev/scd0" diff --git a/tests/xml2vmxdata/xml2vmx-cdrom-scsi-device.xml b/tests/xml2vmxdata/xml2vmx-cdrom-scsi-device.xml new file mode 100644 index 0000000..931e99d --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-cdrom-scsi-device.xml @@ -0,0 +1,14 @@ +<domain type='vmware'> + <name>cdrom-scsi-device</name> + <uuid>564d9bef-acd9-b4e0-c8f0-aea8b9103515</uuid> + <memory>4096</memory> + <os> + <type>hvm</type> + </os> + <devices> + <disk type='block' device='cdrom'> + <source dev='/dev/scd0'/> + <target dev='sda' bus='scsi'/> + </disk> + </devices> +</domain> diff --git a/tests/xml2vmxdata/xml2vmx-cdrom-scsi-file.vmx b/tests/xml2vmxdata/xml2vmx-cdrom-scsi-file.vmx new file mode 100644 index 0000000..29f2d41 --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-cdrom-scsi-file.vmx @@ -0,0 +1,11 @@ +config.version = "8" +virtualHW.version = "4" +guestOS = "other" +uuid.bios = "56 4d 9b ef ac d9 b4 e0-c8 f0 ae a8 b9 10 35 15" +displayName = "cdrom-scsi-file" +memsize = "4" +numvcpus = "1" +scsi0.present = "true" +scsi0:0.present = "true" +scsi0:0.deviceType = "cdrom-image" +scsi0:0.fileName = "cdrom.iso" diff --git a/tests/xml2vmxdata/xml2vmx-cdrom-scsi-file.xml b/tests/xml2vmxdata/xml2vmx-cdrom-scsi-file.xml new file mode 100644 index 0000000..0f21dcf --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-cdrom-scsi-file.xml @@ -0,0 +1,14 @@ +<domain type='vmware'> + <name>cdrom-scsi-file</name> + <uuid>564d9bef-acd9-b4e0-c8f0-aea8b9103515</uuid> + <memory>4096</memory> + <os> + <type>hvm</type> + </os> + <devices> + <disk type='file' device='cdrom'> + <source file='cdrom.iso'/> + <target dev='sda' bus='scsi'/> + </disk> + </devices> +</domain> diff --git a/tests/xml2vmxdata/xml2vmx-esx-in-the-wild-1.vmx b/tests/xml2vmxdata/xml2vmx-esx-in-the-wild-1.vmx new file mode 100644 index 0000000..b9a18ef --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-esx-in-the-wild-1.vmx @@ -0,0 +1,17 @@ +config.version = "8" +virtualHW.version = "4" +guestOS = "other" +uuid.bios = "50 11 5e 16 9b dc 49 d7-f1 71 53 c4 d7 f9 17 10" +displayName = "Fedora11" +memsize = "1024" +numvcpus = "1" +scsi0.present = "true" +scsi0.virtualDev = "lsilogic" +scsi0:0.present = "true" +scsi0:0.deviceType = "scsi-hardDisk" +scsi0:0.fileName = "Fedora11.vmdk" +ethernet0.present = "true" +ethernet0.networkName = "VM Network" +ethernet0.connectionType = "bridged" +ethernet0.addressType = "static" +ethernet0.address = "00:50:56:91:48:C7" diff --git a/tests/xml2vmxdata/xml2vmx-esx-in-the-wild-1.xml b/tests/xml2vmxdata/xml2vmx-esx-in-the-wild-1.xml new file mode 100644 index 0000000..eb0e9ef --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-esx-in-the-wild-1.xml @@ -0,0 +1,25 @@ +<domain type='vmware'> + <name>Fedora11</name> + <uuid>50115e16-9bdc-49d7-f171-53c4d7f91710</uuid> + <memory>1048576</memory> + <currentMemory>1048576</currentMemory> + <vcpu>1</vcpu> + <os> + <type>hvm</type> + </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'> + <driver name='lsilogic'/> + <source file='Fedora11.vmdk'/> + <target dev='sda' bus='scsi'/> + </disk> + <interface type='bridge'> + <mac address='00:50:56:91:48:c7'/> + <source bridge='VM Network'/> + </interface> + </devices> +</domain> diff --git a/tests/xml2vmxdata/xml2vmx-esx-in-the-wild-2.vmx b/tests/xml2vmxdata/xml2vmx-esx-in-the-wild-2.vmx new file mode 100644 index 0000000..43714c1 --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-esx-in-the-wild-2.vmx @@ -0,0 +1,38 @@ +config.version = "8" +virtualHW.version = "4" +guestOS = "other-64" +uuid.bios = "56 4d cd 37 36 85 88 89-35 ea 71 9f c9 3c 98 3e" +displayName = "virtDebian1" +memsize = "1000" +sched.mem.max = "118" +numvcpus = "4" +sched.cpu.affinity = "0,1,2,5,6,7" +scsi0.present = "true" +scsi0.virtualDev = "lsilogic" +scsi1.present = "true" +scsi1.virtualDev = "buslogic" +scsi0:0.present = "true" +scsi0:0.deviceType = "scsi-hardDisk" +scsi0:0.fileName = "Debian1.vmdk" +scsi0:0.writeThrough = "true" +scsi1:0.present = "true" +scsi1:0.deviceType = "cdrom-image" +scsi1:0.fileName = "Debian1-cdrom.iso" +ide0:0.present = "true" +ide0:0.deviceType = "cdrom-image" +ide0:0.fileName = "/vmimages/tools-isoimages/linux.iso" +ide0:1.present = "true" +ide0:1.deviceType = "atapi-cdrom" +ide0:1.fileName = "/dev/scd0" +ide1:1.present = "true" +ide1:1.deviceType = "ata-hardDisk" +ide1:1.fileName = "Debian1-IDE.vmdk" +floppy0.present = "true" +floppy0.fileType = "device" +floppy0.fileName = "/dev/fd0" +ethernet0.present = "true" +ethernet0.virtualDev = "vlance" +ethernet0.networkName = "VM Network" +ethernet0.connectionType = "bridged" +ethernet0.addressType = "generated" +ethernet0.generatedAddress = "00:0C:29:3C:98:3E" diff --git a/tests/xml2vmxdata/xml2vmx-esx-in-the-wild-2.xml b/tests/xml2vmxdata/xml2vmx-esx-in-the-wild-2.xml new file mode 100644 index 0000000..62e8bb4 --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-esx-in-the-wild-2.xml @@ -0,0 +1,47 @@ +<domain type='vmware'> + <name>virtDebian1</name> + <uuid>564dcd37-3685-8889-35ea-719fc93c983e</uuid> + <memory>1024000</memory> + <currentMemory>120832</currentMemory> + <vcpu cpuset='0-2,5-7'>4</vcpu> + <os> + <type arch='x86_64'>hvm</type> + </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'> + <driver name='lsilogic' cache='writethrough'/> + <source file='Debian1.vmdk'/> + <target dev='sda' bus='scsi'/> + </disk> + <disk type='file' device='cdrom'> + <driver name='buslogic'/> + <source file='Debian1-cdrom.iso'/> + <target dev='sdp' bus='scsi'/> + </disk> + <disk type='file' device='cdrom'> + <source file='/vmimages/tools-isoimages/linux.iso'/> + <target dev='hda' bus='ide'/> + </disk> + <disk type='block' device='cdrom'> + <source dev='/dev/scd0'/> + <target dev='hdb' bus='ide'/> + </disk> + <disk type='file' device='disk'> + <source file='Debian1-IDE.vmdk'/> + <target dev='hdd' bus='ide'/> + </disk> + <disk type='block' device='floppy'> + <source dev='/dev/fd0'/> + <target dev='fda' bus='fdc'/> + </disk> + <interface type='bridge'> + <mac address='00:0c:29:3c:98:3e'/> + <source bridge='VM Network'/> + <model type='vlance'/> + </interface> + </devices> +</domain> diff --git a/tests/xml2vmxdata/xml2vmx-esx-in-the-wild-3.vmx b/tests/xml2vmxdata/xml2vmx-esx-in-the-wild-3.vmx new file mode 100644 index 0000000..c0bc514 --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-esx-in-the-wild-3.vmx @@ -0,0 +1,24 @@ +config.version = "8" +virtualHW.version = "4" +guestOS = "other-64" +uuid.bios = "56 4d b7 68 f3 32 42 ee-62 01 06 97 3c f5 c3 0c" +displayName = "virtDebian2" +memsize = "1024" +numvcpus = "2" +sched.cpu.affinity = "0,3,4,5" +scsi0.present = "true" +scsi0.virtualDev = "lsilogic" +scsi0:0.present = "true" +scsi0:0.deviceType = "scsi-hardDisk" +scsi0:0.fileName = "Debian2.vmdk" +ide0:0.present = "true" +ide0:0.deviceType = "cdrom-image" +ide0:0.fileName = "/vmfs/volumes/498076b2-02796c1a-ef5b-000ae484a6a3/Isos/debian-testing-amd64-netinst.iso" +floppy1.present = "true" +floppy1.fileType = "file" +floppy1.fileName = "/vmfs/volumes/498076b2-02796c1a-ef5b-000ae484a6a3/Debian2/dummy.flp" +ethernet0.present = "true" +ethernet0.networkName = "VM Network" +ethernet0.connectionType = "bridged" +ethernet0.addressType = "generated" +ethernet0.generatedAddress = "00:0C:29:F5:C3:0C" diff --git a/tests/xml2vmxdata/xml2vmx-esx-in-the-wild-3.xml b/tests/xml2vmxdata/xml2vmx-esx-in-the-wild-3.xml new file mode 100644 index 0000000..3f85cb4 --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-esx-in-the-wild-3.xml @@ -0,0 +1,33 @@ +<domain type='vmware'> + <name>virtDebian2</name> + <uuid>564db768-f332-42ee-6201-06973cf5c30c</uuid> + <memory>1048576</memory> + <currentMemory>1048576</currentMemory> + <vcpu cpuset='0,3-5'>2</vcpu> + <os> + <type arch='x86_64'>hvm</type> + </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'> + <driver name='lsilogic'/> + <source file='Debian2.vmdk'/> + <target dev='sda' bus='scsi'/> + </disk> + <disk type='file' device='cdrom'> + <source file='/vmfs/volumes/498076b2-02796c1a-ef5b-000ae484a6a3/Isos/debian-testing-amd64-netinst.iso'/> + <target dev='hda' bus='ide'/> + </disk> + <disk type='file' device='floppy'> + <source file='/vmfs/volumes/498076b2-02796c1a-ef5b-000ae484a6a3/Debian2/dummy.flp'/> + <target dev='fdb' bus='fdc'/> + </disk> + <interface type='bridge'> + <mac address='00:0c:29:f5:c3:0c'/> + <source bridge='VM Network'/> + </interface> + </devices> +</domain> diff --git a/tests/xml2vmxdata/xml2vmx-esx-in-the-wild-4.vmx b/tests/xml2vmxdata/xml2vmx-esx-in-the-wild-4.vmx new file mode 100644 index 0000000..8685bae --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-esx-in-the-wild-4.vmx @@ -0,0 +1,29 @@ +config.version = "8" +virtualHW.version = "4" +guestOS = "other" +uuid.bios = "56 4d 9b ef ac d9 b4 e0-c8 f0 ae a8 b9 10 35 15" +displayName = "virtMonServ1" +memsize = "512" +numvcpus = "1" +scsi0.present = "true" +scsi0.virtualDev = "lsilogic" +scsi0:0.present = "true" +scsi0:0.deviceType = "scsi-hardDisk" +scsi0:0.fileName = "virtMonServ1.vmdk" +ethernet0.present = "true" +ethernet0.networkName = "VM Network" +ethernet0.connectionType = "bridged" +ethernet0.addressType = "static" +ethernet0.address = "00:50:56:91:66:D4" +ethernet1.present = "true" +ethernet1.networkName = "VM Switch 2" +ethernet1.connectionType = "bridged" +ethernet1.addressType = "static" +ethernet1.address = "00:50:56:91:0C:51" +serial0.present = "true" +serial0.fileType = "file" +serial0.fileName = "/vmfs/volumes/498076b2-02796c1a-ef5b-000ae484a6a3/virtMonServ1/serial1.file" +serial0.yieldOnMsrRead = "true" +parallel0.present = "true" +parallel0.fileType = "file" +parallel0.fileName = "/vmfs/volumes/498076b2-02796c1a-ef5b-000ae484a6a3/virtMonServ1/parallel1.file" diff --git a/tests/xml2vmxdata/xml2vmx-esx-in-the-wild-4.xml b/tests/xml2vmxdata/xml2vmx-esx-in-the-wild-4.xml new file mode 100644 index 0000000..2b3ed93 --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-esx-in-the-wild-4.xml @@ -0,0 +1,41 @@ +<domain type='vmware'> + <name>virtMonServ1</name> + <uuid>564d9bef-acd9-b4e0-c8f0-aea8b9103515</uuid> + <memory>524288</memory> + <currentMemory>524288</currentMemory> + <vcpu>1</vcpu> + <os> + <type>hvm</type> + </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'> + <driver name='lsilogic'/> + <source file='virtMonServ1.vmdk'/> + <target dev='sda' bus='scsi'/> + </disk> + <interface type='bridge'> + <mac address='00:50:56:91:66:d4'/> + <source bridge='VM Network'/> + </interface> + <interface type='bridge'> + <mac address='00:50:56:91:0c:51'/> + <source bridge='VM Switch 2'/> + </interface> + <serial type='file'> + <source path='/vmfs/volumes/498076b2-02796c1a-ef5b-000ae484a6a3/virtMonServ1/serial1.file'/> + <target port='0'/> + </serial> + <parallel type='file'> + <source path='/vmfs/volumes/498076b2-02796c1a-ef5b-000ae484a6a3/virtMonServ1/parallel1.file'/> + <target port='0'/> + </parallel> + <console type='file'> + <source path='/vmfs/volumes/498076b2-02796c1a-ef5b-000ae484a6a3/virtMonServ1/serial1.file'/> + <target port='0'/> + </console> + </devices> +</domain> diff --git a/tests/xml2vmxdata/xml2vmx-ethernet-bridged.vmx b/tests/xml2vmxdata/xml2vmx-ethernet-bridged.vmx new file mode 100644 index 0000000..7d9c6f7 --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-ethernet-bridged.vmx @@ -0,0 +1,12 @@ +config.version = "8" +virtualHW.version = "4" +guestOS = "other" +uuid.bios = "56 4d 9b ef ac d9 b4 e0-c8 f0 ae a8 b9 10 35 15" +displayName = "ethernet-bridged" +memsize = "4" +numvcpus = "1" +ethernet0.present = "true" +ethernet0.networkName = "VM Network" +ethernet0.connectionType = "bridged" +ethernet0.addressType = "static" +ethernet0.address = "00:50:56:11:22:33" diff --git a/tests/xml2vmxdata/xml2vmx-ethernet-bridged.xml b/tests/xml2vmxdata/xml2vmx-ethernet-bridged.xml new file mode 100644 index 0000000..12a8788 --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-ethernet-bridged.xml @@ -0,0 +1,14 @@ +<domain type='vmware'> + <name>ethernet-bridged</name> + <uuid>564d9bef-acd9-b4e0-c8f0-aea8b9103515</uuid> + <memory>4096</memory> + <os> + <type>hvm</type> + </os> + <devices> + <interface type='bridge'> + <mac address='00:50:56:11:22:33'/> + <source bridge='VM Network'/> + </interface> + </devices> +</domain> diff --git a/tests/xml2vmxdata/xml2vmx-ethernet-custom.vmx b/tests/xml2vmxdata/xml2vmx-ethernet-custom.vmx new file mode 100644 index 0000000..fb4b116 --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-ethernet-custom.vmx @@ -0,0 +1,13 @@ +config.version = "8" +virtualHW.version = "4" +guestOS = "other" +uuid.bios = "56 4d 9b ef ac d9 b4 e0-c8 f0 ae a8 b9 10 35 15" +displayName = "ethernet-custom" +memsize = "4" +numvcpus = "1" +ethernet0.present = "true" +ethernet0.networkName = "VM Network" +ethernet0.connectionType = "custom" +ethernet0.vnet = "vmnet7" +ethernet0.addressType = "static" +ethernet0.address = "00:50:56:11:22:33" diff --git a/tests/xml2vmxdata/xml2vmx-ethernet-custom.xml b/tests/xml2vmxdata/xml2vmx-ethernet-custom.xml new file mode 100644 index 0000000..cd1d88f --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-ethernet-custom.xml @@ -0,0 +1,15 @@ +<domain type='vmware'> + <name>ethernet-custom</name> + <uuid>564d9bef-acd9-b4e0-c8f0-aea8b9103515</uuid> + <memory>4096</memory> + <os> + <type>hvm</type> + </os> + <devices> + <interface type='bridge'> + <mac address='00:50:56:11:22:33'/> + <source bridge='VM Network'/> + <target dev='vmnet7'/> + </interface> + </devices> +</domain> diff --git a/tests/xml2vmxdata/xml2vmx-ethernet-e1000.vmx b/tests/xml2vmxdata/xml2vmx-ethernet-e1000.vmx new file mode 100644 index 0000000..3aed46c --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-ethernet-e1000.vmx @@ -0,0 +1,13 @@ +config.version = "8" +virtualHW.version = "4" +guestOS = "other" +uuid.bios = "56 4d 9b ef ac d9 b4 e0-c8 f0 ae a8 b9 10 35 15" +displayName = "ethernet-e1000" +memsize = "4" +numvcpus = "1" +ethernet0.present = "true" +ethernet0.virtualDev = "e1000" +ethernet0.networkName = "VM Network" +ethernet0.connectionType = "bridged" +ethernet0.addressType = "static" +ethernet0.address = "00:50:56:11:22:33" diff --git a/tests/xml2vmxdata/xml2vmx-ethernet-e1000.xml b/tests/xml2vmxdata/xml2vmx-ethernet-e1000.xml new file mode 100644 index 0000000..7e95363 --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-ethernet-e1000.xml @@ -0,0 +1,15 @@ +<domain type='vmware'> + <name>ethernet-e1000</name> + <uuid>564d9bef-acd9-b4e0-c8f0-aea8b9103515</uuid> + <memory>4096</memory> + <os> + <type>hvm</type> + </os> + <devices> + <interface type='bridge'> + <mac address='00:50:56:11:22:33'/> + <source bridge='VM Network'/> + <model type='e1000'/> + </interface> + </devices> +</domain> diff --git a/tests/xml2vmxdata/xml2vmx-floppy-device.vmx b/tests/xml2vmxdata/xml2vmx-floppy-device.vmx new file mode 100644 index 0000000..465501b --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-floppy-device.vmx @@ -0,0 +1,10 @@ +config.version = "8" +virtualHW.version = "4" +guestOS = "other" +uuid.bios = "56 4d 9b ef ac d9 b4 e0-c8 f0 ae a8 b9 10 35 15" +displayName = "floppy-device" +memsize = "4" +numvcpus = "1" +floppy0.present = "true" +floppy0.fileType = "device" +floppy0.fileName = "/dev/fd0" diff --git a/tests/xml2vmxdata/xml2vmx-floppy-device.xml b/tests/xml2vmxdata/xml2vmx-floppy-device.xml new file mode 100644 index 0000000..91bac26 --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-floppy-device.xml @@ -0,0 +1,14 @@ +<domain type='vmware'> + <name>floppy-device</name> + <uuid>564d9bef-acd9-b4e0-c8f0-aea8b9103515</uuid> + <memory>4096</memory> + <os> + <type>hvm</type> + </os> + <devices> + <disk type='block' device='floppy'> + <source dev='/dev/fd0'/> + <target dev='fda' bus='fdc'/> + </disk> + </devices> +</domain> diff --git a/tests/xml2vmxdata/xml2vmx-floppy-file.vmx b/tests/xml2vmxdata/xml2vmx-floppy-file.vmx new file mode 100644 index 0000000..e332239 --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-floppy-file.vmx @@ -0,0 +1,10 @@ +config.version = "8" +virtualHW.version = "4" +guestOS = "other" +uuid.bios = "56 4d 9b ef ac d9 b4 e0-c8 f0 ae a8 b9 10 35 15" +displayName = "floppy-file" +memsize = "4" +numvcpus = "1" +floppy0.present = "true" +floppy0.fileType = "file" +floppy0.fileName = "floppy.flp" diff --git a/tests/xml2vmxdata/xml2vmx-floppy-file.xml b/tests/xml2vmxdata/xml2vmx-floppy-file.xml new file mode 100644 index 0000000..a069fda --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-floppy-file.xml @@ -0,0 +1,14 @@ +<domain type='vmware'> + <name>floppy-file</name> + <uuid>564d9bef-acd9-b4e0-c8f0-aea8b9103515</uuid> + <memory>4096</memory> + <os> + <type>hvm</type> + </os> + <devices> + <disk type='file' device='floppy'> + <source file='floppy.flp'/> + <target dev='fda' bus='fdc'/> + </disk> + </devices> +</domain> diff --git a/tests/xml2vmxdata/xml2vmx-gsx-in-the-wild-1.vmx b/tests/xml2vmxdata/xml2vmx-gsx-in-the-wild-1.vmx new file mode 100644 index 0000000..a018d4f --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-gsx-in-the-wild-1.vmx @@ -0,0 +1,16 @@ +config.version = "8" +virtualHW.version = "4" +guestOS = "other" +uuid.bios = "56 4d 12 23 f8 35 c4 b1-bb f6 e3 23 90 d6 2b d3" +displayName = "Server1" +memsize = "32" +numvcpus = "1" +ide0:0.present = "true" +ide0:0.deviceType = "ata-hardDisk" +ide0:0.fileName = "Debian-System1-0-cl2.vmdk" +ethernet0.present = "true" +ethernet0.networkName = "net1" +ethernet0.connectionType = "custom" +ethernet0.vnet = "/dev/vmnet1" +ethernet0.addressType = "generated" +ethernet0.generatedAddress = "00:0C:29:D6:2B:D3" diff --git a/tests/xml2vmxdata/xml2vmx-gsx-in-the-wild-1.xml b/tests/xml2vmxdata/xml2vmx-gsx-in-the-wild-1.xml new file mode 100644 index 0000000..d2bc964 --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-gsx-in-the-wild-1.xml @@ -0,0 +1,25 @@ +<domain type='vmware'> + <name>Server1</name> + <uuid>564d1223-f835-c4b1-bbf6-e32390d62bd3</uuid> + <memory>32768</memory> + <currentMemory>32768</currentMemory> + <vcpu>1</vcpu> + <os> + <type>hvm</type> + </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='Debian-System1-0-cl2.vmdk'/> + <target dev='hda' bus='ide'/> + </disk> + <interface type='bridge'> + <mac address='00:0c:29:d6:2b:d3'/> + <source bridge='net1'/> + <target dev='/dev/vmnet1'/> + </interface> + </devices> +</domain> diff --git a/tests/xml2vmxdata/xml2vmx-gsx-in-the-wild-2.vmx b/tests/xml2vmxdata/xml2vmx-gsx-in-the-wild-2.vmx new file mode 100644 index 0000000..5c248a7 --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-gsx-in-the-wild-2.vmx @@ -0,0 +1,16 @@ +config.version = "8" +virtualHW.version = "4" +guestOS = "other" +uuid.bios = "56 4d 33 01 26 7f a0 ef-8b 7d d4 5e 98 d6 cb a4" +displayName = "Server2" +memsize = "32" +numvcpus = "1" +ide0:0.present = "true" +ide0:0.deviceType = "ata-hardDisk" +ide0:0.fileName = "Debian-System1-0-cl3.vmdk" +ethernet0.present = "true" +ethernet0.networkName = "net1" +ethernet0.connectionType = "custom" +ethernet0.vnet = "/dev/vmnet1" +ethernet0.addressType = "generated" +ethernet0.generatedAddress = "00:0C:29:D6:CB:A4" diff --git a/tests/xml2vmxdata/xml2vmx-gsx-in-the-wild-2.xml b/tests/xml2vmxdata/xml2vmx-gsx-in-the-wild-2.xml new file mode 100644 index 0000000..1e1bab8 --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-gsx-in-the-wild-2.xml @@ -0,0 +1,25 @@ +<domain type='vmware'> + <name>Server2</name> + <uuid>564d3301-267f-a0ef-8b7d-d45e98d6cba4</uuid> + <memory>32768</memory> + <currentMemory>32768</currentMemory> + <vcpu>1</vcpu> + <os> + <type>hvm</type> + </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='Debian-System1-0-cl3.vmdk'/> + <target dev='hda' bus='ide'/> + </disk> + <interface type='bridge'> + <mac address='00:0c:29:d6:cb:a4'/> + <source bridge='net1'/> + <target dev='/dev/vmnet1'/> + </interface> + </devices> +</domain> diff --git a/tests/xml2vmxdata/xml2vmx-gsx-in-the-wild-3.vmx b/tests/xml2vmxdata/xml2vmx-gsx-in-the-wild-3.vmx new file mode 100644 index 0000000..865ebfc --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-gsx-in-the-wild-3.vmx @@ -0,0 +1,22 @@ +config.version = "8" +virtualHW.version = "4" +guestOS = "other" +uuid.bios = "56 4d de be e8 6f d5 86-08 54 a0 87 9c c4 be 5a" +displayName = "Router" +memsize = "32" +numvcpus = "1" +ide0:0.present = "true" +ide0:0.deviceType = "ata-hardDisk" +ide0:0.fileName = "Debian-System1-0-cl1.vmdk" +ethernet0.present = "true" +ethernet0.networkName = "net1" +ethernet0.connectionType = "custom" +ethernet0.vnet = "/dev/vmnet1" +ethernet0.addressType = "generated" +ethernet0.generatedAddress = "00:0C:29:C4:BE:5A" +ethernet1.present = "true" +ethernet1.networkName = "net2" +ethernet1.connectionType = "custom" +ethernet1.vnet = "/dev/vmnet2" +ethernet1.addressType = "generated" +ethernet1.generatedAddress = "00:0C:29:C4:BE:64" diff --git a/tests/xml2vmxdata/xml2vmx-gsx-in-the-wild-3.xml b/tests/xml2vmxdata/xml2vmx-gsx-in-the-wild-3.xml new file mode 100644 index 0000000..93ca754 --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-gsx-in-the-wild-3.xml @@ -0,0 +1,30 @@ +<domain type='vmware'> + <name>Router</name> + <uuid>564ddebe-e86f-d586-0854-a0879cc4be5a</uuid> + <memory>32768</memory> + <currentMemory>32768</currentMemory> + <vcpu>1</vcpu> + <os> + <type>hvm</type> + </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='Debian-System1-0-cl1.vmdk'/> + <target dev='hda' bus='ide'/> + </disk> + <interface type='bridge'> + <mac address='00:0c:29:c4:be:5a'/> + <source bridge='net1'/> + <target dev='/dev/vmnet1'/> + </interface> + <interface type='bridge'> + <mac address='00:0c:29:c4:be:64'/> + <source bridge='net2'/> + <target dev='/dev/vmnet2'/> + </interface> + </devices> +</domain> diff --git a/tests/xml2vmxdata/xml2vmx-gsx-in-the-wild-4.vmx b/tests/xml2vmxdata/xml2vmx-gsx-in-the-wild-4.vmx new file mode 100644 index 0000000..947154c --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-gsx-in-the-wild-4.vmx @@ -0,0 +1,16 @@ +config.version = "8" +virtualHW.version = "4" +guestOS = "other" +uuid.bios = "56 4d ad 58 06 29 d3 e6-ec fe 8f f8 39 c5 e3 5d" +displayName = "Client" +memsize = "264" +numvcpus = "1" +ide0:0.present = "true" +ide0:0.deviceType = "ata-hardDisk" +ide0:0.fileName = "Debian-System1-0-cl2.vmdk" +ethernet0.present = "true" +ethernet0.networkName = "net2" +ethernet0.connectionType = "custom" +ethernet0.vnet = "/dev/vmnet2" +ethernet0.addressType = "generated" +ethernet0.generatedAddress = "00:0C:29:C5:E3:5D" diff --git a/tests/xml2vmxdata/xml2vmx-gsx-in-the-wild-4.xml b/tests/xml2vmxdata/xml2vmx-gsx-in-the-wild-4.xml new file mode 100644 index 0000000..9903883 --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-gsx-in-the-wild-4.xml @@ -0,0 +1,25 @@ +<domain type='vmware'> + <name>Client</name> + <uuid>564dad58-0629-d3e6-ecfe-8ff839c5e35d</uuid> + <memory>270336</memory> + <currentMemory>270336</currentMemory> + <vcpu>1</vcpu> + <os> + <type>hvm</type> + </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='Debian-System1-0-cl2.vmdk'/> + <target dev='hda' bus='ide'/> + </disk> + <interface type='bridge'> + <mac address='00:0c:29:c5:e3:5d'/> + <source bridge='net2'/> + <target dev='/dev/vmnet2'/> + </interface> + </devices> +</domain> diff --git a/tests/xml2vmxdata/xml2vmx-harddisk-ide-file.vmx b/tests/xml2vmxdata/xml2vmx-harddisk-ide-file.vmx new file mode 100644 index 0000000..2ce1b12 --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-harddisk-ide-file.vmx @@ -0,0 +1,10 @@ +config.version = "8" +virtualHW.version = "4" +guestOS = "other" +uuid.bios = "56 4d 9b ef ac d9 b4 e0-c8 f0 ae a8 b9 10 35 15" +displayName = "harddisk-ide-file" +memsize = "4" +numvcpus = "1" +ide0:0.present = "true" +ide0:0.deviceType = "ata-hardDisk" +ide0:0.fileName = "harddisk.vmdk" diff --git a/tests/xml2vmxdata/xml2vmx-harddisk-ide-file.xml b/tests/xml2vmxdata/xml2vmx-harddisk-ide-file.xml new file mode 100644 index 0000000..147a7e2 --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-harddisk-ide-file.xml @@ -0,0 +1,14 @@ +<domain type='vmware'> + <name>harddisk-ide-file</name> + <uuid>564d9bef-acd9-b4e0-c8f0-aea8b9103515</uuid> + <memory>4096</memory> + <os> + <type>hvm</type> + </os> + <devices> + <disk type='file' device='disk'> + <source file='harddisk.vmdk'/> + <target dev='hda' bus='ide'/> + </disk> + </devices> +</domain> diff --git a/tests/xml2vmxdata/xml2vmx-harddisk-scsi-file.vmx b/tests/xml2vmxdata/xml2vmx-harddisk-scsi-file.vmx new file mode 100644 index 0000000..38ca686 --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-harddisk-scsi-file.vmx @@ -0,0 +1,11 @@ +config.version = "8" +virtualHW.version = "4" +guestOS = "other" +uuid.bios = "56 4d 9b ef ac d9 b4 e0-c8 f0 ae a8 b9 10 35 15" +displayName = "harddisk-scsi-file" +memsize = "4" +numvcpus = "1" +scsi0.present = "true" +scsi0:0.present = "true" +scsi0:0.deviceType = "scsi-hardDisk" +scsi0:0.fileName = "harddisk.vmdk" diff --git a/tests/xml2vmxdata/xml2vmx-harddisk-scsi-file.xml b/tests/xml2vmxdata/xml2vmx-harddisk-scsi-file.xml new file mode 100644 index 0000000..38eb26d --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-harddisk-scsi-file.xml @@ -0,0 +1,14 @@ +<domain type='vmware'> + <name>harddisk-scsi-file</name> + <uuid>564d9bef-acd9-b4e0-c8f0-aea8b9103515</uuid> + <memory>4096</memory> + <os> + <type>hvm</type> + </os> + <devices> + <disk type='file' device='disk'> + <source file='harddisk.vmdk'/> + <target dev='sda' bus='scsi'/> + </disk> + </devices> +</domain> diff --git a/tests/xml2vmxdata/xml2vmx-minimal-64bit.vmx b/tests/xml2vmxdata/xml2vmx-minimal-64bit.vmx new file mode 100644 index 0000000..87de002 --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-minimal-64bit.vmx @@ -0,0 +1,7 @@ +config.version = "8" +virtualHW.version = "4" +guestOS = "other-64" +uuid.bios = "56 4d 9b ef ac d9 b4 e0-c8 f0 ae a8 b9 10 35 15" +displayName = "minimal-64bit" +memsize = "4" +numvcpus = "1" diff --git a/tests/xml2vmxdata/xml2vmx-minimal-64bit.xml b/tests/xml2vmxdata/xml2vmx-minimal-64bit.xml new file mode 100644 index 0000000..42ef4ca --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-minimal-64bit.xml @@ -0,0 +1,8 @@ +<domain type='vmware'> + <name>minimal-64bit</name> + <uuid>564d9bef-acd9-b4e0-c8f0-aea8b9103515</uuid> + <memory>4096</memory> + <os> + <type arch='x86_64'>hvm</type> + </os> +</domain> diff --git a/tests/xml2vmxdata/xml2vmx-minimal.vmx b/tests/xml2vmxdata/xml2vmx-minimal.vmx new file mode 100644 index 0000000..08cc83f --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-minimal.vmx @@ -0,0 +1,7 @@ +config.version = "8" +virtualHW.version = "4" +guestOS = "other" +uuid.bios = "56 4d 9b ef ac d9 b4 e0-c8 f0 ae a8 b9 10 35 15" +displayName = "minimal" +memsize = "4" +numvcpus = "1" diff --git a/tests/xml2vmxdata/xml2vmx-minimal.xml b/tests/xml2vmxdata/xml2vmx-minimal.xml new file mode 100644 index 0000000..8e4e988 --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-minimal.xml @@ -0,0 +1,8 @@ +<domain type='vmware'> + <name>minimal</name> + <uuid>564d9bef-acd9-b4e0-c8f0-aea8b9103515</uuid> + <memory>4096</memory> + <os> + <type>hvm</type> + </os> +</domain> diff --git a/tests/xml2vmxdata/xml2vmx-parallel-device.vmx b/tests/xml2vmxdata/xml2vmx-parallel-device.vmx new file mode 100644 index 0000000..9294279 --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-parallel-device.vmx @@ -0,0 +1,10 @@ +config.version = "8" +virtualHW.version = "4" +guestOS = "other" +uuid.bios = "56 4d 9b ef ac d9 b4 e0-c8 f0 ae a8 b9 10 35 15" +displayName = "parallel-device" +memsize = "4" +numvcpus = "1" +parallel0.present = "true" +parallel0.fileType = "device" +parallel0.fileName = "/dev/parallel0" diff --git a/tests/xml2vmxdata/xml2vmx-parallel-device.xml b/tests/xml2vmxdata/xml2vmx-parallel-device.xml new file mode 100644 index 0000000..2ddfb35 --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-parallel-device.xml @@ -0,0 +1,14 @@ +<domain type='vmware'> + <name>parallel-device</name> + <uuid>564d9bef-acd9-b4e0-c8f0-aea8b9103515</uuid> + <memory>4096</memory> + <os> + <type>hvm</type> + </os> + <devices> + <parallel type='dev'> + <source path='/dev/parallel0'/> + <target port='0'/> + </parallel> + </devices> +</domain> diff --git a/tests/xml2vmxdata/xml2vmx-parallel-file.vmx b/tests/xml2vmxdata/xml2vmx-parallel-file.vmx new file mode 100644 index 0000000..4f42d26 --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-parallel-file.vmx @@ -0,0 +1,10 @@ +config.version = "8" +virtualHW.version = "4" +guestOS = "other" +uuid.bios = "56 4d 9b ef ac d9 b4 e0-c8 f0 ae a8 b9 10 35 15" +displayName = "parallel-file" +memsize = "4" +numvcpus = "1" +parallel0.present = "true" +parallel0.fileType = "file" +parallel0.fileName = "parallel0.file" diff --git a/tests/xml2vmxdata/xml2vmx-parallel-file.xml b/tests/xml2vmxdata/xml2vmx-parallel-file.xml new file mode 100644 index 0000000..2c81ced --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-parallel-file.xml @@ -0,0 +1,14 @@ +<domain type='vmware'> + <name>parallel-file</name> + <uuid>564d9bef-acd9-b4e0-c8f0-aea8b9103515</uuid> + <memory>4096</memory> + <os> + <type>hvm</type> + </os> + <devices> + <parallel type='file'> + <source path='parallel0.file'/> + <target port='0'/> + </parallel> + </devices> +</domain> diff --git a/tests/xml2vmxdata/xml2vmx-scsi-buslogic.vmx b/tests/xml2vmxdata/xml2vmx-scsi-buslogic.vmx new file mode 100644 index 0000000..de5da89 --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-scsi-buslogic.vmx @@ -0,0 +1,12 @@ +config.version = "8" +virtualHW.version = "4" +guestOS = "other" +uuid.bios = "56 4d 9b ef ac d9 b4 e0-c8 f0 ae a8 b9 10 35 15" +displayName = "scsi-buslogic" +memsize = "4" +numvcpus = "1" +scsi0.present = "true" +scsi0.virtualDev = "buslogic" +scsi0:0.present = "true" +scsi0:0.deviceType = "scsi-hardDisk" +scsi0:0.fileName = "harddisk.vmdk" diff --git a/tests/xml2vmxdata/xml2vmx-scsi-buslogic.xml b/tests/xml2vmxdata/xml2vmx-scsi-buslogic.xml new file mode 100644 index 0000000..cd72df1 --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-scsi-buslogic.xml @@ -0,0 +1,15 @@ +<domain type='vmware'> + <name>scsi-buslogic</name> + <uuid>564d9bef-acd9-b4e0-c8f0-aea8b9103515</uuid> + <memory>4096</memory> + <os> + <type>hvm</type> + </os> + <devices> + <disk type='file' device='disk'> + <driver name='buslogic'/> + <source file='harddisk.vmdk'/> + <target dev='sda' bus='scsi'/> + </disk> + </devices> +</domain> diff --git a/tests/xml2vmxdata/xml2vmx-scsi-writethrough.vmx b/tests/xml2vmxdata/xml2vmx-scsi-writethrough.vmx new file mode 100644 index 0000000..feb577b --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-scsi-writethrough.vmx @@ -0,0 +1,13 @@ +config.version = "8" +virtualHW.version = "4" +guestOS = "other" +uuid.bios = "56 4d 9b ef ac d9 b4 e0-c8 f0 ae a8 b9 10 35 15" +displayName = "scsi-writethrough" +memsize = "4" +numvcpus = "1" +scsi0.present = "true" +scsi0.virtualDev = "buslogic" +scsi0:0.present = "true" +scsi0:0.deviceType = "scsi-hardDisk" +scsi0:0.fileName = "harddisk.vmdk" +scsi0:0.writeThrough = "true" diff --git a/tests/xml2vmxdata/xml2vmx-scsi-writethrough.xml b/tests/xml2vmxdata/xml2vmx-scsi-writethrough.xml new file mode 100644 index 0000000..90a7719 --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-scsi-writethrough.xml @@ -0,0 +1,15 @@ +<domain type='vmware'> + <name>scsi-writethrough</name> + <uuid>564d9bef-acd9-b4e0-c8f0-aea8b9103515</uuid> + <memory>4096</memory> + <os> + <type>hvm</type> + </os> + <devices> + <disk type='file' device='disk'> + <driver name='buslogic' cache='writethrough'/> + <source file='harddisk.vmdk'/> + <target dev='sda' bus='scsi'/> + </disk> + </devices> +</domain> diff --git a/tests/xml2vmxdata/xml2vmx-serial-device.vmx b/tests/xml2vmxdata/xml2vmx-serial-device.vmx new file mode 100644 index 0000000..32cb175 --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-serial-device.vmx @@ -0,0 +1,11 @@ +config.version = "8" +virtualHW.version = "4" +guestOS = "other" +uuid.bios = "56 4d 9b ef ac d9 b4 e0-c8 f0 ae a8 b9 10 35 15" +displayName = "serial-device" +memsize = "4" +numvcpus = "1" +serial0.present = "true" +serial0.fileType = "device" +serial0.fileName = "/dev/ttyS0" +serial0.yieldOnMsrRead = "true" diff --git a/tests/xml2vmxdata/xml2vmx-serial-device.xml b/tests/xml2vmxdata/xml2vmx-serial-device.xml new file mode 100644 index 0000000..050eff7 --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-serial-device.xml @@ -0,0 +1,14 @@ +<domain type='vmware'> + <name>serial-device</name> + <uuid>564d9bef-acd9-b4e0-c8f0-aea8b9103515</uuid> + <memory>4096</memory> + <os> + <type>hvm</type> + </os> + <devices> + <serial type='dev'> + <source path='/dev/ttyS0'/> + <target port='0'/> + </serial> + </devices> +</domain> diff --git a/tests/xml2vmxdata/xml2vmx-serial-file.vmx b/tests/xml2vmxdata/xml2vmx-serial-file.vmx new file mode 100644 index 0000000..481e054 --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-serial-file.vmx @@ -0,0 +1,11 @@ +config.version = "8" +virtualHW.version = "4" +guestOS = "other" +uuid.bios = "56 4d 9b ef ac d9 b4 e0-c8 f0 ae a8 b9 10 35 15" +displayName = "serial-file" +memsize = "4" +numvcpus = "1" +serial0.present = "true" +serial0.fileType = "file" +serial0.fileName = "serial0.file" +serial0.yieldOnMsrRead = "true" diff --git a/tests/xml2vmxdata/xml2vmx-serial-file.xml b/tests/xml2vmxdata/xml2vmx-serial-file.xml new file mode 100644 index 0000000..6fc8eac --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-serial-file.xml @@ -0,0 +1,14 @@ +<domain type='vmware'> + <name>serial-file</name> + <uuid>564d9bef-acd9-b4e0-c8f0-aea8b9103515</uuid> + <memory>4096</memory> + <os> + <type>hvm</type> + </os> + <devices> + <serial type='file'> + <source path='serial0.file'/> + <target port='0'/> + </serial> + </devices> +</domain> diff --git a/tests/xml2vmxdata/xml2vmx-serial-pipe.vmx b/tests/xml2vmxdata/xml2vmx-serial-pipe.vmx new file mode 100644 index 0000000..b177e14 --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-serial-pipe.vmx @@ -0,0 +1,13 @@ +config.version = "8" +virtualHW.version = "4" +guestOS = "other" +uuid.bios = "56 4d 9b ef ac d9 b4 e0-c8 f0 ae a8 b9 10 35 15" +displayName = "serial-pipe" +memsize = "4" +numvcpus = "1" +serial0.present = "true" +serial0.fileType = "pipe" +serial0.pipe.endPoint = "client" +serial0.tryNoRxLoss = "false" +serial0.fileName = "serial0.pipe" +serial0.yieldOnMsrRead = "true" diff --git a/tests/xml2vmxdata/xml2vmx-serial-pipe.xml b/tests/xml2vmxdata/xml2vmx-serial-pipe.xml new file mode 100644 index 0000000..9a6db53 --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-serial-pipe.xml @@ -0,0 +1,14 @@ +<domain type='vmware'> + <name>serial-pipe</name> + <uuid>564d9bef-acd9-b4e0-c8f0-aea8b9103515</uuid> + <memory>4096</memory> + <os> + <type>hvm</type> + </os> + <devices> + <serial type='pipe'> + <source path='serial0.pipe'/> + <target port='0'/> + </serial> + </devices> +</domain> diff --git a/tests/xml2vmxtest.c b/tests/xml2vmxtest.c new file mode 100644 index 0000000..df0a4a6 --- /dev/null +++ b/tests/xml2vmxtest.c @@ -0,0 +1,226 @@ +#include <config.h> + +#ifdef WITH_ESX + +#include <stdio.h> +#include <string.h> +#include <unistd.h> + +#include "internal.h" +#include "memory.h" +#include "testutils.h" +#include "esx/esx_vmx.h" + +static char *progname = NULL; +static char *abs_srcdir = NULL; +static virCapsPtr caps = NULL; + +#define MAX_FILE 4096 + +static void +testESXCapsInit(void) +{ + virCapsGuestPtr guest = NULL; + + caps = virCapabilitiesNew("i686", 1, 1); + + if (caps == NULL) { + return; + } + + virCapabilitiesSetMacPrefix(caps, (unsigned char[]){ 0x00, 0x50, 0x56 }); + virCapabilitiesAddHostMigrateTransport(caps, "esx"); + + /* i686 guest */ + guest = + virCapabilitiesAddGuest(caps, "hvm", "i686", 32, NULL, NULL, 0, NULL); + + if (guest == NULL) { + goto failure; + } + + if (virCapabilitiesAddGuestDomain(guest, "vmware", NULL, NULL, 0, + NULL) == NULL) { + goto failure; + } + + /* x86_64 guest */ + guest = + virCapabilitiesAddGuest(caps, "hvm", "x86_64", 64, NULL, NULL, 0, NULL); + + if (guest == NULL) { + goto failure; + } + + if (virCapabilitiesAddGuestDomain(guest, "vmware", NULL, NULL, 0, + NULL) == NULL) { + goto failure; + } + + return; + + failure: + virCapabilitiesFree(caps); + caps = NULL; +} + +static int +testCompareFiles(const char *xml, const char *vmx, esxVI_APIVersion apiVersion) +{ + int result = -1; + char xmlData[MAX_FILE]; + char vmxData[MAX_FILE]; + char *formatted = NULL; + char *xmlPtr = &(xmlData[0]); + char *vmxPtr = &(vmxData[0]); + virDomainDefPtr def = NULL; + + if (virtTestLoadFile(xml, &xmlPtr, MAX_FILE) < 0) { + goto failure; + } + + if (virtTestLoadFile(vmx, &vmxPtr, MAX_FILE) < 0) { + goto failure; + } + + def = virDomainDefParseString(NULL, caps, xmlData, VIR_DOMAIN_XML_INACTIVE); + + if (def == NULL) { + goto failure; + } + + formatted = esxVMX_FormatConfig(NULL, def, apiVersion); + + if (formatted == NULL) { + goto failure; + } + + if (STRNEQ(vmxData, formatted)) { + virtTestDifference(stderr, vmxData, formatted); + goto failure; + } + + result = 0; + + failure: + VIR_FREE(formatted); + virDomainDefFree(def); + + return result; +} + +struct testInfo { + const char *input; + const char *output; + esxVI_APIVersion version; +}; + +static int +testCompareHelper(const void *data) +{ + const struct testInfo *info = data; + char xml[PATH_MAX]; + char vmx[PATH_MAX]; + + snprintf(xml, PATH_MAX, "%s/xml2vmxdata/xml2vmx-%s.xml", abs_srcdir, + info->input); + snprintf(vmx, PATH_MAX, "%s/xml2vmxdata/xml2vmx-%s.vmx", abs_srcdir, + info->output); + + return testCompareFiles(xml, vmx, info->version); +} + +static int +mymain(int argc, char **argv) +{ + int result = 0; + char cwd[PATH_MAX]; + + progname = argv[0]; + + if (argc > 1) { + fprintf(stderr, "Usage: %s\n", progname); + return EXIT_FAILURE; + } + + abs_srcdir = getenv("abs_srcdir"); + + if (abs_srcdir == NULL) { + abs_srcdir = getcwd(cwd, sizeof(cwd)); + } + + if (argc > 1) { + fprintf(stderr, "Usage: %s\n", progname); + return EXIT_FAILURE; + } + + #define DO_TEST(_in, _out, _version) \ + do { \ + struct testInfo info = { _in, _out, _version }; \ + virResetLastError(); \ + if (virtTestRun("VMware XML-2-VMX "_in" -> "_out, 1, \ + testCompareHelper, &info) < 0) { \ + result = -1; \ + } \ + } while (0) + + testESXCapsInit(); + + if (caps == NULL) { + return EXIT_FAILURE; + } + + DO_TEST("minimal", "minimal", esxVI_APIVersion_25); + DO_TEST("minimal-64bit", "minimal-64bit", esxVI_APIVersion_25); + + DO_TEST("scsi-buslogic", "scsi-buslogic", esxVI_APIVersion_25); + DO_TEST("scsi-writethrough", "scsi-writethrough", esxVI_APIVersion_25); + + DO_TEST("harddisk-scsi-file", "harddisk-scsi-file", esxVI_APIVersion_25); + DO_TEST("harddisk-ide-file", "harddisk-ide-file", esxVI_APIVersion_25); + + DO_TEST("cdrom-scsi-file", "cdrom-scsi-file", esxVI_APIVersion_25); + DO_TEST("cdrom-scsi-device", "cdrom-scsi-device", esxVI_APIVersion_25); + DO_TEST("cdrom-ide-file", "cdrom-ide-file", esxVI_APIVersion_25); + DO_TEST("cdrom-ide-device", "cdrom-ide-device", esxVI_APIVersion_25); + + DO_TEST("floppy-file", "floppy-file", esxVI_APIVersion_25); + DO_TEST("floppy-device", "floppy-device", esxVI_APIVersion_25); + + DO_TEST("ethernet-e1000", "ethernet-e1000", esxVI_APIVersion_25); + + DO_TEST("ethernet-custom", "ethernet-custom", esxVI_APIVersion_25); + DO_TEST("ethernet-bridged", "ethernet-bridged", esxVI_APIVersion_25); + + DO_TEST("serial-file", "serial-file", esxVI_APIVersion_25); + DO_TEST("serial-device", "serial-device", esxVI_APIVersion_25); + DO_TEST("serial-pipe", "serial-pipe", esxVI_APIVersion_25); + + DO_TEST("parallel-file", "parallel-file", esxVI_APIVersion_25); + DO_TEST("parallel-device", "parallel-device", esxVI_APIVersion_25); + + DO_TEST("esx-in-the-wild-1", "esx-in-the-wild-1", esxVI_APIVersion_25); + DO_TEST("esx-in-the-wild-2", "esx-in-the-wild-2", esxVI_APIVersion_25); + DO_TEST("esx-in-the-wild-3", "esx-in-the-wild-3", esxVI_APIVersion_25); + DO_TEST("esx-in-the-wild-4", "esx-in-the-wild-4", esxVI_APIVersion_25); + + DO_TEST("gsx-in-the-wild-1", "gsx-in-the-wild-1", esxVI_APIVersion_25); + DO_TEST("gsx-in-the-wild-2", "gsx-in-the-wild-2", esxVI_APIVersion_25); + DO_TEST("gsx-in-the-wild-3", "gsx-in-the-wild-3", esxVI_APIVersion_25); + DO_TEST("gsx-in-the-wild-4", "gsx-in-the-wild-4", esxVI_APIVersion_25); + + virCapabilitiesFree(caps); + + return result == 0 ? EXIT_SUCCESS : EXIT_FAILURE; +} + +VIRT_TEST_MAIN(mymain) + +#else + +int main (void) +{ + return 77; /* means 'test skipped' for automake */ +} + +#endif /* WITH_ESX */
-- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list