summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Krempa <pkrempa@redhat.com>2018-05-31 13:29:45 +0200
committerPeter Krempa <pkrempa@redhat.com>2018-06-05 08:14:00 +0200
commitb3286a51de8416ce06ff6346d29adb898f8cb645 (patch)
treee28d2e297636cf93ca1b2bc223a6126bdc0f3fb3
parent00bf6cc1697c388b0985946f599c069789b40808 (diff)
downloadlibvirt-b3286a51de8416ce06ff6346d29adb898f8cb645.tar.gz
qemu: command: Return props as return value in qemuBuildPRManagerInfoProps
Also since we don't do any conditional formatting, fix the comment for the function. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
-rw-r--r--src/qemu/qemu_command.c22
-rw-r--r--src/qemu/qemu_command.h3
-rw-r--r--src/qemu/qemu_hotplug.c5
3 files changed, 16 insertions, 14 deletions
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 3b3608a3d8..8b3acf2957 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -9697,20 +9697,20 @@ qemuBuildPanicCommandLine(virCommandPtr cmd,
/**
* qemuBuildPRManagerInfoProps:
* @src: storage source
- * @propsret: Returns JSON object containing properties of the pr-manager-helper object
*
* Build the JSON properties for the pr-manager object.
- *
- * Returns: 0 on success (@propsret is NULL if no properties are needed),
- * -1 on failure (with error message set).
*/
-int
-qemuBuildPRManagerInfoProps(virStorageSourcePtr src,
- virJSONValuePtr *propsret)
+virJSONValuePtr
+qemuBuildPRManagerInfoProps(virStorageSourcePtr src)
{
- return qemuMonitorCreateObjectProps(propsret,
- "pr-manager-helper", src->pr->mgralias,
- "s:path", src->pr->path, NULL);
+ virJSONValuePtr ret = NULL;
+
+ if (qemuMonitorCreateObjectProps(&ret,
+ "pr-manager-helper", src->pr->mgralias,
+ "s:path", src->pr->path, NULL) < 0)
+ return NULL;
+
+ return ret;
}
@@ -9737,7 +9737,7 @@ qemuBuildMasterPRCommandLine(virCommandPtr cmd,
managedAdded = true;
}
- if (qemuBuildPRManagerInfoProps(disk->src, &props) < 0)
+ if (!(props = qemuBuildPRManagerInfoProps(disk->src)))
goto cleanup;
if (virQEMUBuildObjectCommandlineFromJSON(&buf, props) < 0)
diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h
index fc87fa6a59..5bf9461846 100644
--- a/src/qemu/qemu_command.h
+++ b/src/qemu/qemu_command.h
@@ -55,8 +55,7 @@ virCommandPtr qemuBuildCommandLine(virQEMUDriverPtr driver,
int **nicindexes);
/* Generate the object properties for pr-manager */
-int qemuBuildPRManagerInfoProps(virStorageSourcePtr src,
- virJSONValuePtr *propsret);
+virJSONValuePtr qemuBuildPRManagerInfoProps(virStorageSourcePtr src);
/* Generate the object properties for a secret */
int qemuBuildSecretInfoProps(qemuDomainSecretInfoPtr secinfo,
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 121f9a9431..bea8d6ac85 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -400,7 +400,10 @@ qemuMaybeBuildPRManagerInfoProps(virDomainObjPtr vm,
return 0;
}
- return qemuBuildPRManagerInfoProps(disk->src, propsret);
+ if (!(*propsret = qemuBuildPRManagerInfoProps(disk->src)))
+ return -1;
+
+ return 0;
}