|
|
9c6c51 |
From deb8789da55b84c99df417f3cd07db52cac8f89b Mon Sep 17 00:00:00 2001
|
|
|
9c6c51 |
Message-Id: <deb8789da55b84c99df417f3cd07db52cac8f89b@dist-git>
|
|
|
9c6c51 |
From: Michal Privoznik <mprivozn@redhat.com>
|
|
|
9c6c51 |
Date: Wed, 11 Jul 2018 17:27:28 +0200
|
|
|
9c6c51 |
Subject: [PATCH] qemu: Fetch pr-helper process info on reconnect
|
|
|
9c6c51 |
MIME-Version: 1.0
|
|
|
9c6c51 |
Content-Type: text/plain; charset=UTF-8
|
|
|
9c6c51 |
Content-Transfer-Encoding: 8bit
|
|
|
9c6c51 |
|
|
|
9c6c51 |
https://bugzilla.redhat.com/show_bug.cgi?id=1470007
|
|
|
9c6c51 |
|
|
|
9c6c51 |
If qemu-pr-helper process died while libvirtd was not running no
|
|
|
9c6c51 |
event is emitted. Therefore, when reconnecting to the monitor we
|
|
|
9c6c51 |
must check the qemu-pr-helper process status and act accordingly.
|
|
|
9c6c51 |
|
|
|
9c6c51 |
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
9c6c51 |
(cherry picked from commit ab435a4be4673a9a38e0315864b9cf4f9bee03e7)
|
|
|
9c6c51 |
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
9c6c51 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
9c6c51 |
---
|
|
|
9c6c51 |
src/qemu/qemu_process.c | 60 +++++++++++++++++++++++++++++++++++++++++
|
|
|
9c6c51 |
1 file changed, 60 insertions(+)
|
|
|
9c6c51 |
|
|
|
9c6c51 |
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
|
|
|
9c6c51 |
index fbc8529f3b..c903a8e5c8 100644
|
|
|
9c6c51 |
--- a/src/qemu/qemu_process.c
|
|
|
9c6c51 |
+++ b/src/qemu/qemu_process.c
|
|
|
9c6c51 |
@@ -2071,6 +2071,63 @@ qemuRefreshVirtioChannelState(virQEMUDriverPtr driver,
|
|
|
9c6c51 |
return ret;
|
|
|
9c6c51 |
}
|
|
|
9c6c51 |
|
|
|
9c6c51 |
+
|
|
|
9c6c51 |
+static int
|
|
|
9c6c51 |
+qemuProcessRefreshPRManagerState(virDomainObjPtr vm,
|
|
|
9c6c51 |
+ virHashTablePtr info)
|
|
|
9c6c51 |
+{
|
|
|
9c6c51 |
+ qemuDomainObjPrivatePtr priv = vm->privateData;
|
|
|
9c6c51 |
+ qemuMonitorPRManagerInfoPtr prManagerInfo;
|
|
|
9c6c51 |
+ const char *managedAlias = qemuDomainGetManagedPRAlias();
|
|
|
9c6c51 |
+ int ret = -1;
|
|
|
9c6c51 |
+
|
|
|
9c6c51 |
+ if (!(prManagerInfo = virHashLookup(info, managedAlias))) {
|
|
|
9c6c51 |
+ virReportError(VIR_ERR_OPERATION_FAILED,
|
|
|
9c6c51 |
+ _("missing info on pr-manager %s"),
|
|
|
9c6c51 |
+ managedAlias);
|
|
|
9c6c51 |
+ goto cleanup;
|
|
|
9c6c51 |
+ }
|
|
|
9c6c51 |
+
|
|
|
9c6c51 |
+ priv->prDaemonRunning = prManagerInfo->connected;
|
|
|
9c6c51 |
+
|
|
|
9c6c51 |
+ if (!priv->prDaemonRunning &&
|
|
|
9c6c51 |
+ qemuProcessStartManagedPRDaemon(vm) < 0)
|
|
|
9c6c51 |
+ goto cleanup;
|
|
|
9c6c51 |
+
|
|
|
9c6c51 |
+ ret = 0;
|
|
|
9c6c51 |
+ cleanup:
|
|
|
9c6c51 |
+ return ret;
|
|
|
9c6c51 |
+}
|
|
|
9c6c51 |
+
|
|
|
9c6c51 |
+
|
|
|
9c6c51 |
+static int
|
|
|
9c6c51 |
+qemuRefreshPRManagerState(virQEMUDriverPtr driver,
|
|
|
9c6c51 |
+ virDomainObjPtr vm)
|
|
|
9c6c51 |
+{
|
|
|
9c6c51 |
+ qemuDomainObjPrivatePtr priv = vm->privateData;
|
|
|
9c6c51 |
+ virHashTablePtr info = NULL;
|
|
|
9c6c51 |
+ int ret = -1;
|
|
|
9c6c51 |
+
|
|
|
9c6c51 |
+ if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_PR_MANAGER_HELPER) ||
|
|
|
9c6c51 |
+ !virDomainDefHasManagedPR(vm->def))
|
|
|
9c6c51 |
+ return 0;
|
|
|
9c6c51 |
+
|
|
|
9c6c51 |
+ qemuDomainObjEnterMonitor(driver, vm);
|
|
|
9c6c51 |
+ ret = qemuMonitorGetPRManagerInfo(priv->mon, &info;;
|
|
|
9c6c51 |
+ if (qemuDomainObjExitMonitor(driver, vm) < 0)
|
|
|
9c6c51 |
+ ret = -1;
|
|
|
9c6c51 |
+
|
|
|
9c6c51 |
+ if (ret < 0)
|
|
|
9c6c51 |
+ goto cleanup;
|
|
|
9c6c51 |
+
|
|
|
9c6c51 |
+ ret = qemuProcessRefreshPRManagerState(vm, info);
|
|
|
9c6c51 |
+
|
|
|
9c6c51 |
+ cleanup:
|
|
|
9c6c51 |
+ virHashFree(info);
|
|
|
9c6c51 |
+ return ret;
|
|
|
9c6c51 |
+}
|
|
|
9c6c51 |
+
|
|
|
9c6c51 |
+
|
|
|
9c6c51 |
static void
|
|
|
9c6c51 |
qemuRefreshRTC(virQEMUDriverPtr driver,
|
|
|
9c6c51 |
virDomainObjPtr vm)
|
|
|
9c6c51 |
@@ -7736,6 +7793,9 @@ qemuProcessReconnect(void *opaque)
|
|
|
9c6c51 |
if (qemuProcessUpdateDevices(driver, obj) < 0)
|
|
|
9c6c51 |
goto error;
|
|
|
9c6c51 |
|
|
|
9c6c51 |
+ if (qemuRefreshPRManagerState(driver, obj) < 0)
|
|
|
9c6c51 |
+ goto error;
|
|
|
9c6c51 |
+
|
|
|
9c6c51 |
qemuProcessReconnectCheckMemAliasOrderMismatch(obj);
|
|
|
9c6c51 |
|
|
|
9c6c51 |
if (qemuConnectAgent(driver, obj) < 0)
|
|
|
9c6c51 |
--
|
|
|
9c6c51 |
2.18.0
|
|
|
9c6c51 |
|