Re: [PATCH v2 09/31] qemu: Change return type of virQEMUCapsFetchCPUDefinitions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Oct 15, 2019 at 05:34:45PM +0200, Jiri Denemark wrote:
The function would return a valid virDomainCapsCPUModelsPtr with empty
CPU models list if query-cpu-definitions exists in QEMU, but returns
GenericError meaning it's not in fact implemented. This behaviour is a
bit strange especially after such virDomainCapsCPUModels structure is
stored in capabilities XML and parsed back, which will result in NULL
virDomainCapsCPUModelsPtr rather than a structure containing nothing.

Let's just keep virDomainCapsCPUModelsPtr NULL if the QMP command is not
implemented and change the return value to int so that callers can
easily check for failure or success.

Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
---

Notes:
   Version 2:
   - new patch

src/qemu/qemu_capabilities.c | 34 +++++++++++++++++++++-------------
src/qemu/qemu_capabilities.h |  5 +++--
src/qemu/qemu_process.c      | 17 ++++++++++-------
3 files changed, 34 insertions(+), 22 deletions(-)


Reviewed-by: Ján Tomko <jtomko@xxxxxxxxxx>

Your call whether you consider squashing in the following, since
VIR_STEAL_PTR still hasn't been eliminated:

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index c8b3b65aad..8e0fae54d7 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -2510,7 +2510,7 @@ virQEMUCapsFetchCPUDefinitions(qemuMonitorPtr mon,
            goto cleanup;
    }

-    VIR_STEAL_PTR(*cpuModels, models);
+    *cpuModels = g_steal_pointer(&models);
    ret = 0;

 cleanup:

Attachment: signature.asc
Description: PGP signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux