Add a test for this.
Reported by Frank Dirks.
---
src/util/conf.c | 2 +-
src/util/conf.h | 4 +-
tests/vmx2xmldata/vmx2xml-esx-in-the-wild-5.vmx | 97 +++++++++++++++++++++++
tests/vmx2xmldata/vmx2xml-esx-in-the-wild-5.xml | 34 ++++++++
tests/vmx2xmltest.c | 1 +
5 files changed, 135 insertions(+), 3 deletions(-)
create mode 100644 tests/vmx2xmldata/vmx2xml-esx-in-the-wild-5.vmx
create mode 100644 tests/vmx2xmldata/vmx2xml-esx-in-the-wild-5.xml
diff --git a/src/util/conf.c b/src/util/conf.c
index 8682f7b..0aef2c2 100644
--- a/src/util/conf.c
+++ b/src/util/conf.c
@@ -561,7 +561,7 @@ virConfParseName(virConfParserCtxtPtr ctxt)
while ((ctxt->cur < ctxt->end) &&
(c_isalnum(CUR) || (CUR == '_') ||
((ctxt->conf->flags & VIR_CONF_FLAG_VMX_FORMAT) &&
- ((CUR == ':') || (CUR == '.')))))
+ ((CUR == ':') || (CUR == '.') || (CUR == '-')))))
NEXT;
ret = strndup(base, ctxt->cur - base);
if (ret == NULL) {
diff --git a/src/util/conf.h b/src/util/conf.h
index 8282bd4..e7d470d 100644
--- a/src/util/conf.h
+++ b/src/util/conf.h
@@ -25,8 +25,8 @@ typedef enum {
} virConfType;
typedef enum {
- VIR_CONF_FLAG_VMX_FORMAT = 1, /* allow : and . in names for compatibility with
- VMware VMX configuration file, but restrict
+ VIR_CONF_FLAG_VMX_FORMAT = 1, /* allow ':', '.' and '-' in
names for compatibility
+ with VMware VMX configuration file, but restrict
allowed value types to string only */
} virConfFlags;
diff --git a/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-5.vmx
b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-5.vmx
new file mode 100644
index 0000000..6b11cc2
--- /dev/null
+++ b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-5.vmx
@@ -0,0 +1,97 @@
+.encoding = "UTF-8"
+config.version = "8"
+virtualHW.version = "7"
+pciBridge0.present = "true"
+pciBridge4.present = "true"
+pciBridge4.virtualDev = "pcieRootPort"
+pciBridge4.functions = "8"
+pciBridge5.present = "true"
+pciBridge5.virtualDev = "pcieRootPort"
+pciBridge5.functions = "8"
+pciBridge6.present = "true"
+pciBridge6.virtualDev = "pcieRootPort"
+pciBridge6.functions = "8"
+pciBridge7.present = "true"
+pciBridge7.virtualDev = "pcieRootPort"
+pciBridge7.functions = "8"
+vmci0.present = "true"
+nvram = "vmtest.nvram"
+virtualHW.productCompatibility = "hosted"
+powerType.powerOff = "soft"
+powerType.powerOn = "hard"
+powerType.suspend = "hard"
+powerType.reset = "soft"
+displayName = "vmtest.local"
+extendedConfigFile = "vmtest.vmxf"
+numvcpus = "2"
+scsi0.present = "true"
+scsi0.sharedBus = "none"
+scsi0.virtualDev = "lsilogic"
+memsize = "2048"
+scsi0:0.present = "true"
+scsi0:0.fileName = "vmtest-000001.vmdk"
+scsi0:0.deviceType = "scsi-hardDisk"
+sched.scsi0:0.shares = "normal"
+ide0:0.present = "true"
+ide0:0.fileName =
"/vmfs/volumes/4af0231d-1eff559a-6369-0024e84773b6/isos/CentOS-5.5-x86_64-bin-DVD-1of2.iso"
+ide0:0.deviceType = "cdrom-image"
+ide1:0.present = "true"
+ide1:0.clientDevice = "true"
+ide1:0.deviceType = "atapi-cdrom"
+ide1:0.startConnected = "false"
+ethernet0.present = "true"
+ethernet0.virtualDev = "e1000"
+ethernet0.networkName = "VM-LAN"
+ethernet0.addressType = "vpx"
+ethernet0.generatedAddress = "00:50:56:be:00:15"
+guestOS = "centos-64"
+uuid.bios = "42 3e 94 a9 a1 c7 b3 1d-71 61 76 c7 58 6c 83 0e"
+vc.uuid = "50 3e 06 db f8 d5 45 8e-a2 fb f9 82 02 53 a7 be"
+log.fileName = "vmware.log"
+snapshot.action = "keep"
+sched.cpu.min = "0"
+sched.cpu.units = "mhz"
+sched.cpu.shares = "normal"
+sched.mem.minsize = "0"
+sched.mem.shares = "normal"
+tools.upgrade.policy = "manual"
+cpuid.80000001.eax = "--------------------------------"
+cpuid.80000001.eax.amd = "--------------------------------"
+cpuid.80000001.ebx = "--------------------------------"
+cpuid.80000001.ebx.amd = "--------------------------------"
+cpuid.80000001.ecx = "--------------------------------"
+cpuid.80000001.ecx.amd = "--------------------------------"
+cpuid.80000001.edx = "-----------H--------------------"
+cpuid.80000001.edx.amd = "-----------H--------------------"
+replay.supported = "FALSE"
+replay.filename = ""
+scsi0:0.redo = ""
+pciBridge0.pciSlotNumber = "17"
+pciBridge4.pciSlotNumber = "21"
+pciBridge5.pciSlotNumber = "22"
+pciBridge6.pciSlotNumber = "23"
+pciBridge7.pciSlotNumber = "24"
+scsi0.pciSlotNumber = "16"
+ethernet0.pciSlotNumber = "33"
+vmci0.pciSlotNumber = "32"
+scsi0.sasWWID = "50 05 05 6b 91 ac 28 90"
+vmotion.checkpointFBSize = "4194304"
+hostCPUID.0 = "0000000568747541444d416369746e65"
+hostCPUID.1 = "00100f420004080000802009178bfbff"
+hostCPUID.80000001 = "00100f42000004ef000037ffefd3fbff"
+guestCPUID.0 = "0000000568747541444d416369746e65"
+guestCPUID.1 = "00100f420000080080802001078bfbff"
+guestCPUID.80000001 = "00100f42000004ef000001e9ebd3fbff"
+userCPUID.0 = "0000000568747541444d416369746e65"
+userCPUID.1 = "00100f420004080080802001078bfbff"
+userCPUID.80000001 = "00100f42000004ef000001e9ebd3fbff"
+evcCompatibilityMode = "FALSE"
+sched.scsi0:0.throughputCap = "off"
+guest.commands.sharedSecretLogin.hostd-quiescedsnap =
"9ARGZmWQPtsUVrAVi/XviNUSQUF0td426itHw2cqHwg="
+floppy0.present = "FALSE"
+vmci0.id = "1483506446"
+tools.syncTime = "FALSE"
+annotation = "Centos 5.5 64bit Server"
+uuid.location = "56 4d 58 2e 12 3c 07 e4-0b 84 af d9 ea 5d 83 0a"
+cleanShutdown = "FALSE"
+sched.swap.derivedName =
"/vmfs/volumes/4bd1a428-b723f5bb-d406-0024e84773db/vmtest/vmtest-56acee0d.vswp"
diff --git a/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-5.xml
b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-5.xml
new file mode 100644
index 0000000..c324673
--- /dev/null
+++ b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-5.xml
@@ -0,0 +1,34 @@
+<domain type='vmware'>
+ <name>vmtest.local</name>
+ <uuid>423e94a9-a1c7-b31d-7161-76c7586c830e</uuid>
+ <description>Centos 5.5 64bit Server</description>
+ <memory>2097152</memory>
+ <currentMemory>2097152</currentMemory>
+ <vcpu>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'>
+ <source file='[datastore] directory/vmtest-000001.vmdk'/>
+ <target dev='sda' bus='scsi'/>
+ <address type='drive' controller='0' bus='0'
unit='0'/>
+ </disk>
+ <disk type='file' device='cdrom'>
+ <source file='[4af0231d-1eff559a-6369-0024e84773b6]
isos/CentOS-5.5-x86_64-bin-DVD-1of2.iso'/>
+ <target dev='hda' bus='ide'/>
+ <address type='drive' controller='0' bus='0'
unit='0'/>
+ </disk>
+ <controller type='scsi' index='0' model='lsilogic'/>
+ <controller type='ide' index='0'/>
+ <interface type='bridge'>
+ <mac address='00:50:56:be:00:15'/>
+ <source bridge='VM-LAN'/>
+ <model type='e1000'/>
+ </interface>
+ </devices>
+</domain>
diff --git a/tests/vmx2xmltest.c b/tests/vmx2xmltest.c
index 67296d6..c71f536 100644
--- a/tests/vmx2xmltest.c
+++ b/tests/vmx2xmltest.c
@@ -274,6 +274,7 @@ mymain(int argc, char **argv)
DO_TEST("esx-in-the-wild-2", "esx-in-the-wild-2",
esxVI_ProductVersion_ESX35);
DO_TEST("esx-in-the-wild-3", "esx-in-the-wild-3",
esxVI_ProductVersion_ESX35);
DO_TEST("esx-in-the-wild-4", "esx-in-the-wild-4",
esxVI_ProductVersion_ESX35);
+ DO_TEST("esx-in-the-wild-5", "esx-in-the-wild-5",
esxVI_ProductVersion_ESX40);
DO_TEST("gsx-in-the-wild-1", "gsx-in-the-wild-1",
esxVI_ProductVersion_ESX35);
DO_TEST("gsx-in-the-wild-2", "gsx-in-the-wild-2",
esxVI_ProductVersion_ESX35);
--
1.7.0.4