From nobody Sat May 18 10:57:17 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=1670335117; cv=none; d=zohomail.com; s=zohoarc; b=IoJtuPoX3HMmWPeZeAzgfc6RaVKOrAhwWH7AnU9FEhiP6U7rX1hDFY44IfaVknEVIaYVsPgF9Xn/qUNwwT43R//i4dMO2A/idUHyJCdA/mPJVax+T3KGi63tcivyDHRdB9LczI4OqfuC47vUANsV5hcDqdlJc8XOelnDrQlriqI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1670335117; 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=Ut/MHFupx8frIaRBnt8KdkXl8Sw3ZqZlWpMVwR4b2nA=; b=epewXJH+ZAH+3ZCQ+Y8RHkCvLTNcdMlL4yGCbNNbQRRLSqtuqTn3NKnwUEv6bGPmxrDnFa6MytgmsghGQa5PKiT4EO1aZpajMrimrgoB8u6hH5aVnex9o7aFwj88TPnU6xxr8Kwy84dDiDLgBp0Z3WlEhvh/jFJoDI6OZPVFazI= 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 1670335116996959.5580404676117; Tue, 6 Dec 2022 05:58:36 -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-413-QVhvyPJFNcG49-7qLhRtdQ-1; Tue, 06 Dec 2022 08:58:32 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6AC1B3C1023C; Tue, 6 Dec 2022 13:58:29 +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 5600D40C2064; Tue, 6 Dec 2022 13:58:29 +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 890FE19465B6; Tue, 6 Dec 2022 13:58:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 95DEA1946586 for ; Tue, 6 Dec 2022 13:58:25 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 7D86B1121314; Tue, 6 Dec 2022 13:58:25 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.43.2.106]) by smtp.corp.redhat.com (Postfix) with ESMTP id 223BE111F3BB for ; Tue, 6 Dec 2022 13:58:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1670335116; 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=Ut/MHFupx8frIaRBnt8KdkXl8Sw3ZqZlWpMVwR4b2nA=; b=VRiTpMaIiuoIoen5KN7w8wN1Zr4f2RxRrbkbcAYLqxPZlOMdQy8xHPFgsXeOSNZPQjQw0j rzaIOQt4mT+IHJhO15QXOU78tzYF1BqlgxEYT+chvqW9ldeGhtzg3gc2fIBjOsBOos7Aht EnDXQQgrpB33Xjh7iYz360blLGIHWDI= X-MC-Unique: QVhvyPJFNcG49-7qLhRtdQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Kristina Hanicova To: libvir-list@redhat.com Subject: [PATCH v2 1/2] qemu: refresh internal domain state after reset Date: Tue, 6 Dec 2022 14:58:18 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 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.1 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: 1670335118975100004 Content-Type: text/plain; charset="utf-8"; x-default="true" Internal domain state may change during the reset and qemu does not always send events about it. In case it happens, internal state of the domain in libvirt would be inconsistent with the internal state in qemu which could cause additional problems (e.g. cdrom tray state can change from open to closed). The solution is to refresh state after a successful reset to query qemu about the current internal domain state. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1824722 Signed-off-by: Kristina Hanicova Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 08ab04b468..4af8a8691c 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 @@ -2026,6 +2027,8 @@ qemuDomainReset(virDomainPtr dom, unsigned int flags) if (state =3D=3D VIR_DOMAIN_CRASHED) virDomainObjSetState(vm, VIR_DOMAIN_PAUSED, VIR_DOMAIN_PAUSED_CRAS= HED); =20 + qemuProcessRefreshState(driver, vm, VIR_ASYNC_JOB_NONE); + endjob: virDomainObjEndJob(vm); =20 --=20 2.38.1 From nobody Sat May 18 10:57:17 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=1670335117; cv=none; d=zohomail.com; s=zohoarc; b=Bt7vJqoQxg+q9DM/XBMByUK0+iJ/B2Mwkn6fsIukbeoSQ8FtASU0x5e7EjIVHtADHxzpwTPj+fYhcIaZ/0mV1kKMj0MoSFPzA6uUKhSztUMv2XSdS5XaGN4sVFj24VbNYMRgjHqL66z7A2MtPhYjHBQAq8lCExHd9eR5EnmL2Zo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1670335117; 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=SaAmvnL6jSp3JXwwLOFUTwjD7ivjlaeju+a4tXwIGqY=; b=nqSbQU6nSgtLQdIUL1DeGHILsUIX5RN3mGaj5YpgKKBzX5B282ih0H41achy6copwVAnmWYVuQm7fKxwM/fUaYBxZQ4K/BmBTemJUZnlZKGWS3YDvlOpBPBim3DWcgCkBDDLXZsSLpTEZWdtbQe1uPmvImv77vBc49/pbRDkAf4= 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 1670335117814325.87789480425045; Tue, 6 Dec 2022 05:58:37 -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-237-Z96JClzjM7a0jR1HX_0yKg-1; Tue, 06 Dec 2022 08:58:32 -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 88E8A88B7AD; Tue, 6 Dec 2022 13:58:29 +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 70C371121314; Tue, 6 Dec 2022 13:58:29 +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 8E97E19465B7; Tue, 6 Dec 2022 13:58:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 2952F1946586 for ; Tue, 6 Dec 2022 13:58:26 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 1D5D51121315; Tue, 6 Dec 2022 13:58:26 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.43.2.106]) by smtp.corp.redhat.com (Postfix) with ESMTP id B6CFF1121314 for ; Tue, 6 Dec 2022 13:58:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1670335116; 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=SaAmvnL6jSp3JXwwLOFUTwjD7ivjlaeju+a4tXwIGqY=; b=TcbYAeUH2+qk8l/fH22nVcbz3DmS4QWAcg8jBcIeQOALB/f7ThBB5/JhxUL4pSH7CY8mcX EsGCmEinv43/7wIeSNdrUSjXzoyEWYlV0xXiC1IqMOYfinacbe9/2Ac0kXWfw6vBqWoosq 6Wf1+w0cVawSOowkZlXhNnjSL1NAG+c= X-MC-Unique: Z96JClzjM7a0jR1HX_0yKg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Kristina Hanicova To: libvir-list@redhat.com Subject: [PATCH v2 2/2] qemu: refresh state after reboot initiated from the guest Date: Tue, 6 Dec 2022 14:58:19 +0100 Message-Id: <2a88288d4d8e04f152978eb6c5481fe7af75c051.1670334970.git.khanicov@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 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: 1670335118966100003 Content-Type: text/plain; charset="utf-8"; x-default="true" Internal 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 Reviewed-by: J=C3=A1n Tomko --- 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 5d81dc7a45..8892f28fce 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -11161,6 +11161,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 4af8a8691c..25a1f6e0fd 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -3922,6 +3922,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; @@ -3973,6 +3986,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 c542be5036..5de55435d2 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