On a Tuesday in 2020, Pino Toscano wrote:
It seems like CD-ROMs may have no 'fileName' property
specified in case
there is nothing configured as attachment for the drive. Hence, make
sure that virVMXParseDisk() do not consider it mandatory anymore,
considering it an empty block cdrom device. Sadly virVMXParseDisk() is
used also to parse disk and floppies, so make sure that a NULL fileName
is handled in cdrom-related paths.
https://bugzilla.redhat.com/show_bug.cgi?id=1808610
Signed-off-by: Pino Toscano <ptoscano(a)redhat.com>
---
src/vmx/vmx.c | 22 ++++++++++--------
.../vmx2xmldata/vmx2xml-cdrom-ide-empty-2.vmx | 4 ++++
.../vmx2xmldata/vmx2xml-cdrom-ide-empty-2.xml | 23 +++++++++++++++++++
tests/vmx2xmltest.c | 1 +
4 files changed, 40 insertions(+), 10 deletions(-)
create mode 100644 tests/vmx2xmldata/vmx2xml-cdrom-ide-empty-2.vmx
create mode 100644 tests/vmx2xmldata/vmx2xml-cdrom-ide-empty-2.xml
@@ -2355,7 +2356,8 @@ virVMXParseDisk(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt,
virConfPtr con
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Invalid or not yet handled value '%s' "
"for VMX entry '%s' for device type
'%s'"),
- fileName, fileName_name,
+ fileName ? fileName : "(not present)",
You can use NULLSTR(fileName) to get a "<null>" in the error message.
Also, there is one more virReportError just like this below
in the FLOPPY section.
+ fileName_name,
deviceType ? deviceType : "unknown");
goto cleanup;
}
With the other virReportError touched (I don't care which way):
Reviewed-by: Ján Tomko <jtomko(a)redhat.com>
Jano