From 555b9c58276a753d0c81e36109d7f426f7f5ff06 Mon Sep 17 00:00:00 2001 From: Michal Privoznik Date: Fri, 15 Dec 2023 14:12:42 +0100 Subject: [PATCH] vmx: Accept empty fileName for cdrom-image MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Turns out, there are two ways to specify an empty CD-ROM drive in a .vmx file: 1) .fileName = "emptyBackingString" 2) .fileName = "" While we do parse 1) successfully, the code does not accept 2) and an error is reported. Modify the code to treat both cases the same. Resolves: https://issues.redhat.com/browse/RHEL-19380 Signed-off-by: Michal Privoznik Reviewed-by: Ján Tomko --- src/vmx/vmx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c index 4ac2320251..1ccf1eee75 100644 --- a/src/vmx/vmx.c +++ b/src/vmx/vmx.c @@ -2484,7 +2484,8 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOption *xmlopt, virConf *conf, */ goto ignore; } - } else if (fileName && STREQ(fileName, "emptyBackingString")) { + } else if (fileName && (STREQ(fileName, "") || + STREQ(fileName, "emptyBackingString"))) { if (deviceType && STRCASENEQ(deviceType, "cdrom-image")) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Expecting VMX entry '%1$s' to be 'cdrom-image' but found '%2$s'"),