vmx: Accept empty fileName for cdrom-image

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>
This commit is contained in:
Michal Privoznik 2023-12-15 14:12:42 +01:00
parent 6828c6eb67
commit 555b9c5827

View 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'"),