From nobody Thu Apr 25 11:59:34 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1669210551; cv=none; d=zohomail.com; s=zohoarc; b=f45itruNEZb2mB18M6dMgTJESuYwQSL6BQ/wUc+3aCisFJOzIqkL4uwy3IfvLFcwcMd/5kmrB2JTaLdRKyU2NNjwDCR54MLbt+kqINo0JNzdmGUYrpEPXe7ihtEtKUGm5sWINOhC4ZJg+ZL3O1rXF8/1380DZ+lbgjL5748H6Fc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1669210551; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=sTKJHpwW5etiBX8eCgEq0BodbzKplmg3m3/HUBuLF5U=; b=TeK0/fVuFiSxzV7HapAxJl5thWTc4Gd6Ht8jcOzEEJXCIKDZo7sTwwyORr+EvfsfsR9fAUOWbufL2nLz60Iwg6DQrPN2xRHFGHpEvmGAausHxUnZJs/ZsECJ7dvp1UHugyfS/VFnbe/kmwBYjW8XGbQeI86j8kYmBpIz8SCAtbw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) 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 1669210551603911.2794978475131; Wed, 23 Nov 2022 05:35:51 -0800 (PST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-446-B72ql2pvPb6s2cc1xoJVwg-1; Wed, 23 Nov 2022 08:35:48 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 18FE185A588; Wed, 23 Nov 2022 13:35:46 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 04BEB112D160; Wed, 23 Nov 2022 13:35:46 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id DAC781946589; Wed, 23 Nov 2022 13:35:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 73CF91946587 for ; Wed, 23 Nov 2022 13:31:31 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 3C1104EA55; Wed, 23 Nov 2022 13:31:31 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.43.2.106]) by smtp.corp.redhat.com (Postfix) with ESMTP id D41944EA4A for ; Wed, 23 Nov 2022 13:31:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669210550; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=sTKJHpwW5etiBX8eCgEq0BodbzKplmg3m3/HUBuLF5U=; b=dbbQHxLB+bhFwIeF7ik987K1lFa9+GjDjGFo+UxYuGGy7u5J+CTAMDIs2mk+eWA/xCVpFW 4uvc85yscigF+HtB9avEDrFBwPFfw/DxnoFmk7BwIDSRNX1YuobrnBYW99u3iDbcnh6kLW ArD01ysspiN33+hAYGFuPjSjegL4bvM= X-MC-Unique: B72ql2pvPb6s2cc1xoJVwg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Kristina Hanicova To: libvir-list@redhat.com Subject: [PATCH 1/2] qemu: refresh state after reset Date: Wed, 23 Nov 2022 14:31:16 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1669210553408100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Domain state may change during the reset and qemu does not always send events about it. In case it happens, the state would be inconsistent with the internal state of qemu which could cause additional problems. The solution is to refresh state after a successful reset to query qemu about the current domain state. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1824722 Signed-off-by: Kristina Hanicova --- src/qemu/qemu_driver.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index ff5a743716..b2060ee843 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -2000,6 +2000,7 @@ qemuDomainReset(virDomainPtr dom, unsigned int flags) int ret =3D -1; qemuDomainObjPrivate *priv; virDomainState state; + virQEMUDriver *driver =3D dom->conn->privateData; =20 virCheckFlags(0, -1); =20 @@ -2023,8 +2024,11 @@ qemuDomainReset(virDomainPtr dom, unsigned int flags) priv->fakeReboot =3D false; =20 state =3D virDomainObjGetState(vm, NULL); - if (state =3D=3D VIR_DOMAIN_CRASHED) + if (state =3D=3D VIR_DOMAIN_CRASHED) { virDomainObjSetState(vm, VIR_DOMAIN_PAUSED, VIR_DOMAIN_PAUSED_CRAS= HED); + } else if (qemuProcessRefreshState(driver, vm, VIR_ASYNC_JOB_NONE) < 0= ) { + goto cleanup; + } =20 endjob: virDomainObjEndJob(vm); --=20 2.38.1 From nobody Thu Apr 25 11:59:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1669211235; cv=none; d=zohomail.com; s=zohoarc; b=nXZ1EkP2ZWurwp520UiUw9MMXsDjhkz3mqZsoZZ73SplXuYLJ0ZB0cJQz1tRd9cMWUIvLpoJR46WVn6fMW/LgQi8pE+72/+5cBtxEfv1IARTWIBS3jyBN28qCmjvagHlUdAOolf6C7r/ga3EnncFsIGR1wbhXTM5NMNCqfRmwjg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1669211235; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=++oE8SDLrMWPkMIT5cvI1eyX+aTB9lIsLDav/6XSOlU=; b=Ch4JBLOMbtJ+VhB6/2KnMG2Ilw97IuXQ/OuVhPqDcrlkXhtDFXvEYCbESmBPCFfQ657s78OQRFzm05gjS+m3gOvgEawOpQD93tJPSLxXIB+J/siNpnIEkACd8vPkOQx72jQ4sq9Aft/yR2rhBLFqN+9Y4gmlsD+kXIW4O4CUi7E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1669211235727955.0059208348534; Wed, 23 Nov 2022 05:47:15 -0800 (PST) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-417-sq2YjZyCPiS6jSoPriMZlQ-1; Wed, 23 Nov 2022 08:47:09 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1D0B83C0F42E; Wed, 23 Nov 2022 13:47:07 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 063FB2024CBE; Wed, 23 Nov 2022 13:47:07 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id D98061946589; Wed, 23 Nov 2022 13:47:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id B16711946587 for ; Wed, 23 Nov 2022 13:31:33 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 95F404EA55; Wed, 23 Nov 2022 13:31:33 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.43.2.106]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3989D4EA4E for ; Wed, 23 Nov 2022 13:31:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669211234; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=++oE8SDLrMWPkMIT5cvI1eyX+aTB9lIsLDav/6XSOlU=; b=Nxrx98XBdj/f9d8BAT96/Ck/SpWBawg4UluvlMRHynr/KWNmmEqrDpwY4I1MGwbcqAI9dT mkgQxSk6zZaHmTl0eM+6+mA0lyQoEKtLN3DiLJhKRRlEDU6fSb0RlkiyW3/tZjVY7R86gH yuqH6uIGJmAVhpE5aSgRH9JHcZ5l5k8= X-MC-Unique: sq2YjZyCPiS6jSoPriMZlQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Kristina Hanicova To: libvir-list@redhat.com Subject: [PATCH 2/2] qemu: refresh state after reboot initiated from the guest Date: Wed, 23 Nov 2022 14:31:17 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1669211237791100003 Content-Type: text/plain; charset="utf-8"; x-default="true" Domain state needs to be refreshed after reset from the guest side because it may be inconsistent with the internal qemu state. Signed-off-by: Kristina Hanicova --- src/qemu/qemu_domain.c | 1 + src/qemu/qemu_domain.h | 1 + src/qemu/qemu_driver.c | 16 ++++++++++++++++ src/qemu/qemu_process.c | 2 ++ 4 files changed, 20 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 8ae458ae45..02d759876a 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -11159,6 +11159,7 @@ qemuProcessEventFree(struct qemuProcessEvent *event) break; case QEMU_PROCESS_EVENT_PR_DISCONNECT: case QEMU_PROCESS_EVENT_UNATTENDED_MIGRATION: + case QEMU_PROCESS_EVENT_RESET: case QEMU_PROCESS_EVENT_LAST: break; } diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index a9af8502d2..2f027fad87 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -448,6 +448,7 @@ typedef enum { QEMU_PROCESS_EVENT_GUEST_CRASHLOADED, QEMU_PROCESS_EVENT_MEMORY_DEVICE_SIZE_CHANGE, QEMU_PROCESS_EVENT_UNATTENDED_MIGRATION, + QEMU_PROCESS_EVENT_RESET, =20 QEMU_PROCESS_EVENT_LAST } qemuProcessEventType; diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index b2060ee843..070a623c43 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -3923,6 +3923,19 @@ processMemoryDeviceSizeChange(virQEMUDriver *driver, } =20 =20 +static void +processResetEvent(virQEMUDriver *driver, + virDomainObj *vm) +{ + if (virDomainObjBeginJob(vm, VIR_JOB_MODIFY) < 0) + return; + + qemuProcessRefreshState(driver, vm, VIR_ASYNC_JOB_NONE); + + virDomainObjEndJob(vm); +} + + static void qemuProcessEventHandler(void *data, void *opaque) { struct qemuProcessEvent *processEvent =3D data; @@ -3974,6 +3987,9 @@ static void qemuProcessEventHandler(void *data, void = *opaque) processEvent->action, processEvent->status); break; + case QEMU_PROCESS_EVENT_RESET: + processResetEvent(driver, vm); + break; case QEMU_PROCESS_EVENT_LAST: break; } diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index e1c18dde90..2ce6dc79ba 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -432,6 +432,8 @@ qemuProcessHandleReset(qemuMonitor *mon G_GNUC_UNUSED, qemuDomainSetFakeReboot(vm, false); qemuDomainSaveStatus(vm); =20 + qemuProcessEventSubmit(vm, QEMU_PROCESS_EVENT_RESET, 0, 0, NULL); + unlock: virObjectUnlock(vm); virObjectEventStateQueue(driver->domainEventState, event); --=20 2.38.1