[libvirt] [PATCHv3 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. v3: * Dropped 'auto detect' support from series as it needs more work based on feedback * Added patch to combine virVMXFormatHardDisk and virVMXFormatCDROM into one function. * Converted to <disk type='block' device='lun'> instead of adding a <driver> element to better match the behavior available via QEMU. v2: * Added additional test cases and fixed issues that arose from those Doug Goldstein (4): VMX: Create virVMXFormatDisk() from HD and CD-ROM VMX: Add cdrom-raw dev type from VMWare Fusion VMX: Add a VMWare Fusion 5 configuration for tests VMX: Some serial ports are not actually connected docs/formatdomain.html.in | 3 +- src/libvirt_vmx.syms | 3 +- src/vmx/vmx.c | 216 ++++++++------------- src/vmx/vmx.h | 5 +- tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-device.vmx | 5 + tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-device.xml | 24 +++ .../vmx2xmldata/vmx2xml-cdrom-scsi-raw-device.vmx | 6 + .../vmx2xmldata/vmx2xml-cdrom-scsi-raw-device.xml | 24 +++ tests/vmx2xmldata/vmx2xml-fusion-in-the-wild-1.vmx | 88 +++++++++ tests/vmx2xmldata/vmx2xml-fusion-in-the-wild-1.xml | 38 ++++ tests/vmx2xmltest.c | 4 + tests/xml2vmxdata/xml2vmx-cdrom-ide-raw-device.vmx | 13 ++ tests/xml2vmxdata/xml2vmx-cdrom-ide-raw-device.xml | 14 ++ .../xml2vmxdata/xml2vmx-cdrom-scsi-raw-device.vmx | 14 ++ .../xml2vmxdata/xml2vmx-cdrom-scsi-raw-device.xml | 14 ++ tests/xml2vmxdata/xml2vmx-fusion-in-the-wild-1.vmx | 30 +++ tests/xml2vmxdata/xml2vmx-fusion-in-the-wild-1.xml | 40 ++++ tests/xml2vmxtest.c | 4 + 18 files changed, 400 insertions(+), 145 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/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-raw-device.vmx create mode 100644 tests/xml2vmxdata/xml2vmx-cdrom-ide-raw-device.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

virVMXFormatHardDisk() and virVMXFormatCDROM() duplicated a lot of code from each other and made a lot of nested if checks to build each part of the VMX file. This hopefully simplifies the code path while combining the two functions with no net difference. --- src/libvirt_vmx.syms | 3 +- src/vmx/vmx.c | 192 +++++++++++++++++---------------------------------- src/vmx/vmx.h | 5 +- 3 files changed, 64 insertions(+), 136 deletions(-) diff --git a/src/libvirt_vmx.syms b/src/libvirt_vmx.syms index 206ad44..e673923 100644 --- a/src/libvirt_vmx.syms +++ b/src/libvirt_vmx.syms @@ -6,11 +6,10 @@ virVMXConvertToUTF8; virVMXDomainXMLConfInit; virVMXEscapeHex; -virVMXFormatCDROM; virVMXFormatConfig; +virVMXFormatDisk; virVMXFormatEthernet; virVMXFormatFloppy; -virVMXFormatHardDisk; virVMXFormatParallel; virVMXFormatSerial; virVMXFormatVNC; diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c index 35afe26..f5cb9fe 100644 --- a/src/vmx/vmx.c +++ b/src/vmx/vmx.c @@ -517,7 +517,6 @@ VIR_ENUM_IMPL(virVMXControllerModelSCSI, VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LAST, "UNUSED lsisas1078"); - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Helpers */ @@ -3213,14 +3212,8 @@ virVMXFormatConfig(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virDomainDe for (i = 0; i < def->ndisks; ++i) { switch (def->disks[i]->device) { case VIR_DOMAIN_DISK_DEVICE_DISK: - if (virVMXFormatHardDisk(ctx, def->disks[i], &buffer) < 0) { - goto cleanup; - } - - break; - case VIR_DOMAIN_DISK_DEVICE_CDROM: - if (virVMXFormatCDROM(ctx, def->disks[i], &buffer) < 0) { + if (virVMXFormatDisk(ctx, def->disks[i], &buffer) < 0) { goto cleanup; } @@ -3369,67 +3362,89 @@ virVMXFormatVNC(virDomainGraphicsDefPtr def, virBufferPtr buffer) return 0; } - - int -virVMXFormatHardDisk(virVMXContext *ctx, virDomainDiskDefPtr def, +virVMXFormatDisk(virVMXContext *ctx, virDomainDiskDefPtr def, virBufferPtr buffer) { int controllerOrBus, unit; - const char *busName = NULL; - const char *entryPrefix = NULL; - const char *deviceTypePrefix = NULL; + const char *vmxDeviceType = NULL; char *fileName = NULL; - if (def->device != VIR_DOMAIN_DISK_DEVICE_DISK) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + /* Convert a handful of types to their string values */ + const char *busType = virDomainDiskBusTypeToString(def->bus); + const char *deviceType = virDomainDeviceTypeToString(def->device); + const char *diskType = virDomainDeviceTypeToString(def->type); + + /* If we are dealing with a disk its a .vmdk, otherwise it must be + * an ISO. + */ + const char *fileExt = (def->device == VIR_DOMAIN_DISK_DEVICE_DISK) ? + ".vmdk" : ".iso"; + + /* Check that we got a valid device type */ + if (def->device != VIR_DOMAIN_DISK_DEVICE_DISK && + def->device != VIR_DOMAIN_DISK_DEVICE_CDROM) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Invalid device type supplied: %s"), deviceType); return -1; } - if (def->bus == VIR_DOMAIN_DISK_BUS_SCSI) { - busName = "SCSI"; - entryPrefix = "scsi"; - deviceTypePrefix = "scsi"; + /* We only support type='file' and type='block' */ + if (def->type != VIR_DOMAIN_DISK_TYPE_FILE && + def->type != VIR_DOMAIN_DISK_TYPE_BLOCK) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("%s %s '%s' has unsupported type '%s', expecting " + "'%s' or '%s'"), busType, deviceType, def->dst, diskType, + virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_FILE), + virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_BLOCK)); + return -1; + } + if (def->bus == VIR_DOMAIN_DISK_BUS_SCSI) { if (virVMXSCSIDiskNameToControllerAndUnit(def->dst, &controllerOrBus, &unit) < 0) { return -1; } } else if (def->bus == VIR_DOMAIN_DISK_BUS_IDE) { - busName = "IDE"; - entryPrefix = "ide"; - deviceTypePrefix = "ata"; - if (virVMXIDEDiskNameToBusAndUnit(def->dst, &controllerOrBus, - &unit) < 0) { + &unit) < 0) { return -1; } } else { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unsupported bus type '%s' for harddisk"), - virDomainDiskBusTypeToString(def->bus)); + _("Unsupported bus type '%s' for %s"), + busType, deviceType); return -1; } - if (def->type != VIR_DOMAIN_DISK_TYPE_FILE) { + if (def->device == VIR_DOMAIN_DISK_DEVICE_DISK && + def->type == VIR_DOMAIN_DISK_TYPE_FILE) { + vmxDeviceType = (def->bus == VIR_DOMAIN_DISK_BUS_SCSI) ? + "scsi-hardDisk" : "ata-hardDisk"; + } else if (def->device == VIR_DOMAIN_DISK_DEVICE_CDROM) { + if (def->type == VIR_DOMAIN_DISK_TYPE_FILE) + vmxDeviceType = "cdrom-image"; + else + vmxDeviceType = "atapi-cdrom"; + } else { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("%s harddisk '%s' has unsupported type '%s', expecting '%s'"), - busName, def->dst, virDomainDiskTypeToString(def->type), - virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_FILE)); + _("%s %s '%s' has an unsupported type '%s'"), + busType, deviceType, def->dst, diskType); return -1; } virBufferAsprintf(buffer, "%s%d:%d.present = \"true\"\n", - entryPrefix, controllerOrBus, unit); - virBufferAsprintf(buffer, "%s%d:%d.deviceType = \"%s-hardDisk\"\n", - entryPrefix, controllerOrBus, unit, deviceTypePrefix); + busType, controllerOrBus, unit); + virBufferAsprintf(buffer, "%s%d:%d.deviceType = \"%s\"\n", + busType, controllerOrBus, unit, vmxDeviceType); - if (def->src != NULL) { - if (! virFileHasSuffix(def->src, ".vmdk")) { + if (def->type == VIR_DOMAIN_DISK_TYPE_FILE) { + if (def->src != NULL && ! virFileHasSuffix(def->src, fileExt)) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Image file for %s harddisk '%s' has unsupported suffix, " - "expecting '.vmdk'"), busName, def->dst); - return -1; + _("Image file for %s %s '%s' has " + "unsupported suffix, expecting '%s'"), + busType, deviceType, def->dst, fileExt); + return -1; } fileName = ctx->formatFileName(def->src, ctx->opaque); @@ -3439,19 +3454,24 @@ virVMXFormatHardDisk(virVMXContext *ctx, virDomainDiskDefPtr def, } virBufferAsprintf(buffer, "%s%d:%d.fileName = \"%s\"\n", - entryPrefix, controllerOrBus, unit, fileName); + busType, controllerOrBus, unit, fileName); VIR_FREE(fileName); + } else if (def->type == VIR_DOMAIN_DISK_TYPE_BLOCK) { + if (def->src != NULL) { + virBufferAsprintf(buffer, "%s%d:%d.fileName = \"%s\"\n", + busType, controllerOrBus, unit, def->src); + } } if (def->bus == VIR_DOMAIN_DISK_BUS_SCSI) { if (def->cachemode == VIR_DOMAIN_DISK_CACHE_WRITETHRU) { virBufferAsprintf(buffer, "%s%d:%d.writeThrough = \"true\"\n", - entryPrefix, controllerOrBus, unit); + busType, controllerOrBus, unit); } else if (def->cachemode != VIR_DOMAIN_DISK_CACHE_DEFAULT) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("%s harddisk '%s' has unsupported cache mode '%s'"), - busName, def->dst, + busType, def->dst, virDomainDiskCacheTypeToString(def->cachemode)); return -1; } @@ -3460,94 +3480,6 @@ virVMXFormatHardDisk(virVMXContext *ctx, virDomainDiskDefPtr def, return 0; } - - -int -virVMXFormatCDROM(virVMXContext *ctx, virDomainDiskDefPtr def, - virBufferPtr buffer) -{ - int controllerOrBus, unit; - const char *busName = NULL; - const char *entryPrefix = NULL; - char *fileName = NULL; - - if (def->device != VIR_DOMAIN_DISK_DEVICE_CDROM) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); - return -1; - } - - if (def->bus == VIR_DOMAIN_DISK_BUS_SCSI) { - busName = "SCSI"; - entryPrefix = "scsi"; - - if (virVMXSCSIDiskNameToControllerAndUnit(def->dst, &controllerOrBus, - &unit) < 0) { - return -1; - } - } else if (def->bus == VIR_DOMAIN_DISK_BUS_IDE) { - busName = "IDE"; - entryPrefix = "ide"; - - if (virVMXIDEDiskNameToBusAndUnit(def->dst, &controllerOrBus, - &unit) < 0) { - return -1; - } - } else { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unsupported bus type '%s' for cdrom"), - virDomainDiskBusTypeToString(def->bus)); - return -1; - } - - virBufferAsprintf(buffer, "%s%d:%d.present = \"true\"\n", - entryPrefix, controllerOrBus, unit); - - if (def->type == VIR_DOMAIN_DISK_TYPE_FILE) { - virBufferAsprintf(buffer, "%s%d:%d.deviceType = \"cdrom-image\"\n", - entryPrefix, controllerOrBus, unit); - - if (def->src != NULL) { - if (! virFileHasSuffix(def->src, ".iso")) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Image file for %s cdrom '%s' has unsupported " - "suffix, expecting '.iso'"), busName, def->dst); - return -1; - } - - fileName = ctx->formatFileName(def->src, ctx->opaque); - - if (fileName == NULL) { - return -1; - } - - virBufferAsprintf(buffer, "%s%d:%d.fileName = \"%s\"\n", - entryPrefix, controllerOrBus, unit, fileName); - - 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->src != NULL) { - virBufferAsprintf(buffer, "%s%d:%d.fileName = \"%s\"\n", - entryPrefix, controllerOrBus, unit, def->src); - } - } else { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("%s cdrom '%s' has unsupported type '%s', expecting '%s' " - "or '%s'"), busName, def->dst, - virDomainDiskTypeToString(def->type), - virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_FILE), - virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_BLOCK)); - return -1; - } - - return 0; -} - - - int virVMXFormatFloppy(virVMXContext *ctx, virDomainDiskDefPtr def, virBufferPtr buffer, bool floppy_present[2]) diff --git a/src/vmx/vmx.h b/src/vmx/vmx.h index ec63317..cdf6b76 100644 --- a/src/vmx/vmx.h +++ b/src/vmx/vmx.h @@ -115,12 +115,9 @@ char *virVMXFormatConfig(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, int virVMXFormatVNC(virDomainGraphicsDefPtr def, virBufferPtr buffer); -int virVMXFormatHardDisk(virVMXContext *ctx, virDomainDiskDefPtr def, +int virVMXFormatDisk(virVMXContext *ctx, virDomainDiskDefPtr def, virBufferPtr buffer); -int virVMXFormatCDROM(virVMXContext *ctx, virDomainDiskDefPtr def, - virBufferPtr buffer); - int virVMXFormatFloppy(virVMXContext *ctx, virDomainDiskDefPtr def, virBufferPtr buffer, bool floppy_present[2]); -- 1.8.1.5

On 28.08.2013 23:53, Doug Goldstein wrote:
virVMXFormatHardDisk() and virVMXFormatCDROM() duplicated a lot of code from each other and made a lot of nested if checks to build each part of the VMX file. This hopefully simplifies the code path while combining the two functions with no net difference. --- src/libvirt_vmx.syms | 3 +- src/vmx/vmx.c | 192 +++++++++++++++++---------------------------------- src/vmx/vmx.h | 5 +- 3 files changed, 64 insertions(+), 136 deletions(-)
diff --git a/src/libvirt_vmx.syms b/src/libvirt_vmx.syms index 206ad44..e673923 100644 --- a/src/libvirt_vmx.syms +++ b/src/libvirt_vmx.syms @@ -6,11 +6,10 @@ virVMXConvertToUTF8; virVMXDomainXMLConfInit; virVMXEscapeHex; -virVMXFormatCDROM; virVMXFormatConfig; +virVMXFormatDisk; virVMXFormatEthernet; virVMXFormatFloppy; -virVMXFormatHardDisk; virVMXFormatParallel; virVMXFormatSerial; virVMXFormatVNC; diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c index 35afe26..f5cb9fe 100644 --- a/src/vmx/vmx.c +++ b/src/vmx/vmx.c @@ -517,7 +517,6 @@ VIR_ENUM_IMPL(virVMXControllerModelSCSI, VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LAST, "UNUSED lsisas1078");
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Helpers */ @@ -3213,14 +3212,8 @@ virVMXFormatConfig(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virDomainDe for (i = 0; i < def->ndisks; ++i) { switch (def->disks[i]->device) { case VIR_DOMAIN_DISK_DEVICE_DISK: - if (virVMXFormatHardDisk(ctx, def->disks[i], &buffer) < 0) { - goto cleanup; - } - - break; - case VIR_DOMAIN_DISK_DEVICE_CDROM: - if (virVMXFormatCDROM(ctx, def->disks[i], &buffer) < 0) { + if (virVMXFormatDisk(ctx, def->disks[i], &buffer) < 0) { goto cleanup; }
@@ -3369,67 +3362,89 @@ virVMXFormatVNC(virDomainGraphicsDefPtr def, virBufferPtr buffer) return 0; }
- - int -virVMXFormatHardDisk(virVMXContext *ctx, virDomainDiskDefPtr def, +virVMXFormatDisk(virVMXContext *ctx, virDomainDiskDefPtr def, virBufferPtr buffer) { int controllerOrBus, unit; - const char *busName = NULL; - const char *entryPrefix = NULL; - const char *deviceTypePrefix = NULL; + const char *vmxDeviceType = NULL; char *fileName = NULL;
- if (def->device != VIR_DOMAIN_DISK_DEVICE_DISK) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + /* Convert a handful of types to their string values */ + const char *busType = virDomainDiskBusTypeToString(def->bus); + const char *deviceType = virDomainDeviceTypeToString(def->device); + const char *diskType = virDomainDeviceTypeToString(def->type); + + /* If we are dealing with a disk its a .vmdk, otherwise it must be + * an ISO. + */ + const char *fileExt = (def->device == VIR_DOMAIN_DISK_DEVICE_DISK) ? + ".vmdk" : ".iso"; + + /* Check that we got a valid device type */ + if (def->device != VIR_DOMAIN_DISK_DEVICE_DISK && + def->device != VIR_DOMAIN_DISK_DEVICE_CDROM) {
Indentation looks off.
+ virReportError(VIR_ERR_INTERNAL_ERROR, + _("Invalid device type supplied: %s"), deviceType); return -1; }
- if (def->bus == VIR_DOMAIN_DISK_BUS_SCSI) { - busName = "SCSI"; - entryPrefix = "scsi"; - deviceTypePrefix = "scsi"; + /* We only support type='file' and type='block' */ + if (def->type != VIR_DOMAIN_DISK_TYPE_FILE && + def->type != VIR_DOMAIN_DISK_TYPE_BLOCK) {
And again.
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("%s %s '%s' has unsupported type '%s', expecting " + "'%s' or '%s'"), busType, deviceType, def->dst, diskType,
And again.
+ virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_FILE), + virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_BLOCK)); + return -1; + }
+ if (def->bus == VIR_DOMAIN_DISK_BUS_SCSI) { if (virVMXSCSIDiskNameToControllerAndUnit(def->dst, &controllerOrBus, &unit) < 0) { return -1; } } else if (def->bus == VIR_DOMAIN_DISK_BUS_IDE) { - busName = "IDE"; - entryPrefix = "ide"; - deviceTypePrefix = "ata"; - if (virVMXIDEDiskNameToBusAndUnit(def->dst, &controllerOrBus, - &unit) < 0) { + &unit) < 0) { return -1; } } else { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unsupported bus type '%s' for harddisk"), - virDomainDiskBusTypeToString(def->bus)); + _("Unsupported bus type '%s' for %s"), + busType, deviceType); return -1; }
- if (def->type != VIR_DOMAIN_DISK_TYPE_FILE) { + if (def->device == VIR_DOMAIN_DISK_DEVICE_DISK && + def->type == VIR_DOMAIN_DISK_TYPE_FILE) {
So does it here.
+ vmxDeviceType = (def->bus == VIR_DOMAIN_DISK_BUS_SCSI) ? + "scsi-hardDisk" : "ata-hardDisk"; + } else if (def->device == VIR_DOMAIN_DISK_DEVICE_CDROM) { + if (def->type == VIR_DOMAIN_DISK_TYPE_FILE) + vmxDeviceType = "cdrom-image"; + else + vmxDeviceType = "atapi-cdrom"; + } else { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("%s harddisk '%s' has unsupported type '%s', expecting '%s'"), - busName, def->dst, virDomainDiskTypeToString(def->type), - virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_FILE)); + _("%s %s '%s' has an unsupported type '%s'"), + busType, deviceType, def->dst, diskType); return -1; }
virBufferAsprintf(buffer, "%s%d:%d.present = \"true\"\n", - entryPrefix, controllerOrBus, unit); - virBufferAsprintf(buffer, "%s%d:%d.deviceType = \"%s-hardDisk\"\n", - entryPrefix, controllerOrBus, unit, deviceTypePrefix); + busType, controllerOrBus, unit); + virBufferAsprintf(buffer, "%s%d:%d.deviceType = \"%s\"\n", + busType, controllerOrBus, unit, vmxDeviceType);
- if (def->src != NULL) { - if (! virFileHasSuffix(def->src, ".vmdk")) { + if (def->type == VIR_DOMAIN_DISK_TYPE_FILE) { + if (def->src != NULL && ! virFileHasSuffix(def->src, fileExt)) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Image file for %s harddisk '%s' has unsupported suffix, " - "expecting '.vmdk'"), busName, def->dst); - return -1; + _("Image file for %s %s '%s' has " + "unsupported suffix, expecting '%s'"),
And again.
+ busType, deviceType, def->dst, fileExt); + return -1;
And again.
}
fileName = ctx->formatFileName(def->src, ctx->opaque);
diff --git a/src/vmx/vmx.h b/src/vmx/vmx.h index ec63317..cdf6b76 100644 --- a/src/vmx/vmx.h +++ b/src/vmx/vmx.h @@ -115,12 +115,9 @@ char *virVMXFormatConfig(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt,
int virVMXFormatVNC(virDomainGraphicsDefPtr def, virBufferPtr buffer);
-int virVMXFormatHardDisk(virVMXContext *ctx, virDomainDiskDefPtr def, +int virVMXFormatDisk(virVMXContext *ctx, virDomainDiskDefPtr def, virBufferPtr buffer);
And again.
-int virVMXFormatCDROM(virVMXContext *ctx, virDomainDiskDefPtr def, - virBufferPtr buffer); - int virVMXFormatFloppy(virVMXContext *ctx, virDomainDiskDefPtr def, virBufferPtr buffer, bool floppy_present[2]);
ACK with those fixed. Michal

On Thu, Aug 29, 2013 at 5:19 AM, Michal Privoznik <mprivozn@redhat.com>wrote:
On 28.08.2013 23:53, Doug Goldstein wrote:
virVMXFormatHardDisk() and virVMXFormatCDROM() duplicated a lot of code from each other and made a lot of nested if checks to build each part of the VMX file. This hopefully simplifies the code path while combining the two functions with no net difference. --- src/libvirt_vmx.syms | 3 +- src/vmx/vmx.c | 192 +++++++++++++++++---------------------------------- src/vmx/vmx.h | 5 +- 3 files changed, 64 insertions(+), 136 deletions(-)
diff --git a/src/libvirt_vmx.syms b/src/libvirt_vmx.syms index 206ad44..e673923 100644 --- a/src/libvirt_vmx.syms +++ b/src/libvirt_vmx.syms @@ -6,11 +6,10 @@ virVMXConvertToUTF8; virVMXDomainXMLConfInit; virVMXEscapeHex; -virVMXFormatCDROM; virVMXFormatConfig; +virVMXFormatDisk; virVMXFormatEthernet; virVMXFormatFloppy; -virVMXFormatHardDisk; virVMXFormatParallel; virVMXFormatSerial; virVMXFormatVNC; diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c index 35afe26..f5cb9fe 100644 --- a/src/vmx/vmx.c +++ b/src/vmx/vmx.c @@ -517,7 +517,6 @@ VIR_ENUM_IMPL(virVMXControllerModelSCSI, VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LAST, "UNUSED lsisas1078");
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Helpers */ @@ -3213,14 +3212,8 @@ virVMXFormatConfig(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virDomainDe for (i = 0; i < def->ndisks; ++i) { switch (def->disks[i]->device) { case VIR_DOMAIN_DISK_DEVICE_DISK: - if (virVMXFormatHardDisk(ctx, def->disks[i], &buffer) < 0) { - goto cleanup; - } - - break; - case VIR_DOMAIN_DISK_DEVICE_CDROM: - if (virVMXFormatCDROM(ctx, def->disks[i], &buffer) < 0) { + if (virVMXFormatDisk(ctx, def->disks[i], &buffer) < 0) { goto cleanup; }
@@ -3369,67 +3362,89 @@ virVMXFormatVNC(virDomainGraphicsDefPtr def, virBufferPtr buffer) return 0; }
- - int -virVMXFormatHardDisk(virVMXContext *ctx, virDomainDiskDefPtr def, +virVMXFormatDisk(virVMXContext *ctx, virDomainDiskDefPtr def, virBufferPtr buffer) { int controllerOrBus, unit; - const char *busName = NULL; - const char *entryPrefix = NULL; - const char *deviceTypePrefix = NULL; + const char *vmxDeviceType = NULL; char *fileName = NULL;
- if (def->device != VIR_DOMAIN_DISK_DEVICE_DISK) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); + /* Convert a handful of types to their string values */ + const char *busType = virDomainDiskBusTypeToString(def->bus); + const char *deviceType = virDomainDeviceTypeToString(def->device); + const char *diskType = virDomainDeviceTypeToString(def->type); + + /* If we are dealing with a disk its a .vmdk, otherwise it must be + * an ISO. + */ + const char *fileExt = (def->device == VIR_DOMAIN_DISK_DEVICE_DISK) ? + ".vmdk" : ".iso"; + + /* Check that we got a valid device type */ + if (def->device != VIR_DOMAIN_DISK_DEVICE_DISK && + def->device != VIR_DOMAIN_DISK_DEVICE_CDROM) {
Indentation looks off.
+ virReportError(VIR_ERR_INTERNAL_ERROR, + _("Invalid device type supplied: %s"), deviceType); return -1; }
- if (def->bus == VIR_DOMAIN_DISK_BUS_SCSI) { - busName = "SCSI"; - entryPrefix = "scsi"; - deviceTypePrefix = "scsi"; + /* We only support type='file' and type='block' */ + if (def->type != VIR_DOMAIN_DISK_TYPE_FILE && + def->type != VIR_DOMAIN_DISK_TYPE_BLOCK) {
And again.
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("%s %s '%s' has unsupported type '%s', expecting " + "'%s' or '%s'"), busType, deviceType, def->dst, diskType,
And again.
+ virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_FILE), + virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_BLOCK)); + return -1; + }
+ if (def->bus == VIR_DOMAIN_DISK_BUS_SCSI) { if (virVMXSCSIDiskNameToControllerAndUnit(def->dst, &controllerOrBus, &unit) < 0) { return -1; } } else if (def->bus == VIR_DOMAIN_DISK_BUS_IDE) { - busName = "IDE"; - entryPrefix = "ide"; - deviceTypePrefix = "ata"; - if (virVMXIDEDiskNameToBusAndUnit(def->dst, &controllerOrBus, - &unit) < 0) { + &unit) < 0) { return -1; } } else { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Unsupported bus type '%s' for harddisk"), - virDomainDiskBusTypeToString(def->bus)); + _("Unsupported bus type '%s' for %s"), + busType, deviceType); return -1; }
- if (def->type != VIR_DOMAIN_DISK_TYPE_FILE) { + if (def->device == VIR_DOMAIN_DISK_DEVICE_DISK && + def->type == VIR_DOMAIN_DISK_TYPE_FILE) {
So does it here.
+ vmxDeviceType = (def->bus == VIR_DOMAIN_DISK_BUS_SCSI) ? + "scsi-hardDisk" : "ata-hardDisk"; + } else if (def->device == VIR_DOMAIN_DISK_DEVICE_CDROM) { + if (def->type == VIR_DOMAIN_DISK_TYPE_FILE) + vmxDeviceType = "cdrom-image"; + else + vmxDeviceType = "atapi-cdrom"; + } else { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("%s harddisk '%s' has unsupported type '%s', expecting '%s'"), - busName, def->dst, virDomainDiskTypeToString(def->type), - virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_FILE)); + _("%s %s '%s' has an unsupported type '%s'"), + busType, deviceType, def->dst, diskType); return -1; }
virBufferAsprintf(buffer, "%s%d:%d.present = \"true\"\n", - entryPrefix, controllerOrBus, unit); - virBufferAsprintf(buffer, "%s%d:%d.deviceType = \"%s-hardDisk\"\n", - entryPrefix, controllerOrBus, unit, deviceTypePrefix); + busType, controllerOrBus, unit); + virBufferAsprintf(buffer, "%s%d:%d.deviceType = \"%s\"\n", + busType, controllerOrBus, unit, vmxDeviceType);
- if (def->src != NULL) { - if (! virFileHasSuffix(def->src, ".vmdk")) { + if (def->type == VIR_DOMAIN_DISK_TYPE_FILE) { + if (def->src != NULL && ! virFileHasSuffix(def->src, fileExt)) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Image file for %s harddisk '%s' has unsupported suffix, " - "expecting '.vmdk'"), busName, def->dst); - return -1; + _("Image file for %s %s '%s' has " + "unsupported suffix, expecting '%s'"),
And again.
+ busType, deviceType, def->dst, fileExt); + return -1;
And again.
}
fileName = ctx->formatFileName(def->src, ctx->opaque);
diff --git a/src/vmx/vmx.h b/src/vmx/vmx.h index ec63317..cdf6b76 100644 --- a/src/vmx/vmx.h +++ b/src/vmx/vmx.h @@ -115,12 +115,9 @@ char *virVMXFormatConfig(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt,
int virVMXFormatVNC(virDomainGraphicsDefPtr def, virBufferPtr buffer);
-int virVMXFormatHardDisk(virVMXContext *ctx, virDomainDiskDefPtr def, +int virVMXFormatDisk(virVMXContext *ctx, virDomainDiskDefPtr def, virBufferPtr buffer);
And again.
-int virVMXFormatCDROM(virVMXContext *ctx, virDomainDiskDefPtr def, - virBufferPtr buffer); - int virVMXFormatFloppy(virVMXContext *ctx, virDomainDiskDefPtr def, virBufferPtr buffer, bool floppy_present[2]);
ACK with those fixed.
Michal
Thanks. Fixed and pushed. -- Doug Goldstein

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 the 'device' attribute to be set to 'lun' for a raw acccess CD-ROM such as: <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> --- docs/formatdomain.html.in | 3 +-- src/vmx/vmx.c | 24 +++++++++++++++------- tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-device.vmx | 5 +++++ tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-device.xml | 24 ++++++++++++++++++++++ .../vmx2xmldata/vmx2xml-cdrom-scsi-raw-device.vmx | 6 ++++++ .../vmx2xmldata/vmx2xml-cdrom-scsi-raw-device.xml | 24 ++++++++++++++++++++++ tests/vmx2xmltest.c | 2 ++ tests/xml2vmxdata/xml2vmx-cdrom-ide-raw-device.vmx | 13 ++++++++++++ tests/xml2vmxdata/xml2vmx-cdrom-ide-raw-device.xml | 14 +++++++++++++ .../xml2vmxdata/xml2vmx-cdrom-scsi-raw-device.vmx | 14 +++++++++++++ .../xml2vmxdata/xml2vmx-cdrom-scsi-raw-device.xml | 14 +++++++++++++ tests/xml2vmxtest.c | 2 ++ 12 files changed, 136 insertions(+), 9 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-raw-device.vmx create mode 100644 tests/xml2vmxdata/xml2vmx-cdrom-ide-raw-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 cce179d..b7a5c12 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -1597,8 +1597,7 @@ defaulting to "disk". <p> Using "lun" (<span class="since">since 0.9.10</span>) is only - valid when type is "block" and the target element's "bus" - attribute is "virtio", and behaves identically to "disk", + valid when type is "block", and behaves identically to "disk", except that generic SCSI commands from the guest are accepted and passed through to the physical device. Also note that device='lun' will only be recognized for actual raw devices, diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c index f5cb9fe..bcbb997 100644 --- a/src/vmx/vmx.c +++ b/src/vmx/vmx.c @@ -1936,7 +1936,7 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virConfPtr con virDomainDiskDefPtr *def) { /* - * device = {VIR_DOMAIN_DISK_DEVICE_DISK, VIR_DOMAIN_DISK_DEVICE_CDROM} + * device = {VIR_DOMAIN_DISK_DEVICE_DISK, VIR_DOMAIN_DISK_DEVICE_CDROM, VIR_DOMAIN_DISK_DEVICE_LUN} * busType = VIR_DOMAIN_DISK_BUS_SCSI * controllerOrBus = [0..3] -> controller * unit = [0..6,8..15] @@ -2173,12 +2173,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 { @@ -2217,7 +2218,12 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virConfPtr con } else if (STRCASEEQ(deviceType, "atapi-cdrom")) { (*def)->type = VIR_DOMAIN_DISK_TYPE_BLOCK; (*def)->src = fileName; - + fileName = NULL; + } else if (STRCASEEQ(deviceType, "cdrom-raw")) { + /* Raw access CD-ROMs actually are device='lun' */ + (*def)->device = VIR_DOMAIN_DISK_DEVICE_LUN; + (*def)->type = VIR_DOMAIN_DISK_TYPE_BLOCK; + (*def)->src = fileName; fileName = NULL; } else { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -3213,6 +3219,7 @@ virVMXFormatConfig(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virDomainDe switch (def->disks[i]->device) { case VIR_DOMAIN_DISK_DEVICE_DISK: case VIR_DOMAIN_DISK_DEVICE_CDROM: + case VIR_DOMAIN_DISK_DEVICE_LUN: if (virVMXFormatDisk(ctx, def->disks[i], &buffer) < 0) { goto cleanup; } @@ -3383,7 +3390,8 @@ virVMXFormatDisk(virVMXContext *ctx, virDomainDiskDefPtr def, /* Check that we got a valid device type */ if (def->device != VIR_DOMAIN_DISK_DEVICE_DISK && - def->device != VIR_DOMAIN_DISK_DEVICE_CDROM) { + def->device != VIR_DOMAIN_DISK_DEVICE_CDROM && + def->device != VIR_DOMAIN_DISK_DEVICE_LUN) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Invalid device type supplied: %s"), deviceType); return -1; @@ -3426,6 +3434,8 @@ virVMXFormatDisk(virVMXContext *ctx, virDomainDiskDefPtr def, vmxDeviceType = "cdrom-image"; else vmxDeviceType = "atapi-cdrom"; + } else if (def->device == VIR_DOMAIN_DISK_DEVICE_LUN) { + vmxDeviceType = "cdrom-raw"; } else { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("%s %s '%s' has an unsupported type '%s'"), 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..530a29a --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-device.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='lun'> + <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-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..bca8510 --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-cdrom-scsi-raw-device.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='lun'> + <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/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-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..ef4c7b1 --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-cdrom-ide-raw-device.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='lun'> + <source dev='/dev/scd0'/> + <target dev='hda' bus='ide'/> + </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..253763f --- /dev/null +++ b/tests/xml2vmxdata/xml2vmx-cdrom-scsi-raw-device.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='lun'> + <source dev='/dev/scd0'/> + <target dev='sda' bus='scsi'/> + </disk> + </devices> +</domain> diff --git a/tests/xml2vmxtest.c b/tests/xml2vmxtest.c index 0dffebd..cb1c29c 100644 --- a/tests/xml2vmxtest.c +++ b/tests/xml2vmxtest.c @@ -253,8 +253,10 @@ mymain(void) DO_TEST("cdrom-scsi-file", "cdrom-scsi-file", 4); DO_TEST("cdrom-scsi-device", "cdrom-scsi-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-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 28.08.2013 23:53, 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:
s/>//
- 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 the 'device' attribute to be set to 'lun' for a raw acccess CD-ROM such as: <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> --- docs/formatdomain.html.in | 3 +-- src/vmx/vmx.c | 24 +++++++++++++++------- tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-device.vmx | 5 +++++ tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-device.xml | 24 ++++++++++++++++++++++ .../vmx2xmldata/vmx2xml-cdrom-scsi-raw-device.vmx | 6 ++++++ .../vmx2xmldata/vmx2xml-cdrom-scsi-raw-device.xml | 24 ++++++++++++++++++++++ tests/vmx2xmltest.c | 2 ++ tests/xml2vmxdata/xml2vmx-cdrom-ide-raw-device.vmx | 13 ++++++++++++ tests/xml2vmxdata/xml2vmx-cdrom-ide-raw-device.xml | 14 +++++++++++++ .../xml2vmxdata/xml2vmx-cdrom-scsi-raw-device.vmx | 14 +++++++++++++ .../xml2vmxdata/xml2vmx-cdrom-scsi-raw-device.xml | 14 +++++++++++++ tests/xml2vmxtest.c | 2 ++ 12 files changed, 136 insertions(+), 9 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-raw-device.vmx create mode 100644 tests/xml2vmxdata/xml2vmx-cdrom-ide-raw-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 cce179d..b7a5c12 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -1597,8 +1597,7 @@ defaulting to "disk". <p> Using "lun" (<span class="since">since 0.9.10</span>) is only - valid when type is "block" and the target element's "bus" - attribute is "virtio", and behaves identically to "disk", + valid when type is "block", and behaves identically to "disk", except that generic SCSI commands from the guest are accepted and passed through to the physical device. Also note that device='lun' will only be recognized for actual raw devices, diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c index f5cb9fe..bcbb997 100644 --- a/src/vmx/vmx.c +++ b/src/vmx/vmx.c @@ -1936,7 +1936,7 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virConfPtr con virDomainDiskDefPtr *def) { /* - * device = {VIR_DOMAIN_DISK_DEVICE_DISK, VIR_DOMAIN_DISK_DEVICE_CDROM} + * device = {VIR_DOMAIN_DISK_DEVICE_DISK, VIR_DOMAIN_DISK_DEVICE_CDROM, VIR_DOMAIN_DISK_DEVICE_LUN}
Very long line. ACK with those two nits fixed. Michal

On Thu, Aug 29, 2013 at 5:19 AM, Michal Privoznik <mprivozn@redhat.com>wrote:
On 28.08.2013 23:53, 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:
s/>//
I'm not understanding what you're seeing. I don't see an extra > anywhere.
- 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 the 'device' attribute to be set to 'lun' for a raw acccess CD-ROM such as: <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> --- docs/formatdomain.html.in | 3 +-- src/vmx/vmx.c | 24 +++++++++++++++------- tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-device.vmx | 5 +++++ tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-device.xml | 24 ++++++++++++++++++++++ .../vmx2xmldata/vmx2xml-cdrom-scsi-raw-device.vmx | 6 ++++++ .../vmx2xmldata/vmx2xml-cdrom-scsi-raw-device.xml | 24 ++++++++++++++++++++++ tests/vmx2xmltest.c | 2 ++ tests/xml2vmxdata/xml2vmx-cdrom-ide-raw-device.vmx | 13 ++++++++++++ tests/xml2vmxdata/xml2vmx-cdrom-ide-raw-device.xml | 14 +++++++++++++ .../xml2vmxdata/xml2vmx-cdrom-scsi-raw-device.vmx | 14 +++++++++++++ .../xml2vmxdata/xml2vmx-cdrom-scsi-raw-device.xml | 14 +++++++++++++ tests/xml2vmxtest.c | 2 ++ 12 files changed, 136 insertions(+), 9 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-raw-device.vmx create mode 100644 tests/xml2vmxdata/xml2vmx-cdrom-ide-raw-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 cce179d..b7a5c12 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -1597,8 +1597,7 @@ defaulting to "disk". <p> Using "lun" (<span class="since">since 0.9.10</span>) is only - valid when type is "block" and the target element's "bus" - attribute is "virtio", and behaves identically to "disk", + valid when type is "block", and behaves identically to "disk", except that generic SCSI commands from the guest are accepted and passed through to the physical device. Also note that device='lun' will only be recognized for actual raw devices, diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c index f5cb9fe..bcbb997 100644 --- a/src/vmx/vmx.c +++ b/src/vmx/vmx.c @@ -1936,7 +1936,7 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virConfPtr con virDomainDiskDefPtr *def) { /* - * device = {VIR_DOMAIN_DISK_DEVICE_DISK, VIR_DOMAIN_DISK_DEVICE_CDROM} + * device = {VIR_DOMAIN_DISK_DEVICE_DISK, VIR_DOMAIN_DISK_DEVICE_CDROM, VIR_DOMAIN_DISK_DEVICE_LUN}
Very long line.
Not quite sure what the correct style would be here. Just wrap the LUN or wrap both the CDROM and LUN? The rest of the source code has there lines on 1 long line.
ACK with those two nits fixed.
Michal
-- Doug Goldstein

On 08/29/2013 01:58 PM, Doug Goldstein wrote:
On Thu, Aug 29, 2013 at 5:19 AM, Michal Privoznik <mprivozn@redhat.com>wrote:
On 28.08.2013 23:53, 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:
s/>//
I'm not understanding what you're seeing. I don't see an extra > anywhere.
Probably a case of one mailer turning 'From' into '>From' to avoid it tripping up other mailers, vs. your mailer recognizing and undoing that conversion. Certainly not a problem in the original commit message, but only in how it is presented in mail readers. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

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 | 38 ++++++++++ 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, 200 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..dd8c12a --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-fusion-in-the-wild-1.xml @@ -0,0 +1,38 @@ +<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'> + <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 479c84c..9e6e9fd 100644 --- a/tests/vmx2xmltest.c +++ b/tests/vmx2xmltest.c @@ -286,6 +286,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 cb1c29c..ebd54fc 100644 --- a/tests/xml2vmxtest.c +++ b/tests/xml2vmxtest.c @@ -299,6 +299,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

On 28.08.2013 23:53, Doug Goldstein wrote:
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 | 38 ++++++++++ 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, 200 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..dd8c12a --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-fusion-in-the-wild-1.xml @@ -0,0 +1,38 @@ +<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'>
This fails the test until we add: <source dev='auto detect'/>
+ <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 479c84c..9e6e9fd 100644 --- a/tests/vmx2xmltest.c +++ b/tests/vmx2xmltest.c @@ -286,6 +286,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"
This ^^^
+ide0:0.deviceType = "atapi-cdrom" +ide0:0.fileName = "auto detect"
and this ^^^ line make the testsuite fail.
+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 cb1c29c..ebd54fc 100644 --- a/tests/xml2vmxtest.c +++ b/tests/xml2vmxtest.c @@ -299,6 +299,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);

On Thu, Aug 29, 2013 at 5:19 AM, Michal Privoznik <mprivozn@redhat.com>wrote:
On 28.08.2013 23:53, Doug Goldstein wrote:
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 | 38 ++++++++++ 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, 200 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..dd8c12a --- /dev/null +++ b/tests/vmx2xmldata/vmx2xml-fusion-in-the-wild-1.xml @@ -0,0 +1,38 @@ +<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'>
This fails the test until we add:
<source dev='auto detect'/>
+ <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 479c84c..9e6e9fd 100644 --- a/tests/vmx2xmltest.c +++ b/tests/vmx2xmltest.c @@ -286,6 +286,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"
This ^^^
+ide0:0.deviceType = "atapi-cdrom" +ide0:0.fileName = "auto detect"
and this ^^^ line make the testsuite fail.
Doh. I dropped the "auto detect" patch from the series and I must have tested with it still in. Re-spin coming.
+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 cb1c29c..ebd54fc 100644 --- a/tests/xml2vmxtest.c +++ b/tests/xml2vmxtest.c @@ -299,6 +299,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);
-- Doug Goldstein

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 bcbb997..036e234 100644 --- a/src/vmx/vmx.c +++ b/src/vmx/vmx.c @@ -2702,7 +2702,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

On 28.08.2013 23:53, Doug Goldstein wrote:
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 bcbb997..036e234 100644 --- a/src/vmx/vmx.c +++ b/src/vmx/vmx.c @@ -2702,7 +2702,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 */
ACK Michal

On Thu, Aug 29, 2013 at 5:19 AM, Michal Privoznik <mprivozn@redhat.com>wrote:
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 bcbb997..036e234 100644 --- a/src/vmx/vmx.c +++ b/src/vmx/vmx.c @@ -2702,7 +2702,7 @@ virVMXParseSerial(virVMXContext *ctx, virConfPtr conf, int port,
/* vmx:fileName -> def:data.file.path */ if (virVMXGetConfigString(conf, fileName_name, &fileName, false) <
On 28.08.2013 23:53, Doug Goldstein wrote: 0) {
- goto cleanup; + goto ignore; }
/* vmx:network.endPoint -> def:data.tcp.listen */
ACK
Michal
Pushed. thanks. -- Doug Goldstein

On 28.08.2013 23:53, Doug Goldstein wrote:
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.
v3: * Dropped 'auto detect' support from series as it needs more work based on feedback * Added patch to combine virVMXFormatHardDisk and virVMXFormatCDROM into one function. * Converted to <disk type='block' device='lun'> instead of adding a <driver> element to better match the behavior available via QEMU.
v2: * Added additional test cases and fixed issues that arose from those
Doug Goldstein (4): VMX: Create virVMXFormatDisk() from HD and CD-ROM VMX: Add cdrom-raw dev type from VMWare Fusion VMX: Add a VMWare Fusion 5 configuration for tests VMX: Some serial ports are not actually connected
docs/formatdomain.html.in | 3 +- src/libvirt_vmx.syms | 3 +- src/vmx/vmx.c | 216 ++++++++------------- src/vmx/vmx.h | 5 +- tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-device.vmx | 5 + tests/vmx2xmldata/vmx2xml-cdrom-ide-raw-device.xml | 24 +++ .../vmx2xmldata/vmx2xml-cdrom-scsi-raw-device.vmx | 6 + .../vmx2xmldata/vmx2xml-cdrom-scsi-raw-device.xml | 24 +++ tests/vmx2xmldata/vmx2xml-fusion-in-the-wild-1.vmx | 88 +++++++++ tests/vmx2xmldata/vmx2xml-fusion-in-the-wild-1.xml | 38 ++++ tests/vmx2xmltest.c | 4 + tests/xml2vmxdata/xml2vmx-cdrom-ide-raw-device.vmx | 13 ++ tests/xml2vmxdata/xml2vmx-cdrom-ide-raw-device.xml | 14 ++ .../xml2vmxdata/xml2vmx-cdrom-scsi-raw-device.vmx | 14 ++ .../xml2vmxdata/xml2vmx-cdrom-scsi-raw-device.xml | 14 ++ tests/xml2vmxdata/xml2vmx-fusion-in-the-wild-1.vmx | 30 +++ tests/xml2vmxdata/xml2vmx-fusion-in-the-wild-1.xml | 40 ++++ tests/xml2vmxtest.c | 4 + 18 files changed, 400 insertions(+), 145 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/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-raw-device.vmx create mode 100644 tests/xml2vmxdata/xml2vmx-cdrom-ide-raw-device.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
I've ACKed all except 3/4. However, I think you should wait with push since we are already in the freeze. Michal
participants (3)
-
Doug Goldstein
-
Eric Blake
-
Michal Privoznik