From nobody Fri May 10 05:02:07 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 1649159379501116.05475553522444; Tue, 5 Apr 2022 04:49:39 -0700 (PDT) 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-660-pQffBpbpPiuuMOyEDXkF2w-1; Tue, 05 Apr 2022 07:49:34 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1D6363C1410F; Tue, 5 Apr 2022 11:49:32 +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 B9F091400E74; Tue, 5 Apr 2022 11:49:31 +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 55DD31940367; Tue, 5 Apr 2022 11:49:31 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id E235F1940346 for ; Tue, 5 Apr 2022 11:49:29 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id C28EFC27D98; Tue, 5 Apr 2022 11:49:29 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BEB76C27D90 for ; Tue, 5 Apr 2022 11:49:29 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.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 A6420185A7BA for ; Tue, 5 Apr 2022 11:49:29 +0000 (UTC) Received: from mail-lj1-f182.google.com (mail-lj1-f182.google.com [209.85.208.182]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-138-P7FgenZDOFGDqKgbN-udKA-1; Tue, 05 Apr 2022 07:49:27 -0400 Received: by mail-lj1-f182.google.com with SMTP id q68so4728320ljb.3 for ; Tue, 05 Apr 2022 04:49:21 -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 t17-20020a192d51000000b0044a5a9960f9sm1476332lft.236.2022.04.05.04.49.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 04:49:19 -0700 (PDT) X-MC-Unique: pQffBpbpPiuuMOyEDXkF2w-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: P7FgenZDOFGDqKgbN-udKA-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=x8KsQKEE/B/5fTHD3moUSAtWqhkTb7/UlYYQm7tszAzDGtXtxjlBpNLIH/p0gYvlEl XK0dvXbH+CFyVbd3WKRxFGb8Cpl67uBqZnIff/REQhsix2209wIffX/bHPVEf/cQLIJD L1HvVIQ6YFawozqxbuy8o6TsTL955Hmx5LTJvBMptqEHVYTQHdmTExtyNfqMo/N28clA ppIa0or7VXVQw47M2pOfFzAjHr7+UJUyskuFeycYXQevp+6Nko1YCyMYCQXXnJqtndq0 iB9xbqEWGDZDVOCwUy7zr87pb4kQB2DSLL7NVN7Qe5yDjnMuZ4h6aRWyT2S2qoKKJPuR J/QQ== X-Gm-Message-State: AOAM533kh2MzXP1O6a1oKpN7e2ton+06JbbjvYc4957eMGrKpIse4bC6 pjtJ5fuBxLKpLjylt5z4IHmRNKYBrZvqXA== X-Google-Smtp-Source: ABdhPJzoUo5bJyvoHlen8jZLBZwxmdos2D608e4EFRLj0ytBYOF4ZUkuuFDo056FP+GRH/jAOzgxEw== X-Received: by 2002:a2e:b557:0:b0:247:e509:4a50 with SMTP id a23-20020a2eb557000000b00247e5094a50mr1915844ljn.72.1649159359800; Tue, 05 Apr 2022 04:49:19 -0700 (PDT) From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH] qemu: disarm fake reboot flag on reset Date: Tue, 5 Apr 2022 14:48:57 +0300 Message-Id: <20220405114857.664929-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.85 on 10.11.54.8 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.7 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: 8bit Content-Type: application/octet-stream; x-default=true X-Zoho-Virus-Status: 1 X-ZM-MESSAGEID: 1649159381779100001 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 --- 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); + qemuDomainSetFakeReboot(vm, false); qemuDomainSaveStatus(vm); unlock: -- 2.35.1