diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c index 10fec74..4fd0a1d 100644 --- a/src/vmx/vmx.c +++ b/src/vmx/vmx.c @@ -2234,6 +2234,7 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virConfPtr con (*def)->transient = STRCASEEQ(mode, "independent-nonpersistent"); } else if (virFileHasSuffix(fileName, ".iso") || + STREQ(fileName, "emptyBackingString") || (deviceType && (STRCASEEQ(deviceType, "atapi-cdrom") || STRCASEEQ(deviceType, "cdrom-raw") || @@ -2246,16 +2247,6 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virConfPtr con * call to this function to parse a CDROM device may handle it. */ goto ignore; - } else if (STREQ(fileName, "emptyBackingString")) { - if (deviceType && STRCASENEQ(deviceType, "cdrom-image")) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Expecting VMX entry '%s' to be 'cdrom-image' " - "but found '%s'"), deviceType_name, deviceType); - goto cleanup; - } - - virDomainDiskSetType(*def, VIR_STORAGE_TYPE_FILE); - ignore_value(virDomainDiskSetSource(*def, NULL)); } else { virReportError(VIR_ERR_INTERNAL_ERROR, _("Invalid or not yet handled value '%s' " @@ -3556,7 +3547,7 @@ virVMXFormatDisk(virVMXContext *ctx, virDomainDiskDefPtr def, } fileName = ctx->formatFileName(src, ctx->opaque); - } else { + } else if (def->device == VIR_DOMAIN_DISK_DEVICE_CDROM) { ignore_value(VIR_STRDUP(fileName, "emptyBackingString")); } diff --git a/tests/vmx2xmldata/vmx2xml-cdrom-ide-empty.xml b/tests/vmx2xmldata/vmx2xml-cdrom-ide-empty.xml index 232200b..e086379 100644 --- a/tests/vmx2xmldata/vmx2xml-cdrom-ide-empty.xml +++ b/tests/vmx2xmldata/vmx2xml-cdrom-ide-empty.xml @@ -11,7 +11,7 @@ restart destroy - +
diff --git a/tests/vmx2xmldata/vmx2xml-cdrom-scsi-empty.xml b/tests/vmx2xmldata/vmx2xml-cdrom-scsi-empty.xml index f2e4c75..56ad678 100644 --- a/tests/vmx2xmldata/vmx2xml-cdrom-scsi-empty.xml +++ b/tests/vmx2xmldata/vmx2xml-cdrom-scsi-empty.xml @@ -11,7 +11,7 @@ restart destroy - +