libvirt/qemuMonitorCreateObjectPropsWrap-Open-code-in-qemuBu.patch
yezengruan ab887478b0 update patch with openeuler !58
qemuMonitorJSONSetMigrationParams: Take double pointer for @params
qemuMonitorJSONAddObject: Take double pointer for @props
:qemuMonitorJSONMakeCommandInternal: Clear @arguments when stolen
qemuMonitorAddObject: Fix semantics of @alias
qemuMonitorAddObject: Refactor cleanup
util: json: Replace virJSONValueObjectSteal by virJSONValueObjectRemoveKey
qemu: command: Generate commandline of 'masterKey0' secret via JSON
qemu: command: Generate commandline of 'sev0' sev-guest object via JSON
qemu: command: Generate commandline of iothread objects JSON
qemu: capabilities: Introduce QEMU_CAPS_OBJECT_QAPIFIED
qemu: monitor: Make wrapping of 'props' of 'object-add' optional
qemuMonitorCreateObjectPropsWrap: Open-code in qemuBuildMemoryBackendProps
qemu: monitor: Don't add 'props' wrapper if qemu has QEMU_CAPS_OBJECT_QAPIFIED
qemu: command: Use JSON for QAPIfied -object directly
tests: qemuxml2argv: Validate generation of JSON props for object-add
qemu: capabilities: Enable detection of QEMU_CAPS_OBJECT_QAPIFIED

Signed-off-by: yezengruan <yezengruan@huawei.com>
(cherry picked from commit da25da87c49d1b576b48fd58614ff43833a04f37)
2022-03-24 16:20:58 +08:00

82 lines
2.7 KiB
Diff

From dc2f20399a4ceb0781a5ffca31c251c98579f34d Mon Sep 17 00:00:00 2001
From: Peter Krempa <pkrempa@redhat.com>
Date: Mon, 30 Nov 2020 17:08:46 +0100
Subject: [PATCH 12/16] qemuMonitorCreateObjectPropsWrap: Open-code in
qemuBuildMemoryBackendProps
There's just one caller left. Since qemuBuildMemoryBackendProps is too
complex to be modified for now, just move the adding of 'id' and 'qom'
type directly into the function.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
---
src/qemu/qemu_command.c | 6 ++++--
src/qemu/qemu_monitor.c | 15 ---------------
src/qemu/qemu_monitor.h | 4 ----
3 files changed, 4 insertions(+), 21 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index be51400928..fd3b0baaf8 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3596,10 +3596,12 @@ qemuBuildMemoryBackendProps(virJSONValuePtr *backendProps,
rc = 0;
}
- if (!(*backendProps = qemuMonitorCreateObjectPropsWrap(backendType, alias,
- &props)))
+ if (virJSONValueObjectPrependString(props, "id", alias) < 0 ||
+ virJSONValueObjectPrependString(props, "qom-type", backendType) < 0)
return -1;
+ *backendProps = g_steal_pointer(&props);
+
return rc;
}
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index b7aa824f20..dd1bf925b2 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -2870,21 +2870,6 @@ qemuMonitorAddDeviceArgs(qemuMonitorPtr mon,
}
-virJSONValuePtr
-qemuMonitorCreateObjectPropsWrap(const char *type,
- const char *alias,
- virJSONValuePtr *props)
-{
-
- if (virJSONValueObjectPrependString(*props, "id", alias) < 0 ||
- virJSONValueObjectPrependString(*props, "qom-type", type))
- return NULL;
-
- return g_steal_pointer(props);
-}
-
-
-
/**
* qemuMonitorCreateObjectProps:
* @propsret: returns full object properties
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 561417f6c1..73c8af9e78 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -919,10 +919,6 @@ int qemuMonitorAddDeviceWithFd(qemuMonitorPtr mon,
int qemuMonitorDelDevice(qemuMonitorPtr mon,
const char *devalias);
-virJSONValuePtr qemuMonitorCreateObjectPropsWrap(const char *type,
- const char *alias,
- virJSONValuePtr *props);
-
int qemuMonitorCreateObjectProps(virJSONValuePtr *propsret,
const char *type,
const char *alias,
--
2.27.0