[PATCH] vmx: make 'fileName' optional for CD-ROMs
Ján Tomko
jtomko at redhat.com
Tue Mar 17 16:49:06 UTC 2020
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 at 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 at redhat.com>
Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20200317/2c95e7ae/attachment-0001.sig>
More information about the libvir-list
mailing list