diff --git a/src/util/conf.c b/src/util/conf.c index 24588c231acb8ba058fe770d12f22f9240d13c3a..ae0459eb372532d88cc6eb452bd1d754710f7bcd 100644 --- a/src/util/conf.c +++ b/src/util/conf.c @@ -831,7 +831,10 @@ virConfGetValue(virConfPtr conf, const char *setting) cur = conf->entries; while (cur != NULL) { - if ((cur->name != NULL) && (STREQ(cur->name, setting))) + if ((cur->name != NULL) && + ((conf->flags & VIR_CONF_FLAG_VMX_FORMAT && + STRCASEEQ(cur->name, setting)) || + STREQ(cur->name, setting))) return(cur->value); cur = cur->next; } diff --git a/tests/vmx2xmldata/vmx2xml-case-insensitive-1.vmx b/tests/vmx2xmldata/vmx2xml-case-insensitive-1.vmx new file mode 100644 index 0000000000000000000000000000000000000000..3626c5e77d414991cada2c85d14d16953bc6c77a --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-case-insensitive-1.vmx @@ -0,0 +1,51 @@ +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-case-insensitive-1.xml b/tests/vmx2xmldata/vmx2xml-case-insensitive-1.xml new file mode 100644 index 0000000000000000000000000000000000000000..0be570f86707194b686dfc8a3e272e49ad103deb --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-case-insensitive-1.xml @@ -0,0 +1,25 @@ + + FEDORA11 + 50115e16-9bdc-49d7-f171-53c4d7f91710 + 1048576 + 1048576 + 1 + + hvm + + + destroy + restart + destroy + + + + + + + + + + + + diff --git a/tests/vmx2xmldata/vmx2xml-case-insensitive-2.vmx b/tests/vmx2xmldata/vmx2xml-case-insensitive-2.vmx new file mode 100644 index 0000000000000000000000000000000000000000..a485d03cd97bbfe72413a6b14935c98a069a08a1 --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-case-insensitive-2.vmx @@ -0,0 +1,51 @@ +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-case-insensitive-2.xml b/tests/vmx2xmldata/vmx2xml-case-insensitive-2.xml new file mode 100644 index 0000000000000000000000000000000000000000..766172f9914c6e37e98467ba9add317da04a3f21 --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-case-insensitive-2.xml @@ -0,0 +1,25 @@ + + fedora11 + 50115e16-9bdc-49d7-f171-53c4d7f91710 + 1048576 + 1048576 + 1 + + hvm + + + destroy + restart + destroy + + + + + + + + + + + + diff --git a/tests/vmx2xmltest.c b/tests/vmx2xmltest.c index b4eb5d56e962adc7fe3d1801c18b64833bd3a7c5..b036f5bbe03240b832b104fe5ffca8afa92906f7 100644 --- a/tests/vmx2xmltest.c +++ b/tests/vmx2xmltest.c @@ -26,6 +26,7 @@ testCompareFiles(const char *vmx, const char *xml, esxVI_APIVersion apiVersion) char *vmxPtr = &(vmxData[0]); char *xmlPtr = &(xmlData[0]); virDomainDefPtr def = NULL; + virErrorPtr err = NULL; if (virtTestLoadFile(vmx, &vmxPtr, MAX_FILE) < 0) { goto failure; @@ -39,12 +40,16 @@ testCompareFiles(const char *vmx, const char *xml, esxVI_APIVersion apiVersion) apiVersion); if (def == NULL) { + err = virGetLastError(); + fprintf(stderr, "ERROR: %s\n", err != NULL ? err->message : ""); goto failure; } formatted = virDomainDefFormat(def, VIR_DOMAIN_XML_SECURE); if (formatted == NULL) { + err = virGetLastError(); + fprintf(stderr, "ERROR: %s\n", err != NULL ? err->message : ""); goto failure; } @@ -117,6 +122,9 @@ mymain(int argc, char **argv) } \ } while (0) + DO_TEST("case-insensitive-1", "case-insensitive-1", esxVI_APIVersion_25); + DO_TEST("case-insensitive-2", "case-insensitive-2", esxVI_APIVersion_25); + DO_TEST("minimal", "minimal", esxVI_APIVersion_25); DO_TEST("minimal-64bit", "minimal-64bit", esxVI_APIVersion_25);