[libvirt] [PATCH v2 09/31] qemu: Change return type of virQEMUCapsFetchCPUDefinitions
Ján Tomko
jtomko at redhat.com
Wed Oct 16 10:45:16 UTC 2019
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 at redhat.com>
>---
>
>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 at redhat.com>
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:
-------------- 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/20191016/2dae3bc1/attachment-0001.sig>
More information about the libvir-list
mailing list