From nobody Fri May 3 00:18:48 2024 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=fail(p=none dis=none) header.from=virtuozzo.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1524056756137260.7944674554634; Wed, 18 Apr 2018 06:05:56 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9A7143004403; Wed, 18 Apr 2018 13:05:54 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 66C356C33B; Wed, 18 Apr 2018 13:05:54 +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 0D7C44CAA1; Wed, 18 Apr 2018 13:05:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3ID4htm006211 for ; Wed, 18 Apr 2018 09:04:43 -0400 Received: by smtp.corp.redhat.com (Postfix) id 311DE6C349; Wed, 18 Apr 2018 13:04:43 +0000 (UTC) Received: from mx1.redhat.com (ext-mx03.extmail.prod.ext.phx2.redhat.com [10.5.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2B3506C346 for ; Wed, 18 Apr 2018 13:04:15 +0000 (UTC) Received: from relay.sw.ru (relay.sw.ru [185.231.240.75]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 69662811A7 for ; Wed, 18 Apr 2018 13:03:53 +0000 (UTC) Received: from msk-vpn.virtuozzo.com ([195.214.232.6] helo=dim-vz7.qa.sw.ru) by relay.sw.ru with esmtp (Exim 4.90_1) (envelope-from ) id 1f8mkY-0001r0-PS for libvir-list@redhat.com; Wed, 18 Apr 2018 16:03:50 +0300 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Date: Wed, 18 Apr 2018 16:03:28 +0300 Message-Id: <1524056612-639228-2-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1524056612-639228-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1524056612-639228-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Greylist: Sender passed SPF test, ACL 227 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 18 Apr 2018 13:04:14 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Wed, 18 Apr 2018 13:04:14 +0000 (UTC) for IP:'185.231.240.75' DOMAIN:'relay.sw.ru' HELO:'relay.sw.ru' FROM:'nshirokovskiy@virtuozzo.com' RCPT:'' X-RedHat-Spam-Score: -0.001 (SPF_PASS) 185.231.240.75 relay.sw.ru 185.231.240.75 relay.sw.ru X-Scanned-By: MIMEDefang 2.78 on 10.5.110.27 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/5] qemu: erase synchronous block job cancel mentions in comments 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.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Wed, 18 Apr 2018 13:05:55 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Commit [1] dropped support for synchronous block job cancel. This patch erases remnants from comments. [1] commit 2350d101 "qemu: Remove support for legacy block jobs" Signed-off-by: Nikolay Shirokovskiy --- src/qemu/qemu_driver.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 5c31dfd..d97d2f4 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -16905,13 +16905,12 @@ qemuDomainBlockJobAbort(virDomainPtr dom, if (save) ignore_value(virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm= , driver->caps)); =20 - /* With synchronous block cancel, we must synthesize an event, and - * we silently ignore the ABORT_ASYNC flag. With asynchronous - * block cancel, the event will come from qemu and will update the - * XML as appropriate, but without the ABORT_ASYNC flag, we must - * block to guarantee synchronous operation. We do the waiting - * while still holding the VM job, to prevent newly scheduled - * block jobs from confusing us. */ + /* + * With asynchronous block cancel, the event will come from qemu and w= ill + * update the XML as appropriate, but without the ABORT_ASYNC flag, we= must + * block to guarantee synchronous operation. We do the waiting while = still + * holding the VM job, to prevent newly scheduled block jobs from conf= using + * us. */ if (!async) { qemuDomainDiskPrivatePtr diskPriv =3D QEMU_DOMAIN_DISK_PRIVATE(dis= k); qemuBlockJobUpdate(driver, vm, QEMU_ASYNC_JOB_NONE, disk, NULL); --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 00:18:48 2024 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=fail(p=none dis=none) header.from=virtuozzo.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1524056669177368.94960445612014; Wed, 18 Apr 2018 06:04:29 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E360C3133E67; Wed, 18 Apr 2018 13:04:27 +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 8D1ED805DE; Wed, 18 Apr 2018 13:04:26 +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 33CFC180215E; Wed, 18 Apr 2018 13:04:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3ID4Nnw006135 for ; Wed, 18 Apr 2018 09:04:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id 05E4481F06; Wed, 18 Apr 2018 13:04:23 +0000 (UTC) Received: from mx1.redhat.com (ext-mx15.extmail.prod.ext.phx2.redhat.com [10.5.110.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EF25581F02 for ; Wed, 18 Apr 2018 13:04:19 +0000 (UTC) Received: from relay.sw.ru (relay.sw.ru [185.231.240.75]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5BA5D316422F for ; Wed, 18 Apr 2018 13:03:53 +0000 (UTC) Received: from msk-vpn.virtuozzo.com ([195.214.232.6] helo=dim-vz7.qa.sw.ru) by relay.sw.ru with esmtp (Exim 4.90_1) (envelope-from ) id 1f8mkY-0001r0-SZ for libvir-list@redhat.com; Wed, 18 Apr 2018 16:03:50 +0300 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Date: Wed, 18 Apr 2018 16:03:29 +0300 Message-Id: <1524056612-639228-3-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1524056612-639228-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1524056612-639228-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Greylist: Sender passed SPF test, ACL 227 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Wed, 18 Apr 2018 13:04:14 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Wed, 18 Apr 2018 13:04:14 +0000 (UTC) for IP:'185.231.240.75' DOMAIN:'relay.sw.ru' HELO:'relay.sw.ru' FROM:'nshirokovskiy@virtuozzo.com' RCPT:'' X-RedHat-Spam-Score: -0.001 (SPF_PASS) 185.231.240.75 relay.sw.ru 185.231.240.75 relay.sw.ru X-Scanned-By: MIMEDefang 2.84 on 10.5.110.44 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/5] qemu: monitor: set error flag even in OOM conditions 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.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Wed, 18 Apr 2018 13:04:28 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" lastError.code is used as flag in qemu monitor. Unfortunately due to temporary OOM conditions (very unlikely through as thread local error is allocated on first use) we can fail to set this flag in case of monitor eofs/errors. This can cause hangs. Let's make sure flag is always set in case eofs/errors. Signed-off-by: Nikolay Shirokovskiy --- src/qemu/qemu_monitor.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 7b64752..e3fedd3 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -765,6 +765,11 @@ qemuMonitorIO(int watch, int fd, int events, void *opa= que) virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Error while processing monitor IO")); virCopyLastError(&mon->lastError); + + /* set error code if due to OOM conditions we fail to set it b= efore */ + if (mon->lastError.code =3D=3D VIR_ERR_OK) + mon->lastError.code =3D VIR_ERR_INTERNAL_ERROR; + virResetLastError(); } =20 --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 00:18:48 2024 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=fail(p=none dis=none) header.from=virtuozzo.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1524056669520516.3662571395928; Wed, 18 Apr 2018 06:04:29 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E0C9D80479; Wed, 18 Apr 2018 13:04:27 +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 DAA7417D45; Wed, 18 Apr 2018 13:04:26 +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 5922D180596E; Wed, 18 Apr 2018 13:04:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3ID4N1A006140 for ; Wed, 18 Apr 2018 09:04:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id 49D406B271; Wed, 18 Apr 2018 13:04:23 +0000 (UTC) Received: from mx1.redhat.com (ext-mx11.extmail.prod.ext.phx2.redhat.com [10.5.110.40]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3F44B7BCD2 for ; Wed, 18 Apr 2018 13:04:15 +0000 (UTC) Received: from relay.sw.ru (relay.sw.ru [185.231.240.75]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5BC3C316255D for ; Wed, 18 Apr 2018 13:03:53 +0000 (UTC) Received: from msk-vpn.virtuozzo.com ([195.214.232.6] helo=dim-vz7.qa.sw.ru) by relay.sw.ru with esmtp (Exim 4.90_1) (envelope-from ) id 1f8mkY-0001r0-Vg for libvir-list@redhat.com; Wed, 18 Apr 2018 16:03:51 +0300 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Date: Wed, 18 Apr 2018 16:03:30 +0300 Message-Id: <1524056612-639228-4-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1524056612-639228-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1524056612-639228-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Greylist: Sender passed SPF test, ACL 227 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Wed, 18 Apr 2018 13:04:14 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Wed, 18 Apr 2018 13:04:14 +0000 (UTC) for IP:'185.231.240.75' DOMAIN:'relay.sw.ru' HELO:'relay.sw.ru' FROM:'nshirokovskiy@virtuozzo.com' RCPT:'' X-RedHat-Spam-Score: -0.001 (SPF_PASS) 185.231.240.75 relay.sw.ru 185.231.240.75 relay.sw.ru X-Scanned-By: MIMEDefang 2.84 on 10.5.110.40 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 3/5] utils: export virCopyError 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.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 18 Apr 2018 13:04:28 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Nikolay Shirokovskiy --- src/libvirt_private.syms | 1 + src/util/virerror.c | 12 +++++++++--- src/util/virerror.h | 1 + 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index c550310..c4f70f1 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1700,6 +1700,7 @@ ebtablesRemoveForwardAllowIn; =20 =20 # util/virerror.h +virCopyError; virDispatchError; virErrorCopyNew; virErrorInitialize; diff --git a/src/util/virerror.c b/src/util/virerror.c index c000b00..2ff8a3e 100644 --- a/src/util/virerror.c +++ b/src/util/virerror.c @@ -188,10 +188,16 @@ virErrorGenericFailure(virErrorPtr err) } =20 =20 -/* - * Internal helper to perform a deep copy of an error +/** + * virCopyError: + * @from: error to copy from + * @to: error to copy to + * + * Copy error fields from @from to @to. + * + * Returns 0 on success, -1 on failure. */ -static int +int virCopyError(virErrorPtr from, virErrorPtr to) { diff --git a/src/util/virerror.h b/src/util/virerror.h index 760bfa4..90ac619 100644 --- a/src/util/virerror.h +++ b/src/util/virerror.h @@ -192,6 +192,7 @@ void virReportOOMErrorFull(int domcode, =20 int virSetError(virErrorPtr newerr); virErrorPtr virErrorCopyNew(virErrorPtr err); +int virCopyError(virErrorPtr from, virErrorPtr to); void virDispatchError(virConnectPtr conn); const char *virStrerror(int theerrno, char *errBuf, size_t errBufLen); =20 --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 00:18:48 2024 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=fail(p=none dis=none) header.from=virtuozzo.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1524056748502887.5662957524019; Wed, 18 Apr 2018 06:05:48 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EC50F313259A; Wed, 18 Apr 2018 13:05:46 +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 BF5F817CFD; Wed, 18 Apr 2018 13:05:46 +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 765411805971; Wed, 18 Apr 2018 13:05:46 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3ID4LBH006120 for ; Wed, 18 Apr 2018 09:04:21 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9B9642D334; Wed, 18 Apr 2018 13:04:21 +0000 (UTC) Received: from mx1.redhat.com (ext-mx08.extmail.prod.ext.phx2.redhat.com [10.5.110.32]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8CE23805ED for ; Wed, 18 Apr 2018 13:04:15 +0000 (UTC) Received: from relay.sw.ru (relay.sw.ru [185.231.240.75]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6419EC057FA9 for ; Wed, 18 Apr 2018 13:03:53 +0000 (UTC) Received: from msk-vpn.virtuozzo.com ([195.214.232.6] helo=dim-vz7.qa.sw.ru) by relay.sw.ru with esmtp (Exim 4.90_1) (envelope-from ) id 1f8mkZ-0001r0-42 for libvir-list@redhat.com; Wed, 18 Apr 2018 16:03:51 +0300 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Date: Wed, 18 Apr 2018 16:03:31 +0300 Message-Id: <1524056612-639228-5-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1524056612-639228-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1524056612-639228-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Greylist: Sender passed SPF test, ACL 227 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 18 Apr 2018 13:04:14 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 18 Apr 2018 13:04:14 +0000 (UTC) for IP:'185.231.240.75' DOMAIN:'relay.sw.ru' HELO:'relay.sw.ru' FROM:'nshirokovskiy@virtuozzo.com' RCPT:'' X-RedHat-Spam-Score: -0.001 (SPF_PASS) 185.231.240.75 relay.sw.ru 185.231.240.75 relay.sw.ru X-Scanned-By: MIMEDefang 2.78 on 10.5.110.32 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 4/5] qemu: fix domain object wait to handle monitor errors 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.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Wed, 18 Apr 2018 13:05:47 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Block job abort operation can not handle properly qemu crashes when waiting for abort/pivot completion. Deadlock scenario is next: - qemuDomainBlockJobAbort waits for pivot/abort completion - qemu crashes, then qemuProcessBeginStopJob broadcasts for VM condition and then waits for job condition (taken by qemuDomainBlockJobAbort) - qemuDomainBlockJobAbort awakes but nothing really changed, VM is still active (vm->def->id !=3D -1) so thread starts waiting for completion agai= n. Now two threads are in deadlock. First let's add some condition besides domain active status so that waiting thread can check it when awakes. Second let's move signalling to the place where condition is set, namely monitor eof/error handlers. Having signalling in qemuProcessBeginStopJob is not useful. The patch copies monitor error to domain state because at time waiting thread awakes there can be no monitor and it is useful to report monitor error to user. The patch has a drawback that on destroying a domain when waiting for event from monitor we get not very convinient error message like 'EOF from monitor' from waiting API. On the other hand if qemu crashes this is more useful then 'domain is not running'. The first case will be addressed in another patch. The patch also fixes other places where we wait for event from qemu. Namely handling device removal and tray ejection. Other places which used virDomainObjWait (dump, migration, save) were good because of async jobs which allow concurrent destroy job. Signed-off-by: Nikolay Shirokovskiy --- src/conf/domain_conf.c | 43 ------------------------------------------- src/conf/domain_conf.h | 3 --- src/libvirt_private.syms | 2 -- src/qemu/qemu_domain.c | 45 +++++++++++++++++++++++++++++++++++++++++++= ++ src/qemu/qemu_domain.h | 5 ++++- src/qemu/qemu_driver.c | 6 +++--- src/qemu/qemu_hotplug.c | 4 ++-- src/qemu/qemu_migration.c | 12 ++++++------ src/qemu/qemu_process.c | 27 ++++++++++++++++++++++----- 9 files changed, 82 insertions(+), 65 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index aacd06a..63df651 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -3248,49 +3248,6 @@ virDomainObjBroadcast(virDomainObjPtr vm) } =20 =20 -int -virDomainObjWait(virDomainObjPtr vm) -{ - if (virCondWait(&vm->cond, &vm->parent.lock) < 0) { - virReportSystemError(errno, "%s", - _("failed to wait for domain condition")); - return -1; - } - - if (!virDomainObjIsActive(vm)) { - virReportError(VIR_ERR_OPERATION_FAILED, "%s", - _("domain is not running")); - return -1; - } - - return 0; -} - - -/** - * Waits for domain condition to be triggered for a specific period of tim= e. - * - * Returns: - * -1 in case of error - * 0 on success - * 1 on timeout - */ -int -virDomainObjWaitUntil(virDomainObjPtr vm, - unsigned long long whenms) -{ - if (virCondWaitUntil(&vm->cond, &vm->parent.lock, whenms) < 0) { - if (errno !=3D ETIMEDOUT) { - virReportSystemError(errno, "%s", - _("failed to wait for domain condition")); - return -1; - } - return 1; - } - return 0; -} - - /* * Mark the current VM config as transient. Ensures transient hotplug * operations do not persist past shutdown. diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 68473c3..b08cae7 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2744,9 +2744,6 @@ bool virDomainObjTaint(virDomainObjPtr obj, virDomainTaintFlags taint); =20 void virDomainObjBroadcast(virDomainObjPtr vm); -int virDomainObjWait(virDomainObjPtr vm); -int virDomainObjWaitUntil(virDomainObjPtr vm, - unsigned long long whenms); =20 void virDomainPanicDefFree(virDomainPanicDefPtr panic); void virDomainResourceDefFree(virDomainResourceDefPtr resource); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index c4f70f1..30f8393 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -491,8 +491,6 @@ virDomainObjSetMetadata; virDomainObjSetState; virDomainObjTaint; virDomainObjUpdateModificationImpact; -virDomainObjWait; -virDomainObjWaitUntil; virDomainOSTypeFromString; virDomainOSTypeToString; virDomainParseMemory; diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index f03aa03..4b4052b 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -1930,6 +1930,7 @@ qemuDomainObjPrivateFree(void *data) qemuDomainObjFreeJob(priv); VIR_FREE(priv->lockState); VIR_FREE(priv->origname); + virResetError(&priv->monError); =20 virChrdevFree(priv->devs); =20 @@ -11960,3 +11961,47 @@ qemuProcessEventFree(struct qemuProcessEvent *even= t) } VIR_FREE(event); } + + +/** + * Waits for domain condition to be triggered for a specific period of tim= e. + * if @until is 0 then waits indefinetely. + * + * Returns: + * -1 on error + * 0 on success + * 1 on timeout + */ +int +qemuDomainObjWait(virDomainObjPtr vm, unsigned long long until) +{ + qemuDomainObjPrivatePtr priv =3D vm->privateData; + int rc; + + if (until) + rc =3D virCondWaitUntil(&vm->cond, &vm->parent.lock, until); + else + rc =3D virCondWait(&vm->cond, &vm->parent.lock); + + if (rc < 0) { + if (until && errno =3D=3D ETIMEDOUT) + return 1; + + virReportSystemError(errno, "%s", + _("failed to wait for domain condition")); + return -1; + } + + if (!virDomainObjIsActive(vm)) { + virReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("domain is not running")); + return -1; + } + + if (priv->monError.code !=3D VIR_ERR_OK) { + virSetError(&priv->monError); + return -1; + } + + return 0; +} diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 21e12f6..9cbb5e4 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -258,7 +258,7 @@ struct _qemuDomainObjPrivate { qemuMonitorPtr mon; virDomainChrSourceDefPtr monConfig; bool monJSON; - bool monError; + virError monError; unsigned long long monStart; =20 qemuAgentPtr agent; @@ -1003,4 +1003,7 @@ qemuDomainPrepareDiskSource(virDomainDiskDefPtr disk, qemuDomainObjPrivatePtr priv, virQEMUDriverConfigPtr cfg); =20 +int +qemuDomainObjWait(virDomainObjPtr vm, unsigned long long until); + #endif /* __QEMU_DOMAIN_H__ */ diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index d97d2f4..1cf33bc 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -2747,7 +2747,7 @@ qemuDomainGetControlInfo(virDomainPtr dom, =20 memset(info, 0, sizeof(*info)); =20 - if (priv->monError) { + if (priv->monError.code !=3D VIR_ERR_OK) { info->state =3D VIR_DOMAIN_CONTROL_ERROR; info->details =3D VIR_DOMAIN_CONTROL_ERROR_REASON_MONITOR; } else if (priv->job.active) { @@ -3746,7 +3746,7 @@ qemuDumpWaitForCompletion(virDomainObjPtr vm) =20 VIR_DEBUG("Waiting for dump completion"); while (!priv->job.dumpCompleted && !priv->job.abortJob) { - if (virDomainObjWait(vm) < 0) + if (qemuDomainObjWait(vm, 0) < 0) return -1; } =20 @@ -16915,7 +16915,7 @@ qemuDomainBlockJobAbort(virDomainPtr dom, qemuDomainDiskPrivatePtr diskPriv =3D QEMU_DOMAIN_DISK_PRIVATE(dis= k); qemuBlockJobUpdate(driver, vm, QEMU_ASYNC_JOB_NONE, disk, NULL); while (diskPriv->blockjob) { - if (virDomainObjWait(vm) < 0) { + if (qemuDomainObjWait(vm, 0) < 0) { ret =3D -1; goto endjob; } diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index f0d549d..ec89f71 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -206,7 +206,7 @@ qemuHotplugWaitForTrayEject(virQEMUDriverPtr driver, return -1; =20 while (disk->tray_status !=3D VIR_DOMAIN_DISK_TRAY_OPEN) { - if ((rc =3D virDomainObjWaitUntil(vm, now + CHANGE_MEDIA_TIMEOUT))= < 0) + if ((rc =3D qemuDomainObjWait(vm, now + CHANGE_MEDIA_TIMEOUT)) < 0) return -1; =20 if (rc > 0) { @@ -4675,7 +4675,7 @@ qemuDomainWaitForDeviceRemoval(virDomainObjPtr vm) until +=3D qemuDomainRemoveDeviceWaitTime; =20 while (priv->unplug.alias) { - if ((rc =3D virDomainObjWaitUntil(vm, until)) =3D=3D 1) + if ((rc =3D qemuDomainObjWait(vm, until)) =3D=3D 1) return 0; =20 if (rc < 0) { diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index e523155..5807ca6 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -893,7 +893,7 @@ qemuMigrationSrcCancelDriveMirror(virQEMUDriverPtr driv= er, if (failed && !err) err =3D virSaveLastError(); =20 - if (virDomainObjWait(vm) < 0) + if (qemuDomainObjWait(vm, 0) < 0) goto cleanup; } =20 @@ -1032,7 +1032,7 @@ qemuMigrationSrcDriveMirror(virQEMUDriverPtr driver, goto cleanup; } =20 - if (virDomainObjWait(vm) < 0) + if (qemuDomainObjWait(vm, 0) < 0) goto cleanup; } =20 @@ -1396,7 +1396,7 @@ qemuMigrationSrcWaitForSpice(virDomainObjPtr vm) =20 VIR_DEBUG("Waiting for SPICE to finish migration"); while (!priv->job.spiceMigrated && !priv->job.abortJob) { - if (virDomainObjWait(vm) < 0) + if (qemuDomainObjWait(vm, 0) < 0) return -1; } return 0; @@ -1675,7 +1675,7 @@ qemuMigrationSrcWaitForCompletion(virQEMUDriverPtr dr= iver, return rv; =20 if (events) { - if (virDomainObjWait(vm) < 0) { + if (qemuDomainObjWait(vm, 0) < 0) { jobInfo->status =3D QEMU_DOMAIN_JOB_STATUS_FAILED; return -2; } @@ -1728,7 +1728,7 @@ qemuMigrationDstWaitForCompletion(virQEMUDriverPtr dr= iver, =20 while ((rv =3D qemuMigrationAnyCompleted(driver, vm, asyncJob, NULL, flags)) !=3D 1) { - if (rv < 0 || virDomainObjWait(vm) < 0) + if (rv < 0 || qemuDomainObjWait(vm, 0) < 0) return -1; } =20 @@ -3982,7 +3982,7 @@ qemuMigrationSrcRun(virQEMUDriverPtr driver, if (priv->monJSON) { while (virDomainObjGetState(vm, NULL) =3D=3D VIR_DOMAIN_RUNNING) { priv->signalStop =3D true; - rc =3D virDomainObjWait(vm); + rc =3D qemuDomainObjWait(vm, 0); priv->signalStop =3D false; if (rc < 0) goto error; diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index c0105c8..72e2977 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -267,6 +267,23 @@ qemuConnectAgent(virQEMUDriverPtr driver, virDomainObj= Ptr vm) return 0; } =20 +static void +qemuProcessNotifyMonitorError(virDomainObjPtr vm, + qemuMonitorPtr mon) +{ + qemuDomainObjPrivatePtr priv =3D vm->privateData; + virErrorPtr err =3D qemuMonitorLastError(mon); + + virCopyError(err, &priv->monError); + + /* set error code if due to OOM conditions we fail to set it before */ + if (priv->monError.code =3D=3D VIR_ERR_OK) + priv->monError.code =3D VIR_ERR_INTERNAL_ERROR; + + /* Wake up anything waiting for events from monitor */ + virDomainObjBroadcast(vm); + virFreeError(err); +} =20 /* * This is a callback registered with a qemuMonitorPtr instance, @@ -285,6 +302,8 @@ qemuProcessHandleMonitorEOF(qemuMonitorPtr mon, =20 virObjectLock(vm); =20 + qemuProcessNotifyMonitorError(vm, mon); + VIR_DEBUG("Received EOF on %p '%s'", vm, vm->def->name); =20 priv =3D vm->privateData; @@ -337,7 +356,8 @@ qemuProcessHandleMonitorError(qemuMonitorPtr mon ATTRIB= UTE_UNUSED, =20 virObjectLock(vm); =20 - ((qemuDomainObjPrivatePtr) vm->privateData)->monError =3D true; + qemuProcessNotifyMonitorError(vm, mon); + event =3D virDomainEventControlErrorNewFromObj(vm); qemuDomainEventQueue(driver, event); =20 @@ -5725,7 +5745,7 @@ qemuProcessPrepareDomain(virQEMUDriverPtr driver, goto cleanup; =20 priv->monJSON =3D virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MONITOR_JSO= N); - priv->monError =3D false; + virResetError(&priv->monError); priv->monStart =3D 0; priv->gotShutdown =3D false; =20 @@ -6481,9 +6501,6 @@ qemuProcessBeginStopJob(virQEMUDriverPtr driver, if (qemuProcessKill(vm, killFlags) < 0) goto cleanup; =20 - /* Wake up anything waiting on domain condition */ - virDomainObjBroadcast(vm); - if (qemuDomainObjBeginJob(driver, vm, job) < 0) goto cleanup; =20 --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 00:18:48 2024 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=fail(p=none dis=none) header.from=virtuozzo.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1524056674151955.3742638098208; Wed, 18 Apr 2018 06:04:34 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3A2C8C0587EA; Wed, 18 Apr 2018 13:04:32 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0C55017D45; Wed, 18 Apr 2018 13:04:32 +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 BB6914CA9E; Wed, 18 Apr 2018 13:04:31 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3ID4ODU006153 for ; Wed, 18 Apr 2018 09:04:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9977C18228; Wed, 18 Apr 2018 13:04:24 +0000 (UTC) Received: from mx1.redhat.com (ext-mx07.extmail.prod.ext.phx2.redhat.com [10.5.110.31]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7FE196B27D for ; Wed, 18 Apr 2018 13:04:15 +0000 (UTC) Received: from relay.sw.ru (relay.sw.ru [185.231.240.75]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 52F0CC049D5B for ; Wed, 18 Apr 2018 13:03:53 +0000 (UTC) Received: from msk-vpn.virtuozzo.com ([195.214.232.6] helo=dim-vz7.qa.sw.ru) by relay.sw.ru with esmtp (Exim 4.90_1) (envelope-from ) id 1f8mkZ-0001r0-7J for libvir-list@redhat.com; Wed, 18 Apr 2018 16:03:51 +0300 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Date: Wed, 18 Apr 2018 16:03:32 +0300 Message-Id: <1524056612-639228-6-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1524056612-639228-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1524056612-639228-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Greylist: Sender passed SPF test, ACL 227 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 18 Apr 2018 13:04:14 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 18 Apr 2018 13:04:14 +0000 (UTC) for IP:'185.231.240.75' DOMAIN:'relay.sw.ru' HELO:'relay.sw.ru' FROM:'nshirokovskiy@virtuozzo.com' RCPT:'' X-RedHat-Spam-Score: -0.001 (SPF_PASS) 185.231.240.75 relay.sw.ru 185.231.240.75 relay.sw.ru X-Scanned-By: MIMEDefang 2.78 on 10.5.110.31 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 5/5] qemu: fix races in beingDestroyed usage 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.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 18 Apr 2018 13:04:33 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Clearing beingDestroyed right after acquiring job condition is racy. It is not known when EOF will be delivired. Let's keep this flag set. This makes possible to make a clear distinction between monitor errors/eofs and domain being destroyed in qemuDomainObjWait. Also let's move setting destroyed flag out of qemuProcessBeginStopJob as the function is called from eof handler too. Signed-off-by: Nikolay Shirokovskiy --- src/qemu/qemu_domain.c | 4 ++-- src/qemu/qemu_domain.h | 2 +- src/qemu/qemu_driver.c | 8 +++++++- src/qemu/qemu_process.c | 24 ++++++++++++------------ 4 files changed, 22 insertions(+), 16 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 4b4052b..de8e1d3 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -11992,9 +11992,9 @@ qemuDomainObjWait(virDomainObjPtr vm, unsigned long= long until) return -1; } =20 - if (!virDomainObjIsActive(vm)) { + if (priv->destroyed) { virReportError(VIR_ERR_OPERATION_FAILED, "%s", - _("domain is not running")); + _("domain is destroyed")); return -1; } =20 diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 9cbb5e4..29de437 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -265,7 +265,7 @@ struct _qemuDomainObjPrivate { bool agentError; =20 bool gotShutdown; - bool beingDestroyed; + bool destroyed; char *pidfile; =20 virDomainPCIAddressSetPtr pciaddrs; diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 1cf33bc..2765cee 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -2247,7 +2247,13 @@ qemuDomainDestroyFlags(virDomainPtr dom, state =3D virDomainObjGetState(vm, &reason); starting =3D (state =3D=3D VIR_DOMAIN_PAUSED && reason =3D=3D VIR_DOMAIN_PAUSED_STARTING_UP && - !priv->beingDestroyed); + !priv->destroyed); + + /* We need to prevent monitor EOF callback from doing our work (and + * sending misleading events) while the vm is unlocked inside + * BeginJob/ProcessKill API + */ + priv->destroyed =3D true; =20 if (qemuProcessBeginStopJob(driver, vm, QEMU_JOB_DESTROY, !(flags & VIR_DOMAIN_DESTROY_GRACEFUL)) < = 0) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 72e2977..031410b 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -142,8 +142,8 @@ qemuProcessHandleAgentEOF(qemuAgentPtr agent, goto unlock; } =20 - if (priv->beingDestroyed) { - VIR_DEBUG("Domain is being destroyed, agent EOF is expected"); + if (priv->destroyed) { + VIR_DEBUG("Domain is destroyed, agent EOF is expected"); goto unlock; } =20 @@ -285,6 +285,7 @@ qemuProcessNotifyMonitorError(virDomainObjPtr vm, virFreeError(err); } =20 + /* * This is a callback registered with a qemuMonitorPtr instance, * and to be invoked when the monitor console hits an end of file @@ -307,8 +308,8 @@ qemuProcessHandleMonitorEOF(qemuMonitorPtr mon, VIR_DEBUG("Received EOF on %p '%s'", vm, vm->def->name); =20 priv =3D vm->privateData; - if (priv->beingDestroyed) { - VIR_DEBUG("Domain is being destroyed, EOF is expected"); + if (priv->destroyed) { + VIR_DEBUG("Domain is destroyed, EOF is expected"); goto cleanup; } =20 @@ -5748,6 +5749,7 @@ qemuProcessPrepareDomain(virQEMUDriverPtr driver, virResetError(&priv->monError); priv->monStart =3D 0; priv->gotShutdown =3D false; + priv->destroyed =3D false; =20 VIR_DEBUG("Updating guest CPU definition"); if (qemuProcessUpdateGuestCPU(vm->def, priv->qemuCaps, caps, flags) < = 0) @@ -6488,16 +6490,9 @@ qemuProcessBeginStopJob(virQEMUDriverPtr driver, qemuDomainJob job, bool forceKill) { - qemuDomainObjPrivatePtr priv =3D vm->privateData; unsigned int killFlags =3D forceKill ? VIR_QEMU_PROCESS_KILL_FORCE : 0; int ret =3D -1; =20 - /* We need to prevent monitor EOF callback from doing our work (and - * sending misleading events) while the vm is unlocked inside - * BeginJob/ProcessKill API - */ - priv->beingDestroyed =3D true; - if (qemuProcessKill(vm, killFlags) < 0) goto cleanup; =20 @@ -6507,7 +6502,6 @@ qemuProcessBeginStopJob(virQEMUDriverPtr driver, ret =3D 0; =20 cleanup: - priv->beingDestroyed =3D false; return ret; } =20 @@ -7088,6 +7082,12 @@ qemuProcessAutoDestroy(virDomainObjPtr dom, =20 VIR_DEBUG("Killing domain"); =20 + /* We need to prevent monitor EOF callback from doing our work (and + * sending misleading events) while the vm is unlocked inside + * BeginJob/ProcessKill API + */ + priv->destroyed =3D true; + if (qemuProcessBeginStopJob(driver, dom, QEMU_JOB_DESTROY, true) < 0) goto cleanup; =20 --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list