On 05/14/2018 06:45 AM, Peter Krempa wrote:
Move it out of the formatter function and let the caller decide this.
s/formatter/format/
I cannot recall our current consistency... Some times we seem to have
the lowest routine make the singular check and other times we have the
caller make the check.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_command.c | 9 +++------
src/qemu/qemu_hotplug.c | 3 +++
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 7df9979cb2..c38dde5a60 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -9687,9 +9687,6 @@ qemuBuildPRManagerInfoProps(const virDomainDiskDef *disk,
*propsret = NULL;
*aliasret = NULL;
- if (!disk->src->pr)
- return 0;
-
if (virStoragePRDefIsManaged(disk->src->pr)) {
if (VIR_STRDUP(alias, qemuDomainGetManagedPRAlias()) < 0)
goto cleanup;
@@ -9725,6 +9722,9 @@ qemuBuildMasterPRCommandLine(virCommandPtr cmd,
for (i = 0; i < def->ndisks; i++) {
const virDomainDiskDef *disk = def->disks[i];
+ if (!disk->src->pr)
+ continue;
+
if (virStoragePRDefIsManaged(disk->src->pr)) {
if (managedAdded)
continue;
@@ -9735,9 +9735,6 @@ qemuBuildMasterPRCommandLine(virCommandPtr cmd,
if (qemuBuildPRManagerInfoProps(disk, &props, &alias) < 0)
goto cleanup;
- if (!props)
- continue;
-
This one seems unrelated... although at this point I'm not sure how it
could happen... I'd say keep it as is unless Michal had some other
reason or maybe remembers what it was there for originally.
John
if (!(tmp =
virQEMUBuildObjectCommandlineFromJSON("pr-manager-helper",
alias,
props)))
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 3a26876c10..6557711ec1 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -395,6 +395,9 @@ qemuMaybeBuildPRManagerInfoProps(virDomainObjPtr vm,
*propsret = NULL;
*aliasret = NULL;
+ if (!disk->src->pr)
+ return 0;
+
if (virStoragePRDefIsManaged(disk->src->pr) &&
priv->prDaemonRunning) {
/* @disk requires qemu-pr-helper but there's already one running. */