From nobody Sun May 5 12:46:05 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=1627051599; cv=none; d=zohomail.com; s=zohoarc; b=GuG6ZUpRF9dn1MBGtNhbvRRlXMM53Ha3VPbNQsQUGNC6ib6egb5zi9nHG2iAvkh3v3zQgA02o35SOkQ3fJ8OTYz1vyk6MWt7AVOyFWreFI6XifeiFLJ3HpUoUjJYN2KWn9/UtXH51+SWHatukz08ywHgr+PbISGgfCQOKkddHAE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1627051599; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=j8CEfYqzeN1abMXJL0GUNVRHGqr0MSBevy1F4Roc4oI=; b=M9mPj9hyXXTwIGglDGLC2aFsfl9o/o+anT7CmrW2Zi1sXf4lUgoE8DwTu5yIjh99S45hE8dw7R+axAg8CrIGD3XNeSMxtvaZcUI7XXRgnz9mRYxFyrSd3NPqZC2lZqxujeB7QBrRDdouxLJGpslJa3P3uMgXhNUF3m/Tc0eD4ms= 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 1627051599651535.8881228767387; Fri, 23 Jul 2021 07:46:39 -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-368-1aOX4M-BMj2Ef9Ot-J_Nqg-1; Fri, 23 Jul 2021 10:46:32 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 207B7839A49; Fri, 23 Jul 2021 14:46:21 +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 55396610F0; Fri, 23 Jul 2021 14:46:20 +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 EFB0C180B7A2; Fri, 23 Jul 2021 14:46:17 +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 16NEkHVU022399 for ; Fri, 23 Jul 2021 10:46:17 -0400 Received: by smtp.corp.redhat.com (Postfix) id B08E0797C0; Fri, 23 Jul 2021 14:46:16 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.38]) by smtp.corp.redhat.com (Postfix) with ESMTP id 88E9D7EA24 for ; Fri, 23 Jul 2021 14:46:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1627051598; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=j8CEfYqzeN1abMXJL0GUNVRHGqr0MSBevy1F4Roc4oI=; b=DL0VnrQcKUZiGioIvrRxjbqOXuWAxf3pgAcHvRpHPrfx69SXAhDjsDsf7k9/rFHgwcTXFU /oTokdvkl49uksIbznCVf1cClMSXYCGyud1Olrtw+MzCc+Ir0dWiH6ZsYGMiD4Vbo8anZ2 tNtUKlrlnqsdLg2lgoxt8/mzdhUzP9s= X-MC-Unique: 1aOX4M-BMj2Ef9Ot-J_Nqg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH] qemu: process: Ignore 'RESET' event during startup Date: Fri, 23 Jul 2021 16:46:14 +0200 Message-Id: <9a63e6176945b0f1e91c54ee79d318328cffddcc.1627051574.git.pkrempa@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.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.12 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-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1627051601116100001 Content-Type: text/plain; charset="utf-8" In cases when we are adding a disk with sharing backend (and thus hotplugging it) we need to re-initialize ACPI tables so that the VM boots from the correct device. This has a side-effect of emitting the RESET event and handling it which in case when the 'on_reset' policy is set to 'destroy' can even kill the VM. Fix this by ignoring RESET events during startup of the VM. Signed-off-by: Peter Krempa --- src/qemu/qemu_process.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 521fda57da..d6ed4a3943 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -429,12 +429,20 @@ qemuProcessHandleReset(qemuMonitor *mon G_GNUC_UNUSED, void *opaque) { virQEMUDriver *driver =3D opaque; - virObjectEvent *event; + virObjectEvent *event =3D NULL; qemuDomainObjPrivate *priv; g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); virObjectLock(vm); + /* ignore reset events on VM startup. Libvirt in certain instances doe= s a + * reset during startup so that the ACPI tables are re-generated */ + if (vm->state.state =3D=3D VIR_DOMAIN_PAUSED && + vm->state.reason =3D=3D VIR_DOMAIN_PAUSED_STARTING_UP) { + VIR_DEBUG("ignoring reset event during startup"); + goto cleanup; + } + event =3D virDomainEventRebootNewFromObj(vm); priv =3D vm->privateData; if (priv->agent) --=20 2.31.1