[libvirt] [PATCHv2 0/4] VMX: CD-ROM handling improvements

A user came into #virt the other day and was trying to get libvirtd to work with VMWare Fusion 5, which is basically the Mac OS X version of VMWare Workstation. In helping him out I noticed a few limitations of our VMX parser so I've added support through this patchset. However I came across the fact that we only support 2 types of CD-ROMs instead of the 3 types that VMWare has lead to adding support for a <driver> element to CD-ROM drives. Additionally VMWare Fusion has a concept of auto detecting your host CD-ROM drive at boot and we don't have a XML field for this so I omitted a <source> element and added the tray to be opened. Doug Goldstein (4): VMX: Add cdrom-raw dev type from VMWare Fusion VMX: Add support for 'auto detect' fileNames VMX: Some serial ports are not actually connected VMX: Add a VMWare Fusion 5 configuration for tests docs/formatdomain.html.in | 3 +- src/vmx/vmx.c | 61 ++++++++++++--- tests/vmx2xmldata/vmx2xml-cdrom-ide-device.xml | 1 + .../vmx2xml-cdrom-ide-raw-auto-detect.vmx | 5 ++ .../vmx2xml-cdrom-ide-raw-auto-detect.xml | 24 ++++++ tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-device.vmx | 5 ++ tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-device.xml | 25 ++++++ tests/vmx2xmldata/vmx2xml-cdrom-scsi-device.xml | 1 + .../vmx2xml-cdrom-scsi-raw-auto-detect.vmx | 6 ++ .../vmx2xml-cdrom-scsi-raw-auto-detect.xml | 24 ++++++ .../vmx2xmldata/vmx2xml-cdrom-scsi-raw-device.vmx | 6 ++ .../vmx2xmldata/vmx2xml-cdrom-scsi-raw-device.xml | 25 ++++++ tests/vmx2xmldata/vmx2xml-esx-in-the-wild-2.xml | 1 + tests/vmx2xmldata/vmx2xml-fusion-in-the-wild-1.vmx | 88 ++++++++++++++++++++++ tests/vmx2xmldata/vmx2xml-fusion-in-the-wild-1.xml | 39 ++++++++++ tests/vmx2xmltest.c | 6 ++ .../xml2vmxdata/xml2vmx-cdrom-ide-atapi-device.vmx | 13 ++++ .../xml2vmxdata/xml2vmx-cdrom-ide-atapi-device.xml | 15 ++++ .../xml2vmx-cdrom-ide-raw-auto-detect.vmx | 14 ++++ .../xml2vmx-cdrom-ide-raw-auto-detect.xml | 14 ++++ tests/xml2vmxdata/xml2vmx-cdrom-ide-raw-device.vmx | 13 ++++ tests/xml2vmxdata/xml2vmx-cdrom-ide-raw-device.xml | 15 ++++ .../xml2vmx-cdrom-scsi-atapi-device.vmx | 14 ++++ .../xml2vmx-cdrom-scsi-atapi-device.xml | 15 ++++ .../xml2vmx-cdrom-scsi-raw-auto-detect.vmx | 15 ++++ .../xml2vmx-cdrom-scsi-raw-auto-detect.xml | 14 ++++ .../xml2vmxdata/xml2vmx-cdrom-scsi-raw-device.vmx | 14 ++++ .../xml2vmxdata/xml2vmx-cdrom-scsi-raw-device.xml | 15 ++++ tests/xml2vmxdata/xml2vmx-fusion-in-the-wild-1.vmx | 30 ++++++++ tests/xml2vmxdata/xml2vmx-fusion-in-the-wild-1.xml | 40 ++++++++++ tests/xml2vmxtest.c | 8 ++ 31 files changed, 558 insertions(+), 11 deletions(-) create mode 100644 tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-auto-detect.vmx create mode 100644 tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-auto-detect.xml create mode 100644 tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-device.vmx create mode 100644 tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-device.xml create mode 100644 tests/vmx2xmldata/vmx2xml-cdrom-scsi-raw-auto-detect.vmx create mode 100644 tests/vmx2xmldata/vmx2xml-cdrom-scsi-raw-auto-detect.xml create mode 100644 tests/vmx2xmldata/vmx2xml-cdrom-scsi-raw-device.vmx create mode 100644 tests/vmx2xmldata/vmx2xml-cdrom-scsi-raw-device.xml create mode 100644 tests/vmx2xmldata/vmx2xml-fusion-in-the-wild-1.vmx create mode 100644 tests/vmx2xmldata/vmx2xml-fusion-in-the-wild-1.xml create mode 100644 tests/xml2vmxdata/xml2vmx-cdrom-ide-atapi-device.vmx create mode 100644 tests/xml2vmxdata/xml2vmx-cdrom-ide-atapi-device.xml create mode 100644 tests/xml2vmxdata/xml2vmx-cdrom-ide-raw-auto-detect.vmx create mode 100644 tests/xml2vmxdata/xml2vmx-cdrom-ide-raw-auto-detect.xml create mode 100644 tests/xml2vmxdata/xml2vmx-cdrom-ide-raw-device.vmx create mode 100644 tests/xml2vmxdata/xml2vmx-cdrom-ide-raw-device.xml create mode 100644 tests/xml2vmxdata/xml2vmx-cdrom-scsi-atapi-device.vmx create mode 100644 tests/xml2vmxdata/xml2vmx-cdrom-scsi-atapi-device.xml create mode 100644 tests/xml2vmxdata/xml2vmx-cdrom-scsi-raw-auto-detect.vmx create mode 100644 tests/xml2vmxdata/xml2vmx-cdrom-scsi-raw-auto-detect.xml create mode 100644 tests/xml2vmxdata/xml2vmx-cdrom-scsi-raw-device.vmx create mode 100644 tests/xml2vmxdata/xml2vmx-cdrom-scsi-raw-device.xml create mode 100644 tests/xml2vmxdata/xml2vmx-fusion-in-the-wild-1.vmx create mode 100644 tests/xml2vmxdata/xml2vmx-fusion-in-the-wild-1.xml -- 1.8.1.5

According to VMWare's documentation 'cdrom-raw' is an acceptable value for deviceType for a CD-ROM drive. The documentation states that the VMX configuration for a CD-ROM deviceType is as follows: ide|scsi(n):(n).deviceType = "cdrom-raw|atapi-cdrom|cdrom-image" >From the documentation it appears the following is true: - cdrom-image = Provides the ISO to the VM - atapi-cdrom = Provides a NEC emulated ATAPI CD-ROM on top of the host CD-ROM - cdrom-raw = Passthru for a host CD-ROM drive. Allows CD-R burning from within the guest. A CD-ROM prior to this patch would always provide an 'atapi-cdrom' is modeled as: <disk type='block' device='cdrom'> <source dev='/dev/scd0'/> <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> This patch allows an optional element as: <driver name='atapi'/> that would maintain existing behavior. While: <driver name='raw'/> would provide a 'cdrom-raw' to the VM. --- docs/formatdomain.html.in | 3 +- src/vmx/vmx.c | 39 ++++++++++++++++++---- tests/vmx2xmldata/vmx2xml-cdrom-ide-device.xml | 1 + tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-device.vmx | 5 +++ tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-device.xml | 25 ++++++++++++++ tests/vmx2xmldata/vmx2xml-cdrom-scsi-device.xml | 1 + .../vmx2xmldata/vmx2xml-cdrom-scsi-raw-device.vmx | 6 ++++ .../vmx2xmldata/vmx2xml-cdrom-scsi-raw-device.xml | 25 ++++++++++++++ tests/vmx2xmldata/vmx2xml-esx-in-the-wild-2.xml | 1 + tests/vmx2xmltest.c | 2 ++ .../xml2vmxdata/xml2vmx-cdrom-ide-atapi-device.vmx | 13 ++++++++ .../xml2vmxdata/xml2vmx-cdrom-ide-atapi-device.xml | 15 +++++++++ tests/xml2vmxdata/xml2vmx-cdrom-ide-raw-device.vmx | 13 ++++++++ tests/xml2vmxdata/xml2vmx-cdrom-ide-raw-device.xml | 15 +++++++++ .../xml2vmx-cdrom-scsi-atapi-device.vmx | 14 ++++++++ .../xml2vmx-cdrom-scsi-atapi-device.xml | 15 +++++++++ .../xml2vmxdata/xml2vmx-cdrom-scsi-raw-device.vmx | 14 ++++++++ .../xml2vmxdata/xml2vmx-cdrom-scsi-raw-device.xml | 15 +++++++++ tests/xml2vmxtest.c | 4 +++ 19 files changed, 218 insertions(+), 8 deletions(-) create mode 100644 tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-device.vmx create mode 100644 tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-device.xml create mode 100644 tests/vmx2xmldata/vmx2xml-cdrom-scsi-raw-device.vmx create mode 100644 tests/vmx2xmldata/vmx2xml-cdrom-scsi-raw-device.xml create mode 100644 tests/xml2vmxdata/xml2vmx-cdrom-ide-atapi-device.vmx create mode 100644 tests/xml2vmxdata/xml2vmx-cdrom-ide-atapi-device.xml create mode 100644 tests/xml2vmxdata/xml2vmx-cdrom-ide-raw-device.vmx create mode 100644 tests/xml2vmxdata/xml2vmx-cdrom-ide-raw-device.xml create mode 100644 tests/xml2vmxdata/xml2vmx-cdrom-scsi-atapi-device.vmx create mode 100644 tests/xml2vmxdata/xml2vmx-cdrom-scsi-atapi-device.xml create mode 100644 tests/xml2vmxdata/xml2vmx-cdrom-scsi-raw-device.vmx create mode 100644 tests/xml2vmxdata/xml2vmx-cdrom-scsi-raw-device.xml diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 9d12293..c52b2fa 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -1829,7 +1829,8 @@ supports a name of "tap", "tap2", "phy", or "file", with a type of "aio", while qemu only supports a name of "qemu", but multiple types including "raw", "bochs", "qcow2", and - "qed". + "qed". VMWare supports a name of "raw" or "atapi" for CD-ROMs, + <span class="since">since 1.1.2.</span> </li> <li> The optional <code>cache</code> attribute controls the diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c index 35afe26..ba549ab 100644 --- a/src/vmx/vmx.c +++ b/src/vmx/vmx.c @@ -1064,6 +1064,14 @@ virVMXHandleLegacySCSIDiskDriverName(virDomainDefPtr def, return 0; } + /* Legitmate drivers are 'atapi' and 'raw' for CD-ROMs, so don't + * attempt to do legacy parsing on them. + */ + if (STRCASEEQ(disk->driverName, "atapi") || + STRCASEEQ(disk->driverName, "raw")) { + return 0; + } + tmp = disk->driverName; for (; *tmp != '\0'; ++tmp) { @@ -2174,12 +2182,13 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virConfPtr con goto cleanup; } } else if (virFileHasSuffix(fileName, ".iso") || - STRCASEEQ(deviceType, "atapi-cdrom")) { + STRCASEEQ(deviceType, "atapi-cdrom") || + STRCASEEQ(deviceType, "cdrom-raw")) { /* * This function was called in order to parse a harddisk device, - * but .iso files and 'atapi-cdrom' devices are for CDROM devices - * only. Just ignore it, another call to this function to parse a - * CDROM device may handle it. + * but .iso files, 'atapi-cdrom', and 'cdrom-raw' devices are for + * CDROM devices only. Just ignore it, another call to this + * function to parse a CDROM device may handle it. */ goto ignore; } else { @@ -2215,11 +2224,22 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virConfPtr con * handle it. */ goto ignore; - } else if (STRCASEEQ(deviceType, "atapi-cdrom")) { + } else if (STRCASEEQ(deviceType, "atapi-cdrom") || + STRCASEEQ(deviceType, "cdrom-raw")) { (*def)->type = VIR_DOMAIN_DISK_TYPE_BLOCK; (*def)->src = fileName; fileName = NULL; + + if (STRCASEEQ(deviceType, "cdrom-raw")) { + if (VIR_STRDUP((*def)->driverName, "raw") < 0) { + goto cleanup; + } + } else { + if (VIR_STRDUP((*def)->driverName, "atapi") < 0) { + goto cleanup; + } + } } else { virReportError(VIR_ERR_INTERNAL_ERROR, _("Invalid or not yet handled value '%s' " @@ -3526,8 +3546,13 @@ virVMXFormatCDROM(virVMXContext *ctx, virDomainDiskDefPtr def, VIR_FREE(fileName); } } else if (def->type == VIR_DOMAIN_DISK_TYPE_BLOCK) { - virBufferAsprintf(buffer, "%s%d:%d.deviceType = \"atapi-cdrom\"\n", - entryPrefix, controllerOrBus, unit); + if (def->driverName && STRCASEEQ(def->driverName, "raw")) { + virBufferAsprintf(buffer, "%s%d:%d.deviceType = \"cdrom-raw\"\n", + entryPrefix, controllerOrBus, unit); + } else { + virBufferAsprintf(buffer, "%s%d:%d.deviceType = \"atapi-cdrom\"\n", + entryPrefix, controllerOrBus, unit); + } if (def->src != NULL) { virBufferAsprintf(buffer, "%s%d:%d.fileName = \"%s\"\n", diff --git a/tests/vmx2xmldata/vmx2xml-cdrom-ide-device.xml b/tests/vmx2xmldata/vmx2xml-cdrom-ide-device.xml index a4bf33c..3639708 100644 --- a/tests/vmx2xmldata/vmx2xml-cdrom-ide-device.xml +++ b/tests/vmx2xmldata/vmx2xml-cdrom-ide-device.xml @@ -12,6 +12,7 @@ <on_crash>destroy</on_crash> <devices> <disk type='block' device='cdrom'> + <driver name='atapi'/> <source dev='/dev/scd0'/> <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> diff --git a/tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-device.vmx b/tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-device.vmx new file mode 100644 index 0000000..1648111 --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-device.vmx @@ -0,0 +1,5 @@ +config.version = "8" +virtualHW.version = "4" +ide0:0.present = "true" +ide0:0.deviceType = "cdrom-raw" +ide0:0.fileName = "/dev/scd0" diff --git a/tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-device.xml b/tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-device.xml new file mode 100644 index 0000000..95967b9 --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-device.xml @@ -0,0 +1,25 @@ +<domain type='vmware'> + <uuid>00000000-0000-0000-0000-000000000000</uuid> + <memory unit='KiB'>32768</memory> + <currentMemory unit='KiB'>32768</currentMemory> + <vcpu placement='static'>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'> + <driver name='raw'/> + <source dev='/dev/scd0'/> + <target dev='hda' bus='ide'/> + <address type='drive' controller='0' bus='0' target='0' unit='0'/> + </disk> + <controller type='ide' index='0'/> + <video> + <model type='vmvga' vram='4096'/> + </video> + </devices> +</domain> diff --git a/tests/vmx2xmldata/vmx2xml-cdrom-scsi-device.xml b/tests/vmx2xmldata/vmx2xml-cdrom-scsi-device.xml index 0cdfb91..9b5e583 100644 --- a/tests/vmx2xmldata/vmx2xml-cdrom-scsi-device.xml +++ b/tests/vmx2xmldata/vmx2xml-cdrom-scsi-device.xml @@ -12,6 +12,7 @@ <on_crash>destroy</on_crash> <devices> <disk type='block' device='cdrom'> + <driver name='atapi'/> <source dev='/dev/scd0'/> <target dev='sda' bus='scsi'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> diff --git a/tests/vmx2xmldata/vmx2xml-cdrom-scsi-raw-device.vmx b/tests/vmx2xmldata/vmx2xml-cdrom-scsi-raw-device.vmx new file mode 100644 index 0000000..773b743 --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-cdrom-scsi-raw-device.vmx @@ -0,0 +1,6 @@ +config.version = "8" +virtualHW.version = "4" +scsi0.present = "true" +scsi0:0.present = "true" +scsi0:0.deviceType = "cdrom-raw" +scsi0:0.fileName = "/dev/scd0" diff --git a/tests/vmx2xmldata/vmx2xml-cdrom-scsi-raw-device.xml b/tests/vmx2xmldata/vmx2xml-cdrom-scsi-raw-device.xml new file mode 100644 index 0000000..52c251e --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-cdrom-scsi-raw-device.xml @@ -0,0 +1,25 @@ +<domain type='vmware'> + <uuid>00000000-0000-0000-0000-000000000000</uuid> + <memory unit='KiB'>32768</memory> + <currentMemory unit='KiB'>32768</currentMemory> + <vcpu placement='static'>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'> + <driver name='raw'/> + <source dev='/dev/scd0'/> + <target dev='sda' bus='scsi'/> + <address type='drive' controller='0' bus='0' target='0' unit='0'/> + </disk> + <controller type='scsi' index='0'/> + <video> + <model type='vmvga' vram='4096'/> + </video> + </devices> +</domain> diff --git a/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-2.xml b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-2.xml index fd3b92c..9401f5d 100644 --- a/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-2.xml +++ b/tests/vmx2xmldata/vmx2xml-esx-in-the-wild-2.xml @@ -29,6 +29,7 @@ <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> <disk type='block' device='cdrom'> + <driver name='atapi'/> <source dev='/dev/scd0'/> <target dev='hdb' bus='ide'/> <address type='drive' controller='0' bus='0' target='0' unit='1'/> diff --git a/tests/vmx2xmltest.c b/tests/vmx2xmltest.c index c9616de..479c84c 100644 --- a/tests/vmx2xmltest.c +++ b/tests/vmx2xmltest.c @@ -237,8 +237,10 @@ mymain(void) DO_TEST("cdrom-scsi-file", "cdrom-scsi-file"); DO_TEST("cdrom-scsi-device", "cdrom-scsi-device"); + DO_TEST("cdrom-scsi-raw-device", "cdrom-scsi-raw-device"); DO_TEST("cdrom-ide-file", "cdrom-ide-file"); DO_TEST("cdrom-ide-device", "cdrom-ide-device"); + DO_TEST("cdrom-ide-raw-device", "cdrom-ide-raw-device"); DO_TEST("floppy-file", "floppy-file"); DO_TEST("floppy-device", "floppy-device"); diff --git a/tests/xml2vmxdata/xml2vmx-cdrom-ide-atapi-device.vmx b/tests/xml2vmxdata/xml2vmx-cdrom-ide-atapi-device.vmx new file mode 100644 index 0000000..13b91b4 --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-cdrom-ide-atapi-device.vmx @@ -0,0 +1,13 @@ +.encoding = "UTF-8" +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" +floppy0.present = "false" +floppy1.present = "false" diff --git a/tests/xml2vmxdata/xml2vmx-cdrom-ide-atapi-device.xml b/tests/xml2vmxdata/xml2vmx-cdrom-ide-atapi-device.xml new file mode 100644 index 0000000..4ec3a7c --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-cdrom-ide-atapi-device.xml @@ -0,0 +1,15 @@ +<domain type='vmware'> + <name>cdrom-ide-device</name> + <uuid>564d9bef-acd9-b4e0-c8f0-aea8b9103515</uuid> + <memory unit='KiB'>4096</memory> + <os> + <type>hvm</type> + </os> + <devices> + <disk type='block' device='cdrom'> + <driver name='atapi'/> + <source dev='/dev/scd0'/> + <target dev='hda' bus='ide'/> + </disk> + </devices> +</domain> diff --git a/tests/xml2vmxdata/xml2vmx-cdrom-ide-raw-device.vmx b/tests/xml2vmxdata/xml2vmx-cdrom-ide-raw-device.vmx new file mode 100644 index 0000000..cd391e0 --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-cdrom-ide-raw-device.vmx @@ -0,0 +1,13 @@ +.encoding = "UTF-8" +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 = "cdrom-raw" +ide0:0.fileName = "/dev/scd0" +floppy0.present = "false" +floppy1.present = "false" diff --git a/tests/xml2vmxdata/xml2vmx-cdrom-ide-raw-device.xml b/tests/xml2vmxdata/xml2vmx-cdrom-ide-raw-device.xml new file mode 100644 index 0000000..2e71825 --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-cdrom-ide-raw-device.xml @@ -0,0 +1,15 @@ +<domain type='vmware'> + <name>cdrom-ide-device</name> + <uuid>564d9bef-acd9-b4e0-c8f0-aea8b9103515</uuid> + <memory unit='KiB'>4096</memory> + <os> + <type>hvm</type> + </os> + <devices> + <disk type='block' device='cdrom'> + <driver name='raw'/> + <source dev='/dev/scd0'/> + <target dev='hda' bus='ide'/> + </disk> + </devices> +</domain> diff --git a/tests/xml2vmxdata/xml2vmx-cdrom-scsi-atapi-device.vmx b/tests/xml2vmxdata/xml2vmx-cdrom-scsi-atapi-device.vmx new file mode 100644 index 0000000..705b31b --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-cdrom-scsi-atapi-device.vmx @@ -0,0 +1,14 @@ +.encoding = "UTF-8" +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" +floppy0.present = "false" +floppy1.present = "false" diff --git a/tests/xml2vmxdata/xml2vmx-cdrom-scsi-atapi-device.xml b/tests/xml2vmxdata/xml2vmx-cdrom-scsi-atapi-device.xml new file mode 100644 index 0000000..e6da5b5 --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-cdrom-scsi-atapi-device.xml @@ -0,0 +1,15 @@ +<domain type='vmware'> + <name>cdrom-scsi-device</name> + <uuid>564d9bef-acd9-b4e0-c8f0-aea8b9103515</uuid> + <memory unit='KiB'>4096</memory> + <os> + <type>hvm</type> + </os> + <devices> + <disk type='block' device='cdrom'> + <driver name='atapi'/> + <source dev='/dev/scd0'/> + <target dev='sda' bus='scsi'/> + </disk> + </devices> +</domain> diff --git a/tests/xml2vmxdata/xml2vmx-cdrom-scsi-raw-device.vmx b/tests/xml2vmxdata/xml2vmx-cdrom-scsi-raw-device.vmx new file mode 100644 index 0000000..e044004 --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-cdrom-scsi-raw-device.vmx @@ -0,0 +1,14 @@ +.encoding = "UTF-8" +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 = "cdrom-raw" +scsi0:0.fileName = "/dev/scd0" +floppy0.present = "false" +floppy1.present = "false" diff --git a/tests/xml2vmxdata/xml2vmx-cdrom-scsi-raw-device.xml b/tests/xml2vmxdata/xml2vmx-cdrom-scsi-raw-device.xml new file mode 100644 index 0000000..466249d --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-cdrom-scsi-raw-device.xml @@ -0,0 +1,15 @@ +<domain type='vmware'> + <name>cdrom-scsi-device</name> + <uuid>564d9bef-acd9-b4e0-c8f0-aea8b9103515</uuid> + <memory unit='KiB'>4096</memory> + <os> + <type>hvm</type> + </os> + <devices> + <disk type='block' device='cdrom'> + <driver name='raw'/> + <source dev='/dev/scd0'/> + <target dev='sda' bus='scsi'/> + </disk> + </devices> +</domain> diff --git a/tests/xml2vmxtest.c b/tests/xml2vmxtest.c index 0dffebd..20176de 100644 --- a/tests/xml2vmxtest.c +++ b/tests/xml2vmxtest.c @@ -253,8 +253,12 @@ mymain(void) DO_TEST("cdrom-scsi-file", "cdrom-scsi-file", 4); DO_TEST("cdrom-scsi-device", "cdrom-scsi-device", 4); + DO_TEST("cdrom-scsi-atapi-device", "cdrom-scsi-atapi-device", 4); + DO_TEST("cdrom-scsi-raw-device", "cdrom-scsi-raw-device", 4); DO_TEST("cdrom-ide-file", "cdrom-ide-file", 4); DO_TEST("cdrom-ide-device", "cdrom-ide-device", 4); + DO_TEST("cdrom-ide-atapi-device", "cdrom-ide-atapi-device", 4); + DO_TEST("cdrom-ide-raw-device", "cdrom-ide-raw-device", 4); DO_TEST("floppy-file", "floppy-file", 4); DO_TEST("floppy-device", "floppy-device", 4); -- 1.8.1.5

On Thu, Aug 22, 2013 at 08:53:06PM -0500, Doug Goldstein wrote: > According to VMWare's documentation 'cdrom-raw' is an acceptable value > for deviceType for a CD-ROM drive. The documentation states that the VMX > configuration for a CD-ROM deviceType is as follows: > > ide|scsi(n):(n).deviceType = "cdrom-raw|atapi-cdrom|cdrom-image" > > >From the documentation it appears the following is true: > - cdrom-image = Provides the ISO to the VM > - atapi-cdrom = Provides a NEC emulated ATAPI CD-ROM on top of the host > CD-ROM > - cdrom-raw = Passthru for a host CD-ROM drive. Allows CD-R burning from > within the guest. > > A CD-ROM prior to this patch would always provide an 'atapi-cdrom' is > modeled as: > <disk type='block' device='cdrom'> > <source dev='/dev/scd0'/> > <target dev='hda' bus='ide'/> > <address type='drive' controller='0' bus='0' target='0' unit='0'/> > </disk> > > This patch allows an optional element as: > <driver name='atapi'/> > that would maintain existing behavior. While: > <driver name='raw'/> > would provide a 'cdrom-raw' to the VM. The 'cdrom-raw' case sounds very similar to the scenario we addressed in QEMU, by adding support for a 'lun' value in the device attribute. eg I think 'cdrom-raw' could be addressed by supporting <disk type='block' device='lun'> <source dev='/dev/scd0'/> <target dev='hda' bus='ide'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> rather than using <driver> Paolo, you added the 'lun' support - do you agree with this ? Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|

Il 27/08/2013 15:50, Daniel P. Berrange ha scritto: > On Thu, Aug 22, 2013 at 08:53:06PM -0500, Doug Goldstein wrote: >> According to VMWare's documentation 'cdrom-raw' is an acceptable value >> for deviceType for a CD-ROM drive. The documentation states that the VMX >> configuration for a CD-ROM deviceType is as follows: >> >> ide|scsi(n):(n).deviceType = "cdrom-raw|atapi-cdrom|cdrom-image" >> >> >From the documentation it appears the following is true: >> - cdrom-image = Provides the ISO to the VM >> - atapi-cdrom = Provides a NEC emulated ATAPI CD-ROM on top of the host >> CD-ROM >> - cdrom-raw = Passthru for a host CD-ROM drive. Allows CD-R burning from >> within the guest. >> >> A CD-ROM prior to this patch would always provide an 'atapi-cdrom' is >> modeled as: >> <disk type='block' device='cdrom'> >> <source dev='/dev/scd0'/> >> <target dev='hda' bus='ide'/> >> <address type='drive' controller='0' bus='0' target='0' unit='0'/> >> </disk> >> >> This patch allows an optional element as: >> <driver name='atapi'/> >> that would maintain existing behavior. While: >> <driver name='raw'/> >> would provide a 'cdrom-raw' to the VM. > > > The 'cdrom-raw' case sounds very similar to the scenario we addressed > in QEMU, by adding support for a 'lun' value in the device attribute. > > eg I think 'cdrom-raw' could be addressed by supporting > > <disk type='block' device='lun'> > <source dev='/dev/scd0'/> > <target dev='hda' bus='ide'/> > <address type='drive' controller='0' bus='0' target='0' unit='0'/> > </disk> > > rather than using <driver> > > Paolo, you added the 'lun' support - do you agree with this ? Yes, 100%. - cdrom-image is type='file' device='cdrom' - atapi-cdrom is type='block' device='cdrom' - cdrom-raw is type='block' device='lun' Paolo

On Tue, Aug 27, 2013 at 8:56 AM, Paolo Bonzini <pbonzini@redhat.com> wrote: > Il 27/08/2013 15:50, Daniel P. Berrange ha scritto: > > On Thu, Aug 22, 2013 at 08:53:06PM -0500, Doug Goldstein wrote: > >> According to VMWare's documentation 'cdrom-raw' is an acceptable value > >> for deviceType for a CD-ROM drive. The documentation states that the VMX > >> configuration for a CD-ROM deviceType is as follows: > >> > >> ide|scsi(n):(n).deviceType = "cdrom-raw|atapi-cdrom|cdrom-image" > >> > >> >From the documentation it appears the following is true: > >> - cdrom-image = Provides the ISO to the VM > >> - atapi-cdrom = Provides a NEC emulated ATAPI CD-ROM on top of the host > >> CD-ROM > >> - cdrom-raw = Passthru for a host CD-ROM drive. Allows CD-R burning from > >> within the guest. > >> > >> A CD-ROM prior to this patch would always provide an 'atapi-cdrom' is > >> modeled as: > >> <disk type='block' device='cdrom'> > >> <source dev='/dev/scd0'/> > >> <target dev='hda' bus='ide'/> > >> <address type='drive' controller='0' bus='0' target='0' unit='0'/> > >> </disk> > >> > >> This patch allows an optional element as: > >> <driver name='atapi'/> > >> that would maintain existing behavior. While: > >> <driver name='raw'/> > >> would provide a 'cdrom-raw' to the VM. > > > > > > The 'cdrom-raw' case sounds very similar to the scenario we addressed > > in QEMU, by adding support for a 'lun' value in the device attribute. > > > > eg I think 'cdrom-raw' could be addressed by supporting > > > > <disk type='block' device='lun'> > > <source dev='/dev/scd0'/> > > <target dev='hda' bus='ide'/> > > <address type='drive' controller='0' bus='0' target='0' unit='0'/> > > </disk> > > > > rather than using <driver> > > > > Paolo, you added the 'lun' support - do you agree with this ? > > Yes, 100%. > > - cdrom-image is type='file' device='cdrom' > - atapi-cdrom is type='block' device='cdrom' > - cdrom-raw is type='block' device='lun' > > Paolo > > Thanks guys. I'll respin it to device='lun'. -- Doug Goldstein

VMWare Fusion 5 can set the CD-ROM's device name to be 'auto detect' when using the physical drive via 'cdrom-raw' device type. VMWare will then connect to first available host CD-ROM to the virtual machine upon start up according to VMWare documentation. To better model this a CD-ROM that is marked as "auto detect" when in the off state would be modeled as the following with this patch: <disk type='block' device='cdrom'> <target dev='hda' bus='ide' tray='open'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> Note the tray state being marked as 'open', while the <source> element is omitted. --- src/vmx/vmx.c | 20 ++++++++++++++++-- .../vmx2xml-cdrom-ide-raw-auto-detect.vmx | 5 +++++ .../vmx2xml-cdrom-ide-raw-auto-detect.xml | 24 ++++++++++++++++++++++ .../vmx2xml-cdrom-scsi-raw-auto-detect.vmx | 6 ++++++ .../vmx2xml-cdrom-scsi-raw-auto-detect.xml | 24 ++++++++++++++++++++++ tests/vmx2xmltest.c | 2 ++ .../xml2vmx-cdrom-ide-raw-auto-detect.vmx | 14 +++++++++++++ .../xml2vmx-cdrom-ide-raw-auto-detect.xml | 14 +++++++++++++ .../xml2vmx-cdrom-scsi-raw-auto-detect.vmx | 15 ++++++++++++++ .../xml2vmx-cdrom-scsi-raw-auto-detect.xml | 14 +++++++++++++ tests/xml2vmxtest.c | 2 ++ 11 files changed, 138 insertions(+), 2 deletions(-) create mode 100644 tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-auto-detect.vmx create mode 100644 tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-auto-detect.xml create mode 100644 tests/vmx2xmldata/vmx2xml-cdrom-scsi-raw-auto-detect.vmx create mode 100644 tests/vmx2xmldata/vmx2xml-cdrom-scsi-raw-auto-detect.xml create mode 100644 tests/xml2vmxdata/xml2vmx-cdrom-ide-raw-auto-detect.vmx create mode 100644 tests/xml2vmxdata/xml2vmx-cdrom-ide-raw-auto-detect.xml create mode 100644 tests/xml2vmxdata/xml2vmx-cdrom-scsi-raw-auto-detect.vmx create mode 100644 tests/xml2vmxdata/xml2vmx-cdrom-scsi-raw-auto-detect.xml diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c index ba549ab..e7732e4 100644 --- a/src/vmx/vmx.c +++ b/src/vmx/vmx.c @@ -2227,9 +2227,14 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virConfPtr con } else if (STRCASEEQ(deviceType, "atapi-cdrom") || STRCASEEQ(deviceType, "cdrom-raw")) { (*def)->type = VIR_DOMAIN_DISK_TYPE_BLOCK; - (*def)->src = fileName; - fileName = NULL; + if (STRCASENEQ(fileName, "auto detect")) { + (*def)->src = fileName; + fileName = NULL; + } else { + (*def)->tray_status = VIR_DOMAIN_DISK_TRAY_OPEN; + (*def)->src = NULL; + } if (STRCASEEQ(deviceType, "cdrom-raw")) { if (VIR_STRDUP((*def)->driverName, "raw") < 0) { @@ -3546,6 +3551,11 @@ virVMXFormatCDROM(virVMXContext *ctx, virDomainDiskDefPtr def, VIR_FREE(fileName); } } else if (def->type == VIR_DOMAIN_DISK_TYPE_BLOCK) { + if (!def->src && def->tray_status == VIR_DOMAIN_DISK_TRAY_OPEN) { + virBufferAsprintf(buffer, "%s%d:%d.autodetect = \"true\"\n", + entryPrefix, controllerOrBus, unit); + } + if (def->driverName && STRCASEEQ(def->driverName, "raw")) { virBufferAsprintf(buffer, "%s%d:%d.deviceType = \"cdrom-raw\"\n", entryPrefix, controllerOrBus, unit); @@ -3557,6 +3567,12 @@ virVMXFormatCDROM(virVMXContext *ctx, virDomainDiskDefPtr def, if (def->src != NULL) { virBufferAsprintf(buffer, "%s%d:%d.fileName = \"%s\"\n", entryPrefix, controllerOrBus, unit, def->src); + } else { + if (def->tray_status == VIR_DOMAIN_DISK_TRAY_OPEN) { + virBufferAsprintf(buffer, "%s%d:%d.fileName = " + "\"auto detect\"\n", entryPrefix, + controllerOrBus, unit); + } } } else { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, diff --git a/tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-auto-detect.vmx b/tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-auto-detect.vmx new file mode 100644 index 0000000..b2c4caf --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-auto-detect.vmx @@ -0,0 +1,5 @@ +config.version = "8" +virtualHW.version = "4" +ide0:0.present = "true" +ide0:0.deviceType = "cdrom-raw" +ide0:0.fileName = "auto detect" diff --git a/tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-auto-detect.xml b/tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-auto-detect.xml new file mode 100644 index 0000000..1e32be5 --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-auto-detect.xml @@ -0,0 +1,24 @@ +<domain type='vmware'> + <uuid>00000000-0000-0000-0000-000000000000</uuid> + <memory unit='KiB'>32768</memory> + <currentMemory unit='KiB'>32768</currentMemory> + <vcpu placement='static'>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'> + <driver name='raw'/> + <target dev='hda' bus='ide' tray='open'/> + <address type='drive' controller='0' bus='0' target='0' unit='0'/> + </disk> + <controller type='ide' index='0'/> + <video> + <model type='vmvga' vram='4096'/> + </video> + </devices> +</domain> diff --git a/tests/vmx2xmldata/vmx2xml-cdrom-scsi-raw-auto-detect.vmx b/tests/vmx2xmldata/vmx2xml-cdrom-scsi-raw-auto-detect.vmx new file mode 100644 index 0000000..0209b29 --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-cdrom-scsi-raw-auto-detect.vmx @@ -0,0 +1,6 @@ +config.version = "8" +virtualHW.version = "4" +scsi0.present = "true" +scsi0:0.present = "true" +scsi0:0.deviceType = "cdrom-raw" +scsi0:0.fileName = "auto detect" diff --git a/tests/vmx2xmldata/vmx2xml-cdrom-scsi-raw-auto-detect.xml b/tests/vmx2xmldata/vmx2xml-cdrom-scsi-raw-auto-detect.xml new file mode 100644 index 0000000..e469746 --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-cdrom-scsi-raw-auto-detect.xml @@ -0,0 +1,24 @@ +<domain type='vmware'> + <uuid>00000000-0000-0000-0000-000000000000</uuid> + <memory unit='KiB'>32768</memory> + <currentMemory unit='KiB'>32768</currentMemory> + <vcpu placement='static'>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'> + <driver name='raw'/> + <target dev='sda' bus='scsi' tray='open'/> + <address type='drive' controller='0' bus='0' target='0' unit='0'/> + </disk> + <controller type='scsi' index='0'/> + <video> + <model type='vmvga' vram='4096'/> + </video> + </devices> +</domain> diff --git a/tests/vmx2xmltest.c b/tests/vmx2xmltest.c index 479c84c..5eb04e9 100644 --- a/tests/vmx2xmltest.c +++ b/tests/vmx2xmltest.c @@ -238,9 +238,11 @@ mymain(void) DO_TEST("cdrom-scsi-file", "cdrom-scsi-file"); DO_TEST("cdrom-scsi-device", "cdrom-scsi-device"); DO_TEST("cdrom-scsi-raw-device", "cdrom-scsi-raw-device"); + DO_TEST("cdrom-scsi-raw-auto-detect", "cdrom-scsi-raw-auto-detect"); DO_TEST("cdrom-ide-file", "cdrom-ide-file"); DO_TEST("cdrom-ide-device", "cdrom-ide-device"); DO_TEST("cdrom-ide-raw-device", "cdrom-ide-raw-device"); + DO_TEST("cdrom-ide-raw-auto-detect", "cdrom-ide-raw-auto-detect"); DO_TEST("floppy-file", "floppy-file"); DO_TEST("floppy-device", "floppy-device"); diff --git a/tests/xml2vmxdata/xml2vmx-cdrom-ide-raw-auto-detect.vmx b/tests/xml2vmxdata/xml2vmx-cdrom-ide-raw-auto-detect.vmx new file mode 100644 index 0000000..da41b90 --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-cdrom-ide-raw-auto-detect.vmx @@ -0,0 +1,14 @@ +.encoding = "UTF-8" +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.autodetect = "true" +ide0:0.deviceType = "cdrom-raw" +ide0:0.fileName = "auto detect" +floppy0.present = "false" +floppy1.present = "false" diff --git a/tests/xml2vmxdata/xml2vmx-cdrom-ide-raw-auto-detect.xml b/tests/xml2vmxdata/xml2vmx-cdrom-ide-raw-auto-detect.xml new file mode 100644 index 0000000..ba3e60b --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-cdrom-ide-raw-auto-detect.xml @@ -0,0 +1,14 @@ +<domain type='vmware'> + <name>cdrom-ide-device</name> + <uuid>564d9bef-acd9-b4e0-c8f0-aea8b9103515</uuid> + <memory unit='KiB'>4096</memory> + <os> + <type>hvm</type> + </os> + <devices> + <disk type='block' device='cdrom'> + <driver name='raw'/> + <target dev='hda' bus='ide' tray='open'/> + </disk> + </devices> +</domain> diff --git a/tests/xml2vmxdata/xml2vmx-cdrom-scsi-raw-auto-detect.vmx b/tests/xml2vmxdata/xml2vmx-cdrom-scsi-raw-auto-detect.vmx new file mode 100644 index 0000000..e3ddc6a --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-cdrom-scsi-raw-auto-detect.vmx @@ -0,0 +1,15 @@ +.encoding = "UTF-8" +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.autodetect = "true" +scsi0:0.deviceType = "cdrom-raw" +scsi0:0.fileName = "auto detect" +floppy0.present = "false" +floppy1.present = "false" diff --git a/tests/xml2vmxdata/xml2vmx-cdrom-scsi-raw-auto-detect.xml b/tests/xml2vmxdata/xml2vmx-cdrom-scsi-raw-auto-detect.xml new file mode 100644 index 0000000..913545f --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-cdrom-scsi-raw-auto-detect.xml @@ -0,0 +1,14 @@ +<domain type='vmware'> + <name>cdrom-scsi-device</name> + <uuid>564d9bef-acd9-b4e0-c8f0-aea8b9103515</uuid> + <memory unit='KiB'>4096</memory> + <os> + <type>hvm</type> + </os> + <devices> + <disk type='block' device='cdrom'> + <driver name='raw'/> + <target dev='sda' bus='scsi' tray='open'/> + </disk> + </devices> +</domain> diff --git a/tests/xml2vmxtest.c b/tests/xml2vmxtest.c index 20176de..2f325de 100644 --- a/tests/xml2vmxtest.c +++ b/tests/xml2vmxtest.c @@ -255,10 +255,12 @@ mymain(void) DO_TEST("cdrom-scsi-device", "cdrom-scsi-device", 4); DO_TEST("cdrom-scsi-atapi-device", "cdrom-scsi-atapi-device", 4); DO_TEST("cdrom-scsi-raw-device", "cdrom-scsi-raw-device", 4); + DO_TEST("cdrom-scsi-raw-auto-detect", "cdrom-scsi-raw-auto-detect", 4); DO_TEST("cdrom-ide-file", "cdrom-ide-file", 4); DO_TEST("cdrom-ide-device", "cdrom-ide-device", 4); DO_TEST("cdrom-ide-atapi-device", "cdrom-ide-atapi-device", 4); DO_TEST("cdrom-ide-raw-device", "cdrom-ide-raw-device", 4); + DO_TEST("cdrom-ide-raw-auto-detect", "cdrom-ide-raw-auto-detect", 4); DO_TEST("floppy-file", "floppy-file", 4); DO_TEST("floppy-device", "floppy-device", 4); -- 1.8.1.5

Sometimes a serial port might not be actually wired to a device when the user does not have the VM powered on and we should not consider this a fatal error. --- src/vmx/vmx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c index e7732e4..a13ef63 100644 --- a/src/vmx/vmx.c +++ b/src/vmx/vmx.c @@ -2722,7 +2722,7 @@ virVMXParseSerial(virVMXContext *ctx, virConfPtr conf, int port, /* vmx:fileName -> def:data.file.path */ if (virVMXGetConfigString(conf, fileName_name, &fileName, false) < 0) { - goto cleanup; + goto ignore; } /* vmx:network.endPoint -> def:data.tcp.listen */ -- 1.8.1.5

A user was having an issue with this specific VMWare Fusion config and he gave me permission to add it as part of our test suite to further expand our VMX test coverage. Unfortunately our VMX parser and generator does not support many features contained within and just silently ignores fields it does not understand so they had to be removed out in the xml2vmx test. The original unmodified version exists in the vmx2xml test. --- tests/vmx2xmldata/vmx2xml-fusion-in-the-wild-1.vmx | 88 ++++++++++++++++++++++ tests/vmx2xmldata/vmx2xml-fusion-in-the-wild-1.xml | 39 ++++++++++ tests/vmx2xmltest.c | 2 + tests/xml2vmxdata/xml2vmx-fusion-in-the-wild-1.vmx | 30 ++++++++ tests/xml2vmxdata/xml2vmx-fusion-in-the-wild-1.xml | 40 ++++++++++ tests/xml2vmxtest.c | 2 + 6 files changed, 201 insertions(+) create mode 100644 tests/vmx2xmldata/vmx2xml-fusion-in-the-wild-1.vmx create mode 100644 tests/vmx2xmldata/vmx2xml-fusion-in-the-wild-1.xml create mode 100644 tests/xml2vmxdata/xml2vmx-fusion-in-the-wild-1.vmx create mode 100644 tests/xml2vmxdata/xml2vmx-fusion-in-the-wild-1.xml diff --git a/tests/vmx2xmldata/vmx2xml-fusion-in-the-wild-1.vmx b/tests/vmx2xmldata/vmx2xml-fusion-in-the-wild-1.vmx new file mode 100644 index 0000000..ef6af19 --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-fusion-in-the-wild-1.vmx @@ -0,0 +1,88 @@ +.encoding = "UTF-8" +config.version = "8" +virtualHW.version = "9" +memsize = "3572" +MemAllowAutoScaleDown = "FALSE" +MemTrimRate = "-1" +displayName = "ATTM_VM" +guestOS = "winxppro" +numvcpus = "2" +sound.present = "TRUE" +sound.filename = "-1" +sound.autodetect = "TRUE" +usb.present = "TRUE" +ethernet0.present = "TRUE" +ethernet0.addressType = "generated" +ethernet0.connectionType = "bridged" +ethernet1.present = "TRUE" +ethernet1.addressType = "generated" +ethernet1.connectionType = "bridged" +scsi0:0.present = "TRUE" +scsi0:0.fileName = "ATTM_VM.vmdk" +pciBridge0.present = "TRUE" +tools.upgrade.policy = "useGlobal" +ehci.present = "TRUE" +ide0:0.present = "TRUE" +ide0:0.autodetect = "TRUE" +ide0:0.filename = "auto detect" +ide0:0.deviceType = "atapi-cdrom" +scsi0.present = "TRUE" +scsi0.virtualDev = "buslogic" +buslogic.noDriver = "FALSE" +extendedConfigFile = "ATTM_VM.vmxf" +virtualHW.productCompatibility = "hosted" +pciBridge4.present = "TRUE" +pciBridge4.virtualDev = "pcieRootPort" +pciBridge4.pciSlotNumber = "21" +pciBridge4.functions = "8" +pciBridge5.present = "TRUE" +pciBridge5.virtualDev = "pcieRootPort" +pciBridge5.pciSlotNumber = "22" +pciBridge5.functions = "8" +pciBridge6.present = "TRUE" +pciBridge6.virtualDev = "pcieRootPort" +pciBridge6.pciSlotNumber = "23" +pciBridge6.functions = "8" +pciBridge7.present = "TRUE" +pciBridge7.virtualDev = "pcieRootPort" +pciBridge7.pciSlotNumber = "24" +pciBridge7.functions = "8" +vmci0.present = "TRUE" +hpet0.present = "TRUE" +usb.vbluetooth.startConnected = "TRUE" +mks.enable3d = "TRUE" +ethernet0.linkStatePropagation.enable = "TRUE" +ethernet1.linkStatePropagation.enable = "TRUE" +ide0:0.startConnected = "FALSE" +ethernet0.generatedAddress = "00:0c:29:3b:64:ea" +ethernet1.generatedAddress = "00:0c:29:3b:64:f4" +vmci0.id = "-952408854" +tools.syncTime = "FALSE" +uuid.location = "56 4d 70 88 01 a1 98 32-e7 2b 67 90 c7 3b 64 ea" +uuid.bios = "56 4d 70 88 01 a1 98 32-e7 2b 67 90 c7 3b 64 ea" +cleanShutdown = "TRUE" +replay.supported = "FALSE" +replay.filename = "" +scsi0:0.redo = "" +pciBridge0.pciSlotNumber = "17" +scsi0.pciSlotNumber = "16" +usb.pciSlotNumber = "32" +ethernet0.pciSlotNumber = "33" +ethernet1.pciSlotNumber = "34" +sound.pciSlotNumber = "35" +ehci.pciSlotNumber = "36" +vmci0.pciSlotNumber = "37" +usb:1.present = "TRUE" +ethernet0.generatedAddressOffset = "0" +ethernet1.generatedAddressOffset = "10" +vmotion.checkpointFBSize = "134217728" +usb:1.speed = "2" +usb:1.deviceType = "hub" +usb:1.port = "1" +usb:1.parent = "-1" +floppy0.startConnected = "FALSE" +softPowerOff = "FALSE" +usb:0.present = "TRUE" +usb:0.deviceType = "hid" +usb:0.port = "0" +usb:0.parent = "-1" diff --git a/tests/vmx2xmldata/vmx2xml-fusion-in-the-wild-1.xml b/tests/vmx2xmldata/vmx2xml-fusion-in-the-wild-1.xml new file mode 100644 index 0000000..bed85d6 --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-fusion-in-the-wild-1.xml @@ -0,0 +1,39 @@ +<domain type='vmware'> + <name>ATTM_VM</name> + <uuid>564d7088-01a1-9832-e72b-6790c73b64ea</uuid> + <memory unit='KiB'>3657728</memory> + <currentMemory unit='KiB'>3657728</currentMemory> + <vcpu placement='static'>2</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='[datastore] directory/ATTM_VM.vmdk'/> + <target dev='sda' bus='scsi'/> + <address type='drive' controller='0' bus='0' target='0' unit='0'/> + </disk> + <disk type='block' device='cdrom'> + <driver name='atapi'/> + <target dev='hda' bus='ide' tray='open'/> + <address type='drive' controller='0' bus='0' target='0' unit='0'/> + </disk> + <controller type='scsi' index='0' model='buslogic'/> + <controller type='ide' index='0'/> + <interface type='bridge'> + <mac address='00:0c:29:3b:64:ea'/> + <source bridge=''/> + </interface> + <interface type='bridge'> + <mac address='00:0c:29:3b:64:f4'/> + <source bridge=''/> + </interface> + <video> + <model type='vmvga' vram='4096'/> + </video> + </devices> +</domain> diff --git a/tests/vmx2xmltest.c b/tests/vmx2xmltest.c index 5eb04e9..00bf21d 100644 --- a/tests/vmx2xmltest.c +++ b/tests/vmx2xmltest.c @@ -288,6 +288,8 @@ mymain(void) DO_TEST("ws-in-the-wild-1", "ws-in-the-wild-1"); DO_TEST("ws-in-the-wild-2", "ws-in-the-wild-2"); + DO_TEST("fusion-in-the-wild-1", "fusion-in-the-wild-1"); + DO_TEST("annotation", "annotation"); DO_TEST("smbios", "smbios"); diff --git a/tests/xml2vmxdata/xml2vmx-fusion-in-the-wild-1.vmx b/tests/xml2vmxdata/xml2vmx-fusion-in-the-wild-1.vmx new file mode 100644 index 0000000..7f6551b --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-fusion-in-the-wild-1.vmx @@ -0,0 +1,30 @@ +.encoding = "UTF-8" +config.version = "8" +virtualHW.version = "9" +guestOS = "other" +uuid.bios = "56 4d 70 88 01 a1 98 32-e7 2b 67 90 c7 3b 64 ea" +displayName = "ATTM_VM" +memsize = "3572" +numvcpus = "2" +scsi0.present = "true" +scsi0.virtualDev = "buslogic" +scsi0:0.present = "true" +scsi0:0.deviceType = "scsi-hardDisk" +scsi0:0.fileName = "/vmfs/volumes/datastore/directory/ATTM_VM.vmdk" +ide0:0.present = "true" +ide0:0.autodetect = "true" +ide0:0.deviceType = "atapi-cdrom" +ide0:0.fileName = "auto detect" +floppy0.present = "false" +floppy1.present = "false" +ethernet0.present = "true" +ethernet0.connectionType = "bridged" +ethernet0.addressType = "generated" +ethernet0.generatedAddress = "00:0c:29:3b:64:ea" +ethernet0.generatedAddressOffset = "0" +ethernet1.present = "true" +ethernet1.connectionType = "bridged" +ethernet1.addressType = "generated" +ethernet1.generatedAddress = "00:0c:29:3b:64:f4" +ethernet1.generatedAddressOffset = "0" +svga.vramSize = "4194304" diff --git a/tests/xml2vmxdata/xml2vmx-fusion-in-the-wild-1.xml b/tests/xml2vmxdata/xml2vmx-fusion-in-the-wild-1.xml new file mode 100644 index 0000000..4a09add --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-fusion-in-the-wild-1.xml @@ -0,0 +1,40 @@ +<domain type='vmware'> + <name>ATTM_VM</name> + <uuid>564d7088-01a1-9832-e72b-6790c73b64ea</uuid> + <memory unit='KiB'>3657728</memory> + <currentMemory unit='KiB'>3657728</currentMemory> + <vcpu placement='static'>2</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='[datastore] directory/ATTM_VM.vmdk'/> + <target dev='sda' bus='scsi'/> + <address type='drive' controller='0' bus='0' target='0' unit='0'/> + </disk> + <disk type='block' device='cdrom'> + <driver name='atapi'/> + <target dev='hda' bus='ide' tray='open'/> + <address type='drive' controller='0' bus='0' target='0' unit='0'/> + </disk> + <controller type='scsi' index='0' model='buslogic'/> + <controller type='ide' index='0'/> + <interface type='bridge'> + <mac address='00:0c:29:3b:64:ea'/> + <source bridge=''/> + </interface> + <interface type='bridge'> + <mac address='00:0c:29:3b:64:f4'/> + <source bridge=''/> + </interface> + <video> + <model type='vmvga' vram='4096'/> + </video> + <memballoon model='none'/> + </devices> +</domain> diff --git a/tests/xml2vmxtest.c b/tests/xml2vmxtest.c index 2f325de..e793faf 100644 --- a/tests/xml2vmxtest.c +++ b/tests/xml2vmxtest.c @@ -303,6 +303,8 @@ mymain(void) DO_TEST("ws-in-the-wild-1", "ws-in-the-wild-1", 8); DO_TEST("ws-in-the-wild-2", "ws-in-the-wild-2", 8); + DO_TEST("fusion-in-the-wild-1", "fusion-in-the-wild-1", 9); + DO_TEST("annotation", "annotation", 4); DO_TEST("smbios", "smbios", 4); -- 1.8.1.5
participants (3)
-
Daniel P. Berrange
-
Doug Goldstein
-
Paolo Bonzini