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