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)
119 lines
4.4 KiB
Diff
119 lines
4.4 KiB
Diff
From 3c3f616a826b5c0cd1a01faafa2f1f6c71494e05 Mon Sep 17 00:00:00 2001
|
|
From: Peter Krempa <pkrempa@redhat.com>
|
|
Date: Mon, 30 Nov 2020 15:17:34 +0100
|
|
Subject: [PATCH 01/16] qemuMonitorJSONSetMigrationParams: Take double pointer
|
|
for @params
|
|
|
|
This allows simplification of the caller as well as will enable a later
|
|
refactor of qemuMonitorJSONMakeCommandInternal.
|
|
|
|
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
|
|
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
|
|
---
|
|
src/qemu/qemu_migration_params.c | 9 +++------
|
|
src/qemu/qemu_monitor.c | 11 +++--------
|
|
src/qemu/qemu_monitor.h | 2 +-
|
|
src/qemu/qemu_monitor_json.c | 5 +++--
|
|
src/qemu/qemu_monitor_json.h | 2 +-
|
|
5 files changed, 11 insertions(+), 18 deletions(-)
|
|
|
|
diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_params.c
|
|
index 6953badcfe..df9d5d205a 100644
|
|
--- a/src/qemu/qemu_migration_params.c
|
|
+++ b/src/qemu/qemu_migration_params.c
|
|
@@ -880,12 +880,9 @@ qemuMigrationParamsApply(virQEMUDriverPtr driver,
|
|
if (!(params = qemuMigrationParamsToJSON(migParams)))
|
|
goto cleanup;
|
|
|
|
- if (virJSONValueObjectKeysNumber(params) > 0) {
|
|
- rc = qemuMonitorSetMigrationParams(priv->mon, params);
|
|
- params = NULL;
|
|
- if (rc < 0)
|
|
- goto cleanup;
|
|
- }
|
|
+ if (virJSONValueObjectKeysNumber(params) > 0 &&
|
|
+ qemuMonitorSetMigrationParams(priv->mon, ¶ms) < 0)
|
|
+ goto cleanup;
|
|
|
|
ret = 0;
|
|
|
|
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
|
|
index 9f4432ab3a..58a8741bb8 100644
|
|
--- a/src/qemu/qemu_monitor.c
|
|
+++ b/src/qemu/qemu_monitor.c
|
|
@@ -2463,22 +2463,17 @@ qemuMonitorGetMigrationParams(qemuMonitorPtr mon,
|
|
* @mon: Pointer to the monitor object.
|
|
* @params: Migration parameters.
|
|
*
|
|
- * The @params object is consumed and should not be referenced by the caller
|
|
- * after this function returns.
|
|
+ * The @params object is consumed and cleared on success and some errors.
|
|
*
|
|
* Returns 0 on success, -1 on error.
|
|
*/
|
|
int
|
|
qemuMonitorSetMigrationParams(qemuMonitorPtr mon,
|
|
- virJSONValuePtr params)
|
|
+ virJSONValuePtr *params)
|
|
{
|
|
- QEMU_CHECK_MONITOR_GOTO(mon, error);
|
|
+ QEMU_CHECK_MONITOR(mon);
|
|
|
|
return qemuMonitorJSONSetMigrationParams(mon, params);
|
|
-
|
|
- error:
|
|
- virJSONValueFree(params);
|
|
- return -1;
|
|
}
|
|
|
|
|
|
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
|
|
index 83a33b5b0f..561417f6c1 100644
|
|
--- a/src/qemu/qemu_monitor.h
|
|
+++ b/src/qemu/qemu_monitor.h
|
|
@@ -754,7 +754,7 @@ int qemuMonitorSetMigrationCacheSize(qemuMonitorPtr mon,
|
|
int qemuMonitorGetMigrationParams(qemuMonitorPtr mon,
|
|
virJSONValuePtr *params);
|
|
int qemuMonitorSetMigrationParams(qemuMonitorPtr mon,
|
|
- virJSONValuePtr params);
|
|
+ virJSONValuePtr *params);
|
|
|
|
typedef enum {
|
|
QEMU_MONITOR_MIGRATION_STATUS_INACTIVE,
|
|
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
|
|
index 199b73eafe..03af998cb0 100644
|
|
--- a/src/qemu/qemu_monitor_json.c
|
|
+++ b/src/qemu/qemu_monitor_json.c
|
|
@@ -3465,12 +3465,13 @@ qemuMonitorJSONGetMigrationParams(qemuMonitorPtr mon,
|
|
|
|
int
|
|
qemuMonitorJSONSetMigrationParams(qemuMonitorPtr mon,
|
|
- virJSONValuePtr params)
|
|
+ virJSONValuePtr *params)
|
|
{
|
|
g_autoptr(virJSONValue) cmd = NULL;
|
|
g_autoptr(virJSONValue) reply = NULL;
|
|
+ virJSONValuePtr par = g_steal_pointer(params);
|
|
|
|
- if (!(cmd = qemuMonitorJSONMakeCommandInternal("migrate-set-parameters", params)))
|
|
+ if (!(cmd = qemuMonitorJSONMakeCommandInternal("migrate-set-parameters", par)))
|
|
return -1;
|
|
|
|
if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
|
|
diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h
|
|
index dd25e5d6e6..af52372a93 100644
|
|
--- a/src/qemu/qemu_monitor_json.h
|
|
+++ b/src/qemu/qemu_monitor_json.h
|
|
@@ -142,7 +142,7 @@ int qemuMonitorJSONSetMigrationCacheSize(qemuMonitorPtr mon,
|
|
int qemuMonitorJSONGetMigrationParams(qemuMonitorPtr mon,
|
|
virJSONValuePtr *params);
|
|
int qemuMonitorJSONSetMigrationParams(qemuMonitorPtr mon,
|
|
- virJSONValuePtr params);
|
|
+ virJSONValuePtr *params);
|
|
|
|
int qemuMonitorJSONGetMigrationStats(qemuMonitorPtr mon,
|
|
qemuMonitorMigrationStatsPtr stats,
|
|
--
|
|
2.27.0
|
|
|