From nobody Fri Dec 19 20:16:37 2025 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=1629816356; cv=none; d=zohomail.com; s=zohoarc; b=IuD3YaS0G7AnuSTbEHzKVekjgijCEmQFADS7Gscd+RUG4I+Gji7Muz6zcsaSVKY0Z3rfyD2yFM+63boDyP/ZoxxmBJQgfTkkaVaJCRlUTbJ4BAGXe5yTHimBtukItfn+kfT9QNaV6KuztetjwiqsehP1Yd4Xzt0MMdwTC0ZmtEs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1629816356; 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=rUaY+7xG5QofL/3lD0OD9krxol++Nj4SZ7T2D49mT0I=; b=nTeLytlnLBxoYw/TaLTbrAMjRdFGzrEhaAkpEyqw/pSQRN5x3ivzLHmT+C6IJOYtkFFfqwpkEvOE0NVavqSLndcoitBeYyyDCv6KNL+9WYxR9z8R91X0H0TqlKj17ZY71zQa/gMXiF6U/iSwPUkgVZSgVfy7ZPjKfnrdczWMFX8= 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 1629816356411337.12197239469276; Tue, 24 Aug 2021 07:45:56 -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-440-SO4wzgZ9OI-bYfheUb-hBQ-1; Tue, 24 Aug 2021 10:45:53 -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 A2B8E1075641; Tue, 24 Aug 2021 14:45:47 +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 88A4560854; Tue, 24 Aug 2021 14:45:47 +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 5381F181A6D6; Tue, 24 Aug 2021 14:45:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 17OEji8w005939 for ; Tue, 24 Aug 2021 10:45:44 -0400 Received: by smtp.corp.redhat.com (Postfix) id 79B5617D4E; Tue, 24 Aug 2021 14:45:44 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id C30D018432 for ; Tue, 24 Aug 2021 14:45:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629816355; 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=rUaY+7xG5QofL/3lD0OD9krxol++Nj4SZ7T2D49mT0I=; b=TLIE+xNc6SXv24hD8kZW3yrAamOOqKRtCMr3Ka9xzyd6iDamuwdlkRkLSZp4ZbNDKNGMRK y9gLJA34YL5yMkfGFNKnQ8xuya1cm3HhH7l+X5oXtq/K/otJROMXyuAScY9QLOSxNmunmd ETx51OeEe+d8jH+6S6iUT5xPkCEQ0AU= X-MC-Unique: SO4wzgZ9OI-bYfheUb-hBQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 19/22] qemu: command: Always use '-no-shutdown' Date: Tue, 24 Aug 2021 16:44:40 +0200 Message-Id: <32ab547567248eb63e43ca96447da35e2e3c6c2e.1629816141.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.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-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1629816357618100005 Content-Type: text/plain; charset="utf-8" The '-no-shutdown' flag prevents qemu from terminating if a shutdown was requested. Libvirt will handle the termination of the qemu process anyways and using this consistently will allow greater flexibility for the virDomainSetLifecycleAction API as well as will allow using the 'system-reset' QMP command during startup to reinitiate devices exported to the firmware. This efectively partially reverts 0e034efaf9b963760516a65413fd9771034357aa Signed-off-by: Peter Krempa --- src/qemu/qemu_command.c | 12 +++++++++--- src/qemu/qemu_process.c | 4 +++- .../misc-no-reboot.x86_64-latest.args | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 5b743dd1ad..b230314f7f 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6165,10 +6165,16 @@ qemuBuildPMCommandLine(virCommand *cmd, { virQEMUCaps *qemuCaps =3D priv->qemuCaps; - if (priv->allowReboot =3D=3D VIR_TRISTATE_BOOL_NO) - virCommandAddArg(cmd, "-no-reboot"); - else + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_SET_ACTION)) { + /* with new qemu we always want '-no-shutdown' on startup and we s= et + * all the other behaviour later during startup */ virCommandAddArg(cmd, "-no-shutdown"); + } else { + if (priv->allowReboot =3D=3D VIR_TRISTATE_BOOL_NO) + virCommandAddArg(cmd, "-no-reboot"); + else + virCommandAddArg(cmd, "-no-shutdown"); + } if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_NO_ACPI)) { if (def->features[VIR_DOMAIN_FEATURE_ACPI] !=3D VIR_TRISTATE_SWITC= H_ON) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index c41c6ab793..bbcef47885 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -8765,7 +8765,9 @@ qemuProcessReconnect(void *opaque) * domain crashed; otherwise, if the monitor was started, * then we can blame ourselves, else we failed before the * monitor started so we don't really know. */ - if (!priv->mon && tryMonReconn && priv->allowReboot =3D=3D VIR_TRI= STATE_BOOL_YES) + if (!priv->mon && tryMonReconn && + (priv->allowReboot =3D=3D VIR_TRISTATE_BOOL_YES || + virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_SET_ACTION))) state =3D VIR_DOMAIN_SHUTOFF_CRASHED; else if (priv->mon) state =3D VIR_DOMAIN_SHUTOFF_DAEMON; diff --git a/tests/qemuxml2argvdata/misc-no-reboot.x86_64-latest.args b/tes= ts/qemuxml2argvdata/misc-no-reboot.x86_64-latest.args index 197b6375a7..f34e9c8708 100644 --- a/tests/qemuxml2argvdata/misc-no-reboot.x86_64-latest.args +++ b/tests/qemuxml2argvdata/misc-no-reboot.x86_64-latest.args @@ -23,7 +23,7 @@ XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ -chardev socket,id=3Dcharmonitor,fd=3D1729,server=3Don,wait=3Doff \ -mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ -rtc base=3Dutc \ --no-reboot \ +-no-shutdown \ -no-acpi \ -boot strict=3Don \ -device piix3-usb-uhci,id=3Dusb,bus=3Dpci.0,addr=3D0x1.0x2 \ --=20 2.31.1