From nobody Tue May 7 20:48:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=huawei.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1635153966166991.055585578304; Mon, 25 Oct 2021 02:26:06 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-169-I6Lv_eovOOC8KqZvGzbONA-1; Mon, 25 Oct 2021 05:26:01 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1FC281018722; Mon, 25 Oct 2021 09:25:56 +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 C0C95694B4; Mon, 25 Oct 2021 09:25:55 +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 4CD804E58F; Mon, 25 Oct 2021 09:25:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 19P9Mrkj010336 for ; Mon, 25 Oct 2021 05:22:53 -0400 Received: by smtp.corp.redhat.com (Postfix) id AE25A40CFD10; Mon, 25 Oct 2021 09:22:53 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A990840CFD0E for ; Mon, 25 Oct 2021 09:22:53 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 894EB899EC2 for ; Mon, 25 Oct 2021 09:22:53 +0000 (UTC) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-347-_Sh0IPlLPUyqKeB8TPUmPg-1; Mon, 25 Oct 2021 05:22:51 -0400 Received: from dggeme756-chm.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Hd84d6vrMzbhHK for ; Mon, 25 Oct 2021 16:58:25 +0800 (CST) Received: from huawei.com (10.175.104.170) by dggeme756-chm.china.huawei.com (10.3.19.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.15; Mon, 25 Oct 2021 17:03:03 +0800 X-MC-Unique: I6Lv_eovOOC8KqZvGzbONA-1 X-MC-Unique: _Sh0IPlLPUyqKeB8TPUmPg-1 From: Bihong Yu To: Subject: [PATCH v1 1/2] qemu_process: set fakereboot flags false after processing fakereboot over Date: Mon, 25 Oct 2021 17:04:54 +0800 Message-ID: <20211025090455.372025-2-yubihong@huawei.com> In-Reply-To: <20211025090455.372025-1-yubihong@huawei.com> References: <20211025090455.372025-1-yubihong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.104.170] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggeme756-chm.china.huawei.com (10.3.19.102) X-CFilter-Loop: Reflected X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 19P9Mrkj010336 X-loop: libvir-list@redhat.com Cc: zhengchuan@huawei.com, liangpeng10@huawei.com, wanghao232@huawei.com, xiexiangyou@huawei.com, yubihong@huawei.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1635153966929100001 Content-Type: text/plain; charset="utf-8" During the vm rebooting, the vm could be shut down if the libvirtd is restarted for some reason, which is not expected. We move set fakereboot flags false after processing fakereboot over, so we can ensure that fakereboot process have been executed. Signed-off-by: Bihong Yu --- src/qemu/qemu_process.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 6027b30405..832ce164fb 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -523,6 +523,7 @@ qemuProcessFakeReboot(void *opaque) =20 cleanup: priv->pausedShutdown =3D false; + qemuDomainSetFakeReboot(driver, vm, false); if (ret =3D=3D -1) ignore_value(qemuProcessKill(vm, VIR_QEMU_PROCESS_KILL_FORCE)); virDomainObjEndAPI(&vm); @@ -540,7 +541,6 @@ qemuProcessShutdownOrReboot(virQEMUDriver *driver, g_autofree char *name =3D g_strdup_printf("reboot-%s", vm->def->na= me); virThread th; =20 - qemuDomainSetFakeReboot(driver, vm, false); virObjectRef(vm); if (virThreadCreateFull(&th, false, @@ -551,6 +551,7 @@ qemuProcessShutdownOrReboot(virQEMUDriver *driver, VIR_ERROR(_("Failed to create reboot thread, killing domain")); ignore_value(qemuProcessKill(vm, VIR_QEMU_PROCESS_KILL_NOWAIT)= ); priv->pausedShutdown =3D false; + qemuDomainSetFakeReboot(driver, vm, false); virObjectUnref(vm); } } else { --=20 2.27.0 From nobody Tue May 7 20:48:33 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=huawei.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1635153625131895.9394488959431; Mon, 25 Oct 2021 02:20:25 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-402-9gHoqnW0MLGsH_72iKvvQw-1; Mon, 25 Oct 2021 05:20:20 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0ED7E1006AA2; Mon, 25 Oct 2021 09:20:15 +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 CEC4A60862; Mon, 25 Oct 2021 09:20:14 +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 3210A4E58F; Mon, 25 Oct 2021 09:20:14 +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 19P9KB0u008937 for ; Mon, 25 Oct 2021 05:20:12 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8DA992166B26; Mon, 25 Oct 2021 09:20:11 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 88C842166B25 for ; Mon, 25 Oct 2021 09:20:08 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 79A691066559 for ; Mon, 25 Oct 2021 09:20:08 +0000 (UTC) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-128-xvM8wwWAOIOkbRu6QSg36Q-1; Mon, 25 Oct 2021 05:20:06 -0400 Received: from dggeme756-chm.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Hd89y3B7Rz90S2 for ; Mon, 25 Oct 2021 17:03:02 +0800 (CST) Received: from huawei.com (10.175.104.170) by dggeme756-chm.china.huawei.com (10.3.19.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.15; Mon, 25 Oct 2021 17:03:03 +0800 X-MC-Unique: 9gHoqnW0MLGsH_72iKvvQw-1 X-MC-Unique: xvM8wwWAOIOkbRu6QSg36Q-1 From: Bihong Yu To: Subject: [PATCH v1 2/2] qemu_process: continue to process fakereboot after restarting libvirtd Date: Mon, 25 Oct 2021 17:04:55 +0800 Message-ID: <20211025090455.372025-3-yubihong@huawei.com> In-Reply-To: <20211025090455.372025-1-yubihong@huawei.com> References: <20211025090455.372025-1-yubihong@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.104.170] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggeme756-chm.china.huawei.com (10.3.19.102) X-CFilter-Loop: Reflected X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 19P9KB0u008937 X-loop: libvir-list@redhat.com Cc: zhengchuan@huawei.com, liangpeng10@huawei.com, wanghao232@huawei.com, xiexiangyou@huawei.com, yubihong@huawei.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1635153625612100001 Content-Type: text/plain; charset="utf-8" During the vm rebooting, the vm could be paused if the libvirtd is restarted for some reason, which is not expected. We need continue fakereboot process if fakereboot flags is true and the vm is in paused-user status. Signed-off-by: Bihong Yu Reviewed-by: Michal Privoznik --- src/qemu/qemu_process.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 832ce164fb..a758b96fa6 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -8742,13 +8742,15 @@ qemuProcessReconnect(void *opaque) goto error; } =20 - /* In case the domain shutdown while we were not running, - * we need to finish the shutdown process. And we need to do it after - * we have virQEMUCaps filled in. + /* In case the domain shutdown or fake reboot while we were not runnin= g, + * we need to finish the shutdown or fake reboot process. And we need = to + * do it after we have virQEMUCaps filled in. */ if (state =3D=3D VIR_DOMAIN_SHUTDOWN || (state =3D=3D VIR_DOMAIN_PAUSED && - reason =3D=3D VIR_DOMAIN_PAUSED_SHUTTING_DOWN)) { + reason =3D=3D VIR_DOMAIN_PAUSED_SHUTTING_DOWN) || + (priv->fakeReboot && state =3D=3D VIR_DOMAIN_PAUSED && + reason =3D=3D VIR_DOMAIN_PAUSED_USER)) { VIR_DEBUG("Finishing shutdown sequence for domain %s", obj->def->name); qemuProcessShutdownOrReboot(driver, obj); --=20 2.27.0