From nobody Fri May 17 09:18:55 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 171334045653310.219975789606906; Wed, 17 Apr 2024 00:54:16 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 6AC821B30; Wed, 17 Apr 2024 03:54:15 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 98AD71C1E; Wed, 17 Apr 2024 03:52:43 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 60CAD178B; Wed, 17 Apr 2024 01:58:31 -0400 (EDT) Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 6C809178B for ; Wed, 17 Apr 2024 01:58:29 -0400 (EDT) Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-1e2bbc2048eso42884655ad.3 for ; Tue, 16 Apr 2024 22:58:29 -0700 (PDT) Received: from i-hy28yka8.localdomain. ([139.198.0.165]) by smtp.gmail.com with ESMTPSA id jy7-20020a17090342c700b001e3f0cde2desm10788767plb.253.2024.04.16.22.58.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 22:58:26 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713333507; x=1713938307; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=IsKNZJ0hmxVCVIfKzSAaewWicJq68LqecdnQs5Z3HDY=; b=neJqoKHcZetHrU95xX0kL6JSB/mEweE3fyPKQgbs7uQGhp78FeLB1UCtaD5Jkw+wDE GGn9GNRW4U8DVjMH/bc5OVMZ2XN1lcEkgCMPJxdztKwgLHoDuM8iRjivvtUYHcdDgL4s /ARe6Nl33YscXIkgRFTFOUivI4oTOFMukQegwUeNweC3/ZWbZetXvIhzTVZpZCi59WfD 8a4uLgMKSJf6YxpS2LPG5eIFMpw/+cixOzY7insqLgBMC89lvM95wqEWclgoc+WQTEeI jy9K5/3+Cajx/Pk5LRV0pxmydt/hj+iBego+fUgeSngEb71buYmlJBzDYpetnc2Do3FW HjJA== X-Gm-Message-State: AOJu0Yxu2+v0yqmxJdrxhZya+iveEkQUgnaGWdtkvkMZu6mofhc2gp1M Fhn8Zicxs0Agn2/4ObtHdgt/KvKVnPj7WD1jgedklm5biD4wPo0y459T77UX X-Google-Smtp-Source: AGHT+IG7Hdvmp5tQDAgPpgfx5P6zJ/g7bcwf8XxlXehT/NCqy5sgbDXb4979W1pkjZwG3OC9+f0+7Q== X-Received: by 2002:a17:902:ea02:b0:1e4:34f5:4021 with SMTP id s2-20020a170902ea0200b001e434f54021mr15119324plg.5.1713333507279; Tue, 16 Apr 2024 22:58:27 -0700 (PDT) From: Sun Feng To: devel@lists.libvirt.org Subject: [PATCH] qemu: Deliver shutoff reason with qemu hooks Date: Wed, 17 Apr 2024 13:58:06 +0800 Message-Id: <20240417055806.891728-1-loyou85@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-MailFrom: loyou85@gmail.com X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0 Message-ID-Hash: EH7CYGWCUJNUYDVMMCLQICK52HXL233D X-Message-ID-Hash: EH7CYGWCUJNUYDVMMCLQICK52HXL233D X-Mailman-Approved-At: Wed, 17 Apr 2024 07:52:35 -0400 CC: Sun Feng X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1713340457333100001 For abnormal shutoff reasons, we can start guest again with qemu hooks. Signed-off-by: Sun Feng --- docs/hooks.rst | 3 ++- src/qemu/qemu_process.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/hooks.rst b/docs/hooks.rst index 1dbc492bd4..45856e4ca4 100644 --- a/docs/hooks.rst +++ b/docs/hooks.rst @@ -204,7 +204,8 @@ operation. There is no specific operation to indicate a= "restart" is occurring. =20 - When a QEMU guest is stopped, the qemu hook script is called in two locations, to match the startup. First, :since:`since 0.8.0`, the hook = is - called before libvirt restores any labels: + called before libvirt restores any labels, :since:`since 9.10.0`, shuto= ff + reason is delivered with **extra argument**: =20 :: =20 diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index e4bcb628cf..c42f5c9139 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -8564,7 +8564,8 @@ void qemuProcessStop(virQEMUDriver *driver, /* we can't stop the operation even if the script raised an error = */ ignore_value(virHookCall(VIR_HOOK_DRIVER_QEMU, vm->def->name, VIR_HOOK_QEMU_OP_STOPPED, VIR_HOOK_SUBOP_= END, - NULL, xml, NULL)); + virDomainShutoffReasonTypeToString(reason= ), + xml, NULL)); } =20 /* Reset Security Labels unless caller don't want us to */ --=20 2.34.1 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org