]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
vmx: Accept empty fileName for cdrom-image
authorMichal Privoznik <mprivozn@redhat.com>
Fri, 15 Dec 2023 13:12:42 +0000 (14:12 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 25 Jan 2024 15:26:45 +0000 (16:26 +0100)
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 <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/vmx/vmx.c

index 4ac2320251e4d52f45d10f1709c99df6f06fea3a..1ccf1eee758290787e208afb2ac8cb77d7460d86 100644 (file)
@@ -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'"),