|
|
a41c76 |
From e8bd352038f46facdb4891d4df109a3c6351479c Mon Sep 17 00:00:00 2001
|
|
|
a41c76 |
Message-Id: <e8bd352038f46facdb4891d4df109a3c6351479c@dist-git>
|
|
|
a41c76 |
From: Pino Toscano <ptoscano@redhat.com>
|
|
|
a41c76 |
Date: Fri, 20 Mar 2020 13:25:38 +0100
|
|
|
a41c76 |
Subject: [PATCH] vmx: shortcut earlier few 'ignore' cases in virVMXParseDisk()
|
|
|
a41c76 |
MIME-Version: 1.0
|
|
|
a41c76 |
Content-Type: text/plain; charset=UTF-8
|
|
|
a41c76 |
Content-Transfer-Encoding: 8bit
|
|
|
a41c76 |
|
|
|
a41c76 |
Move earlier the checks for skipping a hard disk when parsing a CD-DROM,
|
|
|
a41c76 |
and for skipping a CD-ROM when parsing a hard disk. This should have no
|
|
|
a41c76 |
behaviour changes, and avoids to add repeated checks in following
|
|
|
a41c76 |
commits.
|
|
|
a41c76 |
|
|
|
a41c76 |
Signed-off-by: Pino Toscano <ptoscano@redhat.com>
|
|
|
a41c76 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
a41c76 |
Tested-by: Richard W.M. Jones <rjones@redhat.com>
|
|
|
a41c76 |
https://bugzilla.redhat.com/show_bug.cgi?id=1808610
|
|
|
a41c76 |
(cherry picked from commit 9a469c0d358bf3fd4b4e55b20360620d6fda44b5)
|
|
|
a41c76 |
Signed-off-by: Pino Toscano <ptoscano@redhat.com>
|
|
|
a41c76 |
Message-Id: <20200320122539.141785-2-ptoscano@redhat.com>
|
|
|
a41c76 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
a41c76 |
---
|
|
|
a41c76 |
src/vmx/vmx.c | 48 ++++++++++++++++++++++++------------------------
|
|
|
a41c76 |
1 file changed, 24 insertions(+), 24 deletions(-)
|
|
|
a41c76 |
|
|
|
a41c76 |
diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
|
|
|
a41c76 |
index 4362da6cee..fc4fa1c22b 100644
|
|
|
a41c76 |
--- a/src/vmx/vmx.c
|
|
|
a41c76 |
+++ b/src/vmx/vmx.c
|
|
|
a41c76 |
@@ -2217,7 +2217,21 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virConfPtr con
|
|
|
a41c76 |
|
|
|
a41c76 |
/* Setup virDomainDiskDef */
|
|
|
a41c76 |
if (device == VIR_DOMAIN_DISK_DEVICE_DISK) {
|
|
|
a41c76 |
- if (virStringHasCaseSuffix(fileName, ".vmdk")) {
|
|
|
a41c76 |
+ if (virStringHasCaseSuffix(fileName, ".iso") ||
|
|
|
a41c76 |
+ STREQ(fileName, "emptyBackingString") ||
|
|
|
a41c76 |
+ (deviceType &&
|
|
|
a41c76 |
+ (STRCASEEQ(deviceType, "atapi-cdrom") ||
|
|
|
a41c76 |
+ STRCASEEQ(deviceType, "cdrom-raw") ||
|
|
|
a41c76 |
+ (STRCASEEQ(deviceType, "scsi-passthru") &&
|
|
|
a41c76 |
+ STRPREFIX(fileName, "/vmfs/devices/cdrom/"))))) {
|
|
|
a41c76 |
+ /*
|
|
|
a41c76 |
+ * This function was called in order to parse a harddisk device,
|
|
|
a41c76 |
+ * but .iso files, 'atapi-cdrom', 'cdrom-raw', and 'scsi-passthru'
|
|
|
a41c76 |
+ * CDROM devices are for CDROM devices only. Just ignore it, another
|
|
|
a41c76 |
+ * call to this function to parse a CDROM device may handle it.
|
|
|
a41c76 |
+ */
|
|
|
a41c76 |
+ goto ignore;
|
|
|
a41c76 |
+ } else if (virStringHasCaseSuffix(fileName, ".vmdk")) {
|
|
|
a41c76 |
char *tmp;
|
|
|
a41c76 |
|
|
|
a41c76 |
if (deviceType != NULL) {
|
|
|
a41c76 |
@@ -2253,20 +2267,6 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virConfPtr con
|
|
|
a41c76 |
if (mode)
|
|
|
a41c76 |
(*def)->transient = STRCASEEQ(mode,
|
|
|
a41c76 |
"independent-nonpersistent");
|
|
|
a41c76 |
- } else if (virStringHasCaseSuffix(fileName, ".iso") ||
|
|
|
a41c76 |
- STREQ(fileName, "emptyBackingString") ||
|
|
|
a41c76 |
- (deviceType &&
|
|
|
a41c76 |
- (STRCASEEQ(deviceType, "atapi-cdrom") ||
|
|
|
a41c76 |
- STRCASEEQ(deviceType, "cdrom-raw") ||
|
|
|
a41c76 |
- (STRCASEEQ(deviceType, "scsi-passthru") &&
|
|
|
a41c76 |
- STRPREFIX(fileName, "/vmfs/devices/cdrom/"))))) {
|
|
|
a41c76 |
- /*
|
|
|
a41c76 |
- * This function was called in order to parse a harddisk device,
|
|
|
a41c76 |
- * but .iso files, 'atapi-cdrom', 'cdrom-raw', and 'scsi-passthru'
|
|
|
a41c76 |
- * CDROM devices are for CDROM devices only. Just ignore it, another
|
|
|
a41c76 |
- * call to this function to parse a CDROM device may handle it.
|
|
|
a41c76 |
- */
|
|
|
a41c76 |
- goto ignore;
|
|
|
a41c76 |
} else {
|
|
|
a41c76 |
virReportError(VIR_ERR_INTERNAL_ERROR,
|
|
|
a41c76 |
_("Invalid or not yet handled value '%s' "
|
|
|
a41c76 |
@@ -2276,7 +2276,15 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virConfPtr con
|
|
|
a41c76 |
goto cleanup;
|
|
|
a41c76 |
}
|
|
|
a41c76 |
} else if (device == VIR_DOMAIN_DISK_DEVICE_CDROM) {
|
|
|
a41c76 |
- if (virStringHasCaseSuffix(fileName, ".iso")) {
|
|
|
a41c76 |
+ if (virStringHasCaseSuffix(fileName, ".vmdk")) {
|
|
|
a41c76 |
+ /*
|
|
|
a41c76 |
+ * This function was called in order to parse a CDROM device, but
|
|
|
a41c76 |
+ * .vmdk files are for harddisk devices only. Just ignore it,
|
|
|
a41c76 |
+ * another call to this function to parse a harddisk device may
|
|
|
a41c76 |
+ * handle it.
|
|
|
a41c76 |
+ */
|
|
|
a41c76 |
+ goto ignore;
|
|
|
a41c76 |
+ } else if (virStringHasCaseSuffix(fileName, ".iso")) {
|
|
|
a41c76 |
char *tmp;
|
|
|
a41c76 |
|
|
|
a41c76 |
if (deviceType && STRCASENEQ(deviceType, "cdrom-image")) {
|
|
|
a41c76 |
@@ -2294,14 +2302,6 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virConfPtr con
|
|
|
a41c76 |
goto cleanup;
|
|
|
a41c76 |
}
|
|
|
a41c76 |
VIR_FREE(tmp);
|
|
|
a41c76 |
- } else if (virStringHasCaseSuffix(fileName, ".vmdk")) {
|
|
|
a41c76 |
- /*
|
|
|
a41c76 |
- * This function was called in order to parse a CDROM device, but
|
|
|
a41c76 |
- * .vmdk files are for harddisk devices only. Just ignore it,
|
|
|
a41c76 |
- * another call to this function to parse a harddisk device may
|
|
|
a41c76 |
- * handle it.
|
|
|
a41c76 |
- */
|
|
|
a41c76 |
- goto ignore;
|
|
|
a41c76 |
} else if (deviceType && STRCASEEQ(deviceType, "atapi-cdrom")) {
|
|
|
a41c76 |
virDomainDiskSetType(*def, VIR_STORAGE_TYPE_BLOCK);
|
|
|
a41c76 |
|
|
|
a41c76 |
--
|
|
|
a41c76 |
2.25.1
|
|
|
a41c76 |
|