From nobody Mon May 13 19:41:31 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=openvz.org 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 1649159608439794.8914934455595; Tue, 5 Apr 2022 04:53:28 -0700 (PDT) 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-488-MkQEiN4bNAaiKIbgie29tQ-1; Tue, 05 Apr 2022 07:53:24 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8E604899EF3; Tue, 5 Apr 2022 11:53:21 +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 78AD8C27D98; Tue, 5 Apr 2022 11:53:21 +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 341261940346; Tue, 5 Apr 2022 11:53:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id ACC1A19466DF for ; Tue, 5 Apr 2022 11:53:20 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 05EAE404729C; Tue, 5 Apr 2022 11:53:19 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 02036404729B for ; Tue, 5 Apr 2022 11:53:18 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (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 A7777800B28 for ; Tue, 5 Apr 2022 11:53:08 +0000 (UTC) Received: from mail-lj1-f178.google.com (mail-lj1-f178.google.com [209.85.208.178]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-210-4yhtMad4MY6AB_J1MGt6Ow-1; Tue, 05 Apr 2022 07:53:06 -0400 Received: by mail-lj1-f178.google.com with SMTP id s13so16764707ljd.5 for ; Tue, 05 Apr 2022 04:53:06 -0700 (PDT) Received: from vzbook.. (broadband-90-154-71-96.ip.moscow.rt.ru. [90.154.71.96]) by smtp.gmail.com with ESMTPSA id d6-20020a193846000000b0044a589efadbsm1484620lfj.2.2022.04.05.04.53.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 04:53:03 -0700 (PDT) X-MC-Unique: MkQEiN4bNAaiKIbgie29tQ-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: 4yhtMad4MY6AB_J1MGt6Ow-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=yRv3+a4PFTgSVsNFvwzqyf2n3070Ls/HmLjwIhz+A5I=; b=2TCd1R8XmdF8sRmIS+ekwO/sy3kR3sD+hrVM35Hy8iAhyMpbwFXsDM9+3pI/0CneEl M6gNMlxtqfUvPXjbGp64fJUY/gFjyj2lFqr+We5JvOse2BzG1kjzoPyw88SqGykrzW7U RefFu5+csZ3FMGgtCIwn0uXq/l8CECppKvftOPgePrdmeljBEl96/LUXcN52oY+7YKYo L5zBi4oP7azc3LY3jh2HJ/IMjDK6/JdYh3MrMFUz328JRKtcouyLuFyEVn7TVWegqr7b 59en2YOtkE50jeejIhZ4ZaXiTHCmVrxFmht+wcyMFdNWm1p5ToVLUCyu/+7zINsVAUak eZ1A== X-Gm-Message-State: AOAM530ulSyVBgZlwMGdiWUm3OWf+dlEhCMKRLANq1Z6R8ctyhpvBveZ aAj4VGKAuLHK+6nG/96gDghs65SSHIdWsw== X-Google-Smtp-Source: ABdhPJxVjXdMxfF+en5+pUbLjq1hq+DDbHyUugTh5BpP4aOpLBefC6PN81y+C+VaJNKrsEWKNgrWKA== X-Received: by 2002:a2e:9053:0:b0:24a:f0ac:bd7f with SMTP id n19-20020a2e9053000000b0024af0acbd7fmr1906097ljg.425.1649159583617; Tue, 05 Apr 2022 04:53:03 -0700 (PDT) From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH RESEND] qemu: disarm fake reboot flag on reset Date: Tue, 5 Apr 2022 14:52:59 +0300 Message-Id: <20220405115259.665139-1-nikolay.shirokovskiy@openvz.org> MIME-Version: 1.0 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.2 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 2.85 on 10.11.54.8 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: 1649159608863100001 Content-Type: text/plain; charset="utf-8" From: Maxim Nestratov This is a quite an old (created at 2016) patch fixing an issue for at that time contemporary Fedora 23. virsh reboot returns success (yet after hanging for a while), VM is rebooted sucessfully too but then shutdown from inside guest causes reboot and not shutdown. VM has agent installed. So virsh reboot first tries to reboot VM thru the agent. The agent calls 'shutdown -r' command. Typically it returns instantly but on this distro for some reason it takes time. I did not investigate the cause but the command waits in dbus client code, probably waits for reply. The libvirt waits 60s for agent command to execute and then errors out. Next reboot API falls back to ACPI shutdown which returns successfully thus the reboot command return success too. Yet shutdown command in guest eventually successfull and guest is truly rebooted. So libvirt does not receive SHUTDOWN event and fake reboot flag which is armed on fallback path stays armed. Thus next shutdown from guest leads to reboot. The issue has 100% repro on Fedora 23. On modern distros I can't reproduce it at all. Shutdown command is asynchronous and returns immediately even if I start some service that ignores TERM signal and thus shutdown procedure waits for 90s (if I not mistaken) before sending KILL. Yet I guess it is nice to have this patch to be more robust. Signed-off-by: Nikolay Shirokovskiy Reviewed-by: Daniel P. Berrang=C3=A9 --- src/qemu/qemu_process.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index f63fc3389d..d81ed9391a 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -435,6 +435,7 @@ qemuProcessHandleReset(qemuMonitor *mon G_GNUC_UNUSED, if (priv->agent) qemuAgentNotifyEvent(priv->agent, QEMU_AGENT_EVENT_RESET); =20 + qemuDomainSetFakeReboot(vm, false); qemuDomainSaveStatus(vm); =20 unlock: --=20 2.35.1