From nobody Mon Feb 9 02:14:52 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 15307012476351015.9321248585475; Wed, 4 Jul 2018 03:47:27 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D9FFC80F8D; Wed, 4 Jul 2018 10:47:25 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 839DE10018FC; Wed, 4 Jul 2018 10:47:25 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 1EC1218037ED; Wed, 4 Jul 2018 10:47:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w64Al6O4011692 for ; Wed, 4 Jul 2018 06:47:06 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9D4B5215688A; Wed, 4 Jul 2018 10:47:06 +0000 (UTC) Received: from localhost.localdomain (ovpn-204-103.brq.redhat.com [10.40.204.103]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2EAF02156889 for ; Wed, 4 Jul 2018 10:47:06 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Wed, 4 Jul 2018 12:46:55 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 7/7] qemu: Fetch pr-helper process info on reconnect X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 04 Jul 2018 10:47:26 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" If qemu-pr-helper process died while libvirtd was not running no event is emitted. Therefore, when reconnecting to the monitor we must check the qemu-pr-helper process status and act accordingly. Signed-off-by: Michal Privoznik --- src/qemu/qemu_process.c | 78 +++++++++++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 78 insertions(+) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 94b7de76d7..ac148a39e9 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -2069,6 +2069,81 @@ qemuRefreshVirtioChannelState(virQEMUDriverPtr drive= r, return ret; } =20 + +static int +qemuProcessRefreshPRManagerState(virDomainObjPtr vm, + virHashTablePtr info) +{ + qemuDomainObjPrivatePtr priv =3D vm->privateData; + qemuMonitorPRManagerInfoPtr prManagerInfo; + size_t i; + int ret =3D -1; + + for (i =3D 0; i < vm->def->ndisks; i++) { + const char *mgralias; + + mgralias =3D virStorageSourceChainGetManagedPRAlias(vm->def->disks= [i]->src); + + if (!mgralias) + continue; + + if (!(prManagerInfo =3D virHashLookup(info, mgralias))) { + virReportError(VIR_ERR_OPERATION_FAILED, + _("missing info on pr-manager %s"), + mgralias); + goto cleanup; + } + + break; + } + + if (i =3D=3D vm->def->ndisks) { + /* no managed pr-manager, return early. */ + ret =3D 0; + goto cleanup; + } + + priv->prDaemonRunning =3D prManagerInfo->connected; + + if (!priv->prDaemonRunning && + qemuProcessStartManagedPRDaemon(vm) < 0) + goto cleanup; + + ret =3D 0; + cleanup: + return ret; +} + + +static int +qemuRefreshPRManagerState(virQEMUDriverPtr driver, + virDomainObjPtr vm) +{ + qemuDomainObjPrivatePtr priv =3D vm->privateData; + virHashTablePtr info =3D NULL; + int ret =3D -1; + + if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_PR_MANAGER_HELPER)) + return 0; + + if (qemuDomainObjEnterMonitorAsync(driver, vm, QEMU_ASYNC_JOB_NONE) < = 0) + goto cleanup; + + ret =3D qemuMonitorGetPRManagerInfo(priv->mon, &info); + if (qemuDomainObjExitMonitor(driver, vm) < 0) + ret =3D -1; + + if (ret < 0) + goto cleanup; + + ret =3D qemuProcessRefreshPRManagerState(vm, info); + + cleanup: + virHashFree(info); + return ret; +} + + static void qemuRefreshRTC(virQEMUDriverPtr driver, virDomainObjPtr vm) @@ -7722,6 +7797,9 @@ qemuProcessReconnect(void *opaque) if (qemuRefreshVirtioChannelState(driver, obj, QEMU_ASYNC_JOB_NONE) < = 0) goto error; =20 + if (qemuRefreshPRManagerState(driver, obj) < 0) + goto error; + /* If querying of guest's RTC failed, report error, but do not kill th= e domain. */ qemuRefreshRTC(driver, obj); =20 --=20 2.16.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list