[PATCH] vmx: Allow '*' to appear in VMX file keys

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When connecting to a VMware server (eg using vpx://) we download and
try to parse the VMware metadata '*.vmx' file of a guest.  In this
case a VMX file was found which contained this key:

  pciPassthru*.present = "False"

The '*' character was not previously allowed in keys so this failed to
parse with the error:

  VIR_ERR_CONF_SYNTAX: VIR_FROM_CONF: configuration file syntax error:
  memory conf:74: expecting an assignment

Resolves: https://issues.redhat.com/browse/RHEL-58446
Thanks: Daniel Berrange
Signed-off-by: Richard W.M. Jones <rjones@xxxxxxxxxx>
---
 src/util/virconf.c                       |   2 +-
 tests/vmx2xmldata/esx-in-the-wild-14.vmx | 109 +++++++++++++++++++++++
 tests/vmx2xmldata/esx-in-the-wild-14.xml |  35 ++++++++
 tests/vmx2xmltest.c                      |   1 +
 4 files changed, 146 insertions(+), 1 deletion(-)

diff --git a/src/util/virconf.c b/src/util/virconf.c
index 66b3e0482e..c820c94037 100644
--- a/src/util/virconf.c
+++ b/src/util/virconf.c
@@ -553,7 +553,7 @@ virConfParseName(virConfParserCtxt *ctxt)
     while ((ctxt->cur < ctxt->end) &&
            (g_ascii_isalnum(CUR) || (CUR == '_') ||
             ((ctxt->conf->flags & VIR_CONF_FLAG_VMX_FORMAT) &&
-             ((CUR == ':') || (CUR == '.') || (CUR == '-'))) ||
+             ((CUR == ':') || (CUR == '.') || (CUR == '-') || (CUR == '*'))) ||
             ((ctxt->conf->flags & VIR_CONF_FLAG_LXC_FORMAT) &&
              (CUR == '.'))))
         NEXT;
diff --git a/tests/vmx2xmldata/esx-in-the-wild-14.vmx b/tests/vmx2xmldata/esx-in-the-wild-14.vmx
new file mode 100644
index 0000000000..1b06352348
--- /dev/null
+++ b/tests/vmx2xmldata/esx-in-the-wild-14.vmx
@@ -0,0 +1,109 @@
+.encoding = "UTF-8"
+displayName = "wild14"
+config.version = "8"
+virtualHW.version = "19"
+nvram = "wild14.nvram"
+pciBridge0.present = "TRUE"
+svga.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"
+hpet0.present = "TRUE"
+numvcpus = "12"
+memSize = "32768"
+vm.createDate = "1661219530463754"
+scsi0.virtualDev = "pvscsi"
+scsi0.present = "TRUE"
+annotation = "execution env sandbox automation platform"
+guestOS = "rhel7-64"
+uuid.bios = "42 1b 22 3a f2 c1 c7 c9-a3 99 34 d2 d9 fd e2 6d"
+vc.uuid = "50 1b 83 1e 75 d8 15 f8-36 fa b9 e2 25 f3 95 aa"
+migrate.hostLog = "wild14.hlog"
+disk.EnableUUID = "true"
+guestinfo.Vrm.Server.Host = "wild14.local"
+numa.autosize.cookie = "120012"
+numa.autosize.vcpu.maxPerVirtualNode = "12"
+sched.swap.derivedName = "/vmfs/volumes/64e4b8e0/wild/wild14.vswp"
+pciBridge0.pciSlotNumber = "17"
+pciBridge4.pciSlotNumber = "21"
+pciBridge5.pciSlotNumber = "22"
+pciBridge6.pciSlotNumber = "23"
+pciBridge7.pciSlotNumber = "24"
+scsi0.pciSlotNumber = "160"
+vmci0.pciSlotNumber = "32"
+scsi0.sasWWID = "50 05 05 6a f2 c1 c7 c0"
+vmci0.id = "-637672851"
+svga.vramSize = "8388608"
+monitor.phys_bits_used = "45"
+vmotion.checkpointFBSize = "8388608"
+vmotion.checkpointSVGAPrimarySize = "8388608"
+softPowerOff = "FALSE"
+svga.guestBackedPrimaryAware = "TRUE"
+tools.syncTime = "FALSE"
+guestOS.detailed.data = "architecture='X86' bitness='64' distroName='Red Hat Enterprise Linux' distroVersion='8.8' familyName='Linux' kernelVersion='4.18.0-477.21.1.el8_8.x86_64' prettyName='Red Hat Enterprise Linux 8.8 (Ootpa)'"
+tools.remindInstall = "TRUE"
+config.readOnly = "FALSE"
+guestInfo.detailed.data = "architecture='X86' bitness='64' cpeString='cpe:/o:redhat:enterprise_linux:8::baseos' distroAddlVersion='8.10 (Ootpa)' distroName='Red Hat Enterprise Linux' distroVersion='8.10' familyName='Linux' kernelVersion='4.18.0-553.8.1.el8_10.x86_64' prettyName='Red Hat Enterprise Linux 8.10 (Ootpa)'"
+log.keepOld = "10"
+tools.setInfo.sizeLimit = "1048576"
+RemoteDisplay.maxConnections = "1"
+isolation.tools.diskWiper.disable = "True"
+isolation.tools.vmxDnDVersionGet.disable = "True"
+isolation.tools.copy.disable = "true"
+isolation.device.connectable.disable = "True"
+tools.guestlib.enableHostInfo = "False"
+isolation.device.edit.disable = "True"
+isolation.tools.setGUIOptions.enable = "False"
+pciPassthru*.present = "False"
+isolation.tools.dnd.disable = "true"
+log.rotateSize = "1024000"
+isolation.tools.paste.disable = "True"
+isolation.tools.diskShrink.disable = "True"
+time.synchronize.restore = "False"
+time.synchronize.resume.disk = "False"
+time.synchronize.tools.startup = "False"
+time.synchronize.continue = "False"
+time.synchronize.shrink = "False"
+time.synchronize.tools.enable = "False"
+mks.enable3d = "False"
+time.synchronize.resume.host = "False"
+ethernet0.addressType = "static"
+ethernet0.pciSlotNumber = "192"
+ethernet0.present = "TRUE"
+ethernet0.uptCompatibility = "TRUE"
+ethernet0.virtualDev = "vmxnet3"
+floppy0.present = "FALSE"
+ide0:0.deviceType = "atapi-cdrom"
+ide0:0.present = "TRUE"
+ide0:0.startConnected = "FALSE"
+ethernet0.opaqueNetwork.id = "a2636d32-fc15-469f-b3b4-f8193fefd097"
+ethernet0.opaqueNetwork.type = "nsx.LogicalSwitch"
+ethernet0.address = "00:00:00:00:00:00"
+vmotion.svga.mobMaxSize = "8388608"
+vmotion.svga.graphicsMemoryKB = "8192"
+scsi0:0.deviceType = "scsi-hardDisk"
+scsi0:0.fileName = "wild1.vmdk"
+sched.scsi0:0.shares = "normal"
+sched.scsi0:0.throughputCap = "off"
+scsi0:0.present = "TRUE"
+scsi0:1.deviceType = "scsi-hardDisk"
+scsi0:1.fileName = "wild2.vmdk"
+sched.scsi0:1.shares = "normal"
+sched.scsi0:1.throughputCap = "off"
+scsi0:1.present = "TRUE"
+bios.bootDelay = "10000"
+scsi0:1.redo = ""
+scsi0:0.redo = ""
+ide0:0.fileName = "emptyBackingString"
+ide0:0.clientDevice = "TRUE"
+cleanShutdown = "FALSE"
diff --git a/tests/vmx2xmldata/esx-in-the-wild-14.xml b/tests/vmx2xmldata/esx-in-the-wild-14.xml
new file mode 100644
index 0000000000..dd5c2434ee
--- /dev/null
+++ b/tests/vmx2xmldata/esx-in-the-wild-14.xml
@@ -0,0 +1,35 @@
+<domain type='vmware'>
+  <name>wild14</name>
+  <uuid>421b223a-f2c1-c7c9-a399-34d2d9fde26d</uuid>
+  <description>execution env sandbox automation platform</description>
+  <memory unit='KiB'>33554432</memory>
+  <currentMemory unit='KiB'>33554432</currentMemory>
+  <vcpu placement='static'>12</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/wild1.vmdk'/>
+      <target dev='sda' bus='scsi'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <disk type='file' device='disk'>
+      <source file='[datastore] directory/wild2.vmdk'/>
+      <target dev='sdb' bus='scsi'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
+    </disk>
+    <controller type='scsi' index='0' model='vmpvscsi'/>
+    <interface type='null'>
+      <mac address='00:00:00:00:00:00' type='static'/>
+      <model type='vmxnet3'/>
+    </interface>
+    <video>
+      <model type='vmvga' vram='8192' primary='yes'/>
+    </video>
+  </devices>
+</domain>
diff --git a/tests/vmx2xmltest.c b/tests/vmx2xmltest.c
index 0fb5f13f72..3ca9541000 100644
--- a/tests/vmx2xmltest.c
+++ b/tests/vmx2xmltest.c
@@ -264,6 +264,7 @@ mymain(void)
     DO_TEST("esx-in-the-wild-11");
     DO_TEST("esx-in-the-wild-12");
     DO_TEST("esx-in-the-wild-13");
+    DO_TEST("esx-in-the-wild-14");
 
     DO_TEST("gsx-in-the-wild-1");
     DO_TEST("gsx-in-the-wild-2");
-- 
2.46.0




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux