From nobody Mon Mar 23 23:41:03 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1774102541; cv=none; d=zohomail.com; s=zohoarc; b=SgyEuqdBTugpAg26Ubh1a0p/iz6N9Oj3Ku7QoHMPjR0xRjvu6s2QL4unwM1oHk/20Z3ER6u5cgWBCUa+8KH9j3m7And4cyknnlt1a8/ZxBR0/rsGOFI+HM1tzLKfLzb5lKrf8/aX8rWuPH6U90wxJGcDQf8jMxQa2BgzwUqp0Ow= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1774102541; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id; bh=L52Z4w2+XLkwBTJMDnWgOreEW9etcPWfHngDTejpPl8=; b=XKFnY9MmnPeMWHgXcUA35dICq4TuHlat9nZfmANHZaD1oNdA2iSrj8NthH8cjT312vJnIsFvVZcU3Qlv8S9fXMKOJ8B9Zy+I3ZKcDYOsVCggwTe4qOt4V6C7i9FPZCuwo3TcGEpzut1QfnUlHIu7yCRoqD9mzWda0T7xrgAYv4k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1774102541448773.9013951133109; Sat, 21 Mar 2026 07:15:41 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id A250B4197B; Sat, 21 Mar 2026 10:15:40 -0400 (EDT) Received: from [172.19.199.12] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 3422C41BBC; Sat, 21 Mar 2026 10:12:40 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id B1BF641832; Sat, 21 Mar 2026 10:12:30 -0400 (EDT) Received: from home.gugod.fr (unknown [82.66.151.23]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id DC9694184D for ; Sat, 21 Mar 2026 10:12:29 -0400 (EDT) Received: from alpinetest.home.arpa (rp-intranet.home.arpa [192.168.0.21]) by smtp.home.arpa (OpenSMTPD) with ESMTPSA id 810d6597 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Sat, 21 Mar 2026 14:05:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HELO_MISC_IP,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=home20250113; bh=tluvSfY ES8Tkdo0NqBgnIOrXY1QXceZBG5u0XmvxwDo=; h=references:in-reply-to:date: subject:cc:to:from; d=gugod.fr; b=a81i0PKqGsNKx+m7ZcH2NqcuxOAllC5y1r/Q pXRDeQgg+vyDlgvRDCwCiepUXJr4TlxyQYxIZmxf080i3S2HGZvCYC1QE7GAsYi3Tt91Q4 5JAoLnq6QLOdFEDtN0B3+mGjnuoOcaz+CVFQ5iBG6libEQMM6rewjr51aOS5rAe71d7cq4 ZRQt4DOkFUJvb/LhCTLSMNKgmRDYg4NlZ0WuFbIK1c/BAQ5CpkdKK7qHQc8CXGgIkuhO/D hY0sEoYtoSdIx3A0c3Qp8f8K25AFdft2yb2koNpENRQmDp60nT+4tSgRFlAjxq3abRWUrV jcmlAIarm3UXb48yFvDna89jZQ== To: devel@lists.libvirt.org Subject: [PATCHv2 1/4] docs: hooks: Clarify that the migrate operation is on the destination host Date: Sat, 21 Mar 2026 15:05:12 +0100 Message-ID: <20260321140537.23568-2-guy.godfroy@gugod.fr> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260321140537.23568-1-guy.godfroy@gugod.fr> References: <20260321140537.23568-1-guy.godfroy@gugod.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: Z7VIISD33A6QTAULE7JKDRF4BXMX6GZR X-Message-ID-Hash: Z7VIISD33A6QTAULE7JKDRF4BXMX6GZR X-MailFrom: guy.godfroy@gugod.fr X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: pkrempa@redhat.com, Guy Godfroy X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Guy Godfroy via Devel Reply-To: Guy Godfroy X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1774102541782158500 Content-Type: text/plain; charset="utf-8" The documentation for the "migrate" hook operation described it as being called at the beginning of incoming migration, but didn't explicitly mention that this happens on the destination host. Add "on the **destination** host" to make this clear. Signed-off-by: Guy Godfroy --- docs/hooks.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/hooks.rst b/docs/hooks.rst index e1745b8cc7..0310e0d82c 100644 --- a/docs/hooks.rst +++ b/docs/hooks.rst @@ -244,7 +244,7 @@ operation. There is no specific operation to indicate a= "restart" is occurring. =20 =20 - :since:`Since 0.9.11`, the qemu hook script is also called at the begin= ning - of incoming migration. It is called as: + of incoming migration on the **destination** host. It is called as: =20 :: =20 @@ -417,7 +417,7 @@ operation. There is no specific operation to indicate a= "restart" is occurring. /etc/libvirt/hooks/libxl guest_name release end - =20 - :since:`Since 2.1.0`, the libxl hook script is also called at the begin= ning - of incoming migration. It is called as: + of incoming migration on the **destination** host. It is called as: =20 :: =20 --=20 2.53.0 From nobody Mon Mar 23 23:41:03 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1774102579; cv=none; d=zohomail.com; s=zohoarc; b=QU7d+8AYpSHvWzN3m/iAIM/9olnUbrjQiF24QUxr/RuMwFC/TnLk0+XINfYqmV2WlJ2yhgHfsHhEnKfFXuU1yNApY3cdMAAu8S0bZfGQPUitr2+Pz79PIEamoWyZBYF+RYttqMd5mfFkoUPskhTPuXvxEf3kMIJNXO1TTpPP4vk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1774102579; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id; bh=9zSG8Z0p87xbRDqPTU3a/8LqbF2zHDRlwOM/7WlEVHs=; b=oC0TDnae/Gd4uICAwpHXiOvZbp4caumlU/QEm8EQLQ0D/iGqQQ2CarBEcsuPm55s/tmuhsCNf9S06+nFAiYNJFJ6I3VkljVjX2Kb4Mk+0a81BICcCv5QDwxplCoElzoLojXnEBd4juCSmVxB+thcdhFG289rssyYXB2HYcCf4gI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1774102579603983.4603022247685; Sat, 21 Mar 2026 07:16:19 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 22536418AC; Sat, 21 Mar 2026 10:16:19 -0400 (EDT) Received: from [172.19.199.12] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id EBFDA41C94; Sat, 21 Mar 2026 10:12:40 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id D7E0741831; Sat, 21 Mar 2026 10:12:30 -0400 (EDT) Received: from home.gugod.fr (unknown [82.66.151.23]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 5D5953F837 for ; Sat, 21 Mar 2026 10:12:30 -0400 (EDT) Received: from alpinetest.home.arpa (rp-intranet.home.arpa [192.168.0.21]) by smtp.home.arpa (OpenSMTPD) with ESMTPSA id df95fb9c (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Sat, 21 Mar 2026 14:05:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HELO_MISC_IP,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=home20250113; bh=JaILJX4 waapbEd7Vz8jt4h5czlYh8t3wif/GnnfVch4=; h=references:in-reply-to:date: subject:cc:to:from; d=gugod.fr; b=Pn9gw77DN/Z2Yr1yXNhOZ1Kfce0zEKGAGWbY IaWUOKsFe86DLqXUAKSKuEFwuuSfmO0u6lkq5cGIOSa33HeFePg7RMqoIxSaXaEghRA74m TQSsST0GYSGWxGjNrBod603URPiiV26rM44D5S86gfejHqnp8Q6T4tXWCt+HSIrCGTTH2s bD9E7+4rqqCfhHLCtHWR/1jVB4ablz0JitE7gidnUunQBPgiF4WxXQUlK1arL75p9yg3lf DczqlkbEN88QmtK4gPcnEFNlmhTX9t7QwkR9CpyuP/Klpsb0T3DzuViRzsPQ/eCr4vNsuf WQYYMTmoGhgp9bGLIvH5axINFg== To: devel@lists.libvirt.org Subject: [PATCHv2 2/4] util: hook: Add migrate-outgoing operation for qemu and libxl drivers Date: Sat, 21 Mar 2026 15:05:13 +0100 Message-ID: <20260321140537.23568-3-guy.godfroy@gugod.fr> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260321140537.23568-1-guy.godfroy@gugod.fr> References: <20260321140537.23568-1-guy.godfroy@gugod.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: NGPEEBUFUYWNKXJHQZ5UDIJNVB5SDKBM X-Message-ID-Hash: NGPEEBUFUYWNKXJHQZ5UDIJNVB5SDKBM X-MailFrom: guy.godfroy@gugod.fr X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: pkrempa@redhat.com, Guy Godfroy X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Guy Godfroy via Devel Reply-To: Guy Godfroy X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1774102581341154100 Content-Type: text/plain; charset="utf-8" Add VIR_HOOK_QEMU_OP_MIGRATE_OUTGOING and VIR_HOOK_LIBXL_OP_MIGRATE_OUTGOING enum values with corresponding "migrate-outgoing" string mappings. This new operation will be used for hooks called on the source host during outgoing migration, distinct from the existing "migrate" operation which is used for destination host hooks. Signed-off-by: Guy Godfroy --- src/util/virhook.c | 2 ++ src/util/virhook.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/util/virhook.c b/src/util/virhook.c index d012bb1825..7f7e253a67 100644 --- a/src/util/virhook.c +++ b/src/util/virhook.c @@ -84,6 +84,7 @@ VIR_ENUM_IMPL(virHookQemuOp, "reconnect", "attach", "restore", + "migrate-outgoing", ); =20 VIR_ENUM_IMPL(virHookLxcOp, @@ -115,6 +116,7 @@ VIR_ENUM_IMPL(virHookLibxlOp, "migrate", "started", "reconnect", + "migrate-outgoing", ); =20 VIR_ENUM_IMPL(virHookBhyveOp, diff --git a/src/util/virhook.h b/src/util/virhook.h index d8237c837e..a7536fb01e 100644 --- a/src/util/virhook.h +++ b/src/util/virhook.h @@ -60,6 +60,7 @@ typedef enum { VIR_HOOK_QEMU_OP_RECONNECT, /* domain is being reconnected by l= ibvirt */ VIR_HOOK_QEMU_OP_ATTACH, /* domain is being attached to be l= ibvirt */ VIR_HOOK_QEMU_OP_RESTORE, /* domain is being restored */ + VIR_HOOK_QEMU_OP_MIGRATE_OUTGOING, /* domain is being migrated out */ =20 VIR_HOOK_QEMU_OP_LAST, } virHookQemuOpType; @@ -94,6 +95,7 @@ typedef enum { VIR_HOOK_LIBXL_OP_MIGRATE, /* domain is being migrated */ VIR_HOOK_LIBXL_OP_STARTED, /* domain has started */ VIR_HOOK_LIBXL_OP_RECONNECT, /* domain is being reconnected by = libvirt */ + VIR_HOOK_LIBXL_OP_MIGRATE_OUTGOING, /* domain is being migrated out */ =20 VIR_HOOK_LIBXL_OP_LAST, } virHookLibxlOpType; --=20 2.53.0 From nobody Mon Mar 23 23:41:03 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1774102453; cv=none; d=zohomail.com; s=zohoarc; b=abNt1qhMpKq+VK81EK50mYbUpUAnYrv39VIj7PrilzqPXMz9fSV+wgZQL8lk+0GFqMiX/UA3Xumwtc8whNM9MB1UBJ0kGCLy51glGlmaEP8hCyVdXWB6xuapnQrbmuG0dfRocZEsxqLeNhM8Iu88GBWKeZ67G71PkpC9bFo8Wvc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1774102453; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id; bh=+6ebdc7pvIrWdxGvg5zH2AnKWg8PzlQFS5sc58DlATE=; b=T+1pCVveHfwLFLJogq/V2txyisnOb6ElPH3uVf+ZPRyfT/bcwz2/J5vTpVPrpxf3WCPee/5iusIG7trEK7R07Lro9fu1L6NnKvoOPGzL4igX6GuSFg4M1NMCd/4x02GmziHgbQCBUQr9e3AZrXnvkURiBsQ7V9k8uz7rqLTzG0M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1774102453269739.4553762621939; Sat, 21 Mar 2026 07:14:13 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 8B84141A9E; Sat, 21 Mar 2026 10:14:12 -0400 (EDT) Received: from [172.19.199.12] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 2BB9941B37; Sat, 21 Mar 2026 10:12:37 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 61B4441819; Sat, 21 Mar 2026 10:12:30 -0400 (EDT) Received: from home.gugod.fr (unknown [82.66.151.23]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 7181B41819 for ; Sat, 21 Mar 2026 10:12:28 -0400 (EDT) Received: from alpinetest.home.arpa (rp-intranet.home.arpa [192.168.0.21]) by smtp.home.arpa (OpenSMTPD) with ESMTPSA id 0e8b6378 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Sat, 21 Mar 2026 14:05:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HELO_MISC_IP,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 X-Greylist: delayed 399 seconds by postgrey-1.37 at lists.libvirt.org; Sat, 21 Mar 2026 10:12:28 EDT DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=home20250113; bh=OqYfXI/ 03MXnRjXOBYtrvuWXdOAELZo2r24Iom30/mY=; h=references:in-reply-to:date: subject:cc:to:from; d=gugod.fr; b=Pl+THjs07X9x9k/DvqhDGLL5coeLUCm6Yphv +hbP4NAwtfEZ0K6hDNbRid0B74snxn8VobBsJ0a4yaRK1taY1CbHpNL2bfjecS09CvInw2 QNYkPlx0BEA77dUI8Ou3g3cTDQ60GJrsKrQm3gCyu7YpenaJMAZ6Dz6l2m7I15YollqXEr H9v6ZibK5yymIrkgW3tERQeVSxox8TiP7FlMQhxR6jPT5WE4zwSkKCUmZagxH7rRwGkvhB cEZJb5PuidG1mLgM9kU5nG+StjDMYW2YpYu5fhp0kyGHBlGd9qZ5Qq+EVTGPnLwaxitOC4 e3iAwQWhFVwkq1KyxJOeiCzV7Q== To: devel@lists.libvirt.org Subject: [PATCHv2 3/4] qemu, libxl: migration: Call hook script on source host at migration start Date: Sat, 21 Mar 2026 15:05:14 +0100 Message-ID: <20260321140537.23568-4-guy.godfroy@gugod.fr> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260321140537.23568-1-guy.godfroy@gugod.fr> References: <20260321140537.23568-1-guy.godfroy@gugod.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 6WMKG5MWZW25UJDF564KS6SBNSJDW24C X-Message-ID-Hash: 6WMKG5MWZW25UJDF564KS6SBNSJDW24C X-MailFrom: guy.godfroy@gugod.fr X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: pkrempa@redhat.com, Guy Godfroy X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Guy Godfroy via Devel Reply-To: Guy Godfroy X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1774102456071154100 Content-Type: text/plain; charset="utf-8" Currently, the hook script with the "migrate" operation is only called on the destination host at the beginning of incoming migration. This makes it impossible for the source host to prepare for migration, for example to change storage locks from exclusive to shared mode when using shared LVM storage with lvmlockd. Add a hook call on the source host at the beginning of outgoing migration using the new "migrate-outgoing" operation. The hook is called with "source" as the extra argument and "begin" as the sub-operation. The script is not used as a filter; its output is ignored. If the script returns failure, the migration is canceled. The same change is also applied to the libxl driver for consistency. Signed-off-by: Guy Godfroy --- docs/hooks.rst | 32 ++++++++++++++++++++++++++++++-- src/libxl/libxl_migration.c | 17 +++++++++++++++++ src/qemu/qemu_migration.c | 17 +++++++++++++++++ 3 files changed, 64 insertions(+), 2 deletions(-) diff --git a/docs/hooks.rst b/docs/hooks.rst index 0310e0d82c..cff1711536 100644 --- a/docs/hooks.rst +++ b/docs/hooks.rst @@ -257,6 +257,18 @@ operation. There is no specific operation to indicate = a "restart" is occurring. is not valid, incoming migration will be canceled. This hook may be use= d, e.g., to change location of disk images for incoming domains. =20 +- :since:`Since 12.3.0`, the qemu hook script is also called at the begin= ning + of outgoing migration on the **source** host. It is called as: + + :: + + /etc/libvirt/hooks/qemu guest_name migrate-outgoing begin source + + with domain XML sent to standard input of the script. Unlike the destin= ation + hook, this script does not act as a filter and any output is ignored. I= f the + script returns failure, the migration will be canceled. This hook may b= e used, + e.g., to change storage lock mode from exclusive to shared before migra= tion. + - :since:`Since 1.2.9`, the qemu hook script is also called when restorin= g a saved image either via the API or automatically when restoring a manage= d save machine. It is called as: @@ -430,6 +442,18 @@ operation. There is no specific operation to indicate = a "restart" is occurring. is not valid, incoming migration will be canceled. This hook may be use= d, e.g., to change location of disk images for incoming domains. =20 +- :since:`Since 12.3.0`, the libxl hook script is also called at the begi= nning + of outgoing migration on the **source** host. It is called as: + + :: + + /etc/libvirt/hooks/libxl guest_name migrate-outgoing begin source + + with domain XML sent to standard input of the script. Unlike the destin= ation + hook, this script does not act as a filter and any output is ignored. I= f the + script returns failure, the migration will be canceled. This hook may b= e used, + e.g., to change storage lock mode from exclusive to shared before migra= tion. + - :since:`Since 6.5.0`, you can also place several hook scripts in the directory ``/etc/libvirt/hooks/libxl.d/``. They are executed in alphabe= tical order after main script. In this case each script also acts as filter a= nd can @@ -566,10 +590,14 @@ Migration of a QEMU guest involves running hook scrip= ts on both the source and destination hosts: =20 #. At the beginning of the migration, the *qemu* hook script on the - **destination** host is executed with the "migrate" operation. + **source** host is executed with the "migrate-outgoing" operation and + "source" as the extra argument (:since:`since 12.3.0`). This allows the + source host to prepare for migration, e.g., changing storage locks. +#. Then, the *qemu* hook script on the **destination** host is executed + with the "migrate" operation. #. Before QEMU process is spawned, the two operations ("prepare" and "star= t") called for domain start are executed on **destination** host. -#. If both of these hook script executions exit successfully (exit status = 0), +#. If all of these hook script executions exit successfully (exit status 0= ), the migration continues. Any other exit code indicates failure, and the migration is aborted. #. The QEMU guest is then migrated to the destination host. diff --git a/src/libxl/libxl_migration.c b/src/libxl/libxl_migration.c index f5dee7627b..be51cfd316 100644 --- a/src/libxl/libxl_migration.c +++ b/src/libxl/libxl_migration.c @@ -411,6 +411,23 @@ libxlDomainMigrationSrcBegin(virConnectPtr conn, if (!libxlDomainMigrationIsAllowed(def)) goto endjob; =20 + /* Call hook to allow source host to prepare for migration */ + if (virHookPresent(VIR_HOOK_DRIVER_LIBXL)) { + g_autofree char *hookxml =3D NULL; + int hookret; + + if (!(hookxml =3D virDomainDefFormat(def, driver->xmlopt, + VIR_DOMAIN_DEF_FORMAT_SECURE))) + goto endjob; + + hookret =3D virHookCall(VIR_HOOK_DRIVER_LIBXL, def->name, + VIR_HOOK_LIBXL_OP_MIGRATE_OUTGOING, VIR_HOOK= _SUBOP_BEGIN, + "source", hookxml, NULL); + + if (hookret < 0) + goto endjob; + } + xml =3D virDomainDefFormat(def, driver->xmlopt, VIR_DOMAIN_DEF_FORMAT_= SECURE); /* Valid xml means success! EndJob in the confirm phase */ if (xml) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index fec808ccfb..e9ce2d8b8b 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -2870,6 +2870,23 @@ qemuMigrationSrcBeginPhase(virQEMUDriver *driver, vm->newDef && !qemuDomainVcpuHotplugIsInOrder(vm->newDef))) cookieFlags |=3D QEMU_MIGRATION_COOKIE_CPU_HOTPLUG; =20 + /* Call hook to allow source host to prepare for migration */ + if (virHookPresent(VIR_HOOK_DRIVER_QEMU)) { + g_autofree char *xml =3D NULL; + int hookret; + + if (!(xml =3D qemuDomainDefFormatLive(driver, priv->qemuCaps, vm->= def, + priv->origCPU, false, true))) + return NULL; + + hookret =3D virHookCall(VIR_HOOK_DRIVER_QEMU, vm->def->name, + VIR_HOOK_QEMU_OP_MIGRATE_OUTGOING, VIR_HOOK_= SUBOP_BEGIN, + "source", xml, NULL); + + if (hookret < 0) + return NULL; + } + if (qemuBlockNodesEnsureActive(vm, vm->job->asyncJob) < 0) return NULL; =20 --=20 2.53.0 From nobody Mon Mar 23 23:41:03 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1774102507; cv=none; d=zohomail.com; s=zohoarc; b=ZEJVloZlc9RPs6sbgwjTPUjGPtzUJmndidCVQV2e4YzPoQSJ4Jzj2ZekSmQWGZuSx5XsnhqXc3B1p1J5u41IzcDw7SQCoR0Pq8goo2oJoUIo675+Pkxma8RhqAkIdeuuT/TMZLoPwXTRT/zOL6SAKs0vXc5DF9qLia98bbH9fkg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1774102507; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id; bh=IqhZXr7/M22XCssEs4Dcr+Q8CFg3GZ3h+nsIXcBO4Fc=; b=KqwIYSx2yCavFcq4rW5lX2Ouw5/VYTZH9Zh2V2juuvDmo7G69kTj0/PvaUi1Xuyh+VSdRH2GGymB9MgGq8qDcuG5bN6Q4tBY7e3BLqqO5nY1EuGUJ1XJqSQyRaihzKb10t1IqQXTHY6ByX1dC3vk2B67WYYP2zhwiBSTKVeheyA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1774102507968609.9811392652568; Sat, 21 Mar 2026 07:15:07 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 5D6C241A0A; Sat, 21 Mar 2026 10:15:07 -0400 (EDT) Received: from [172.19.199.12] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 091F041B9F; Sat, 21 Mar 2026 10:12:39 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id B0F8141831; Sat, 21 Mar 2026 10:12:30 -0400 (EDT) Received: from home.gugod.fr (unknown [82.66.151.23]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 6739741835 for ; Sat, 21 Mar 2026 10:12:29 -0400 (EDT) Received: from alpinetest.home.arpa (rp-intranet.home.arpa [192.168.0.21]) by smtp.home.arpa (OpenSMTPD) with ESMTPSA id 40f1977b (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Sat, 21 Mar 2026 14:05:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HELO_MISC_IP,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=home20250113; bh=BfWKZHD Va5l6WVRuU3nz0NRBu/iX7+6UPTUwpjiymJA=; h=references:in-reply-to:date: subject:cc:to:from; d=gugod.fr; b=o8usMcdC5YPUwSbsbebakQm0RlVnzojrNKel bQX//6mPETGDshXbl6LFa/4r/iBDblfXrBwiuLZg0LT35RzOd3wRE0jys49/4KinNUWM0u r0W0vXb/L32K6RC5Qrd4GWb7a69eMB6rZMToL7K8jSur/lqvaCwUImrR0HVdsCEr6HCfmp lwpwbPK0T4bJTKqimGmdm1XvWs2ILMkoL9Mqa95JwFNdbhCLoWA/A9rfRetH7N65vH+t/U D7/qROoBSzgr0rQi/nBVD64rmQhJiv3pNszAwjdg75DCfpCtbtE6GK6LpFJaKHjkmZUAtD KJj/RopUPUElxHlLarHbi2wtFQ== To: devel@lists.libvirt.org Subject: [PATCHv2 4/4] qemu, libxl: migration: Call hook script on source host when migration fails Date: Sat, 21 Mar 2026 15:05:15 +0100 Message-ID: <20260321140537.23568-5-guy.godfroy@gugod.fr> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260321140537.23568-1-guy.godfroy@gugod.fr> References: <20260321140537.23568-1-guy.godfroy@gugod.fr> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: AKRZMLUDI2UTVOCSX5CFX3QXBYAORZFY X-Message-ID-Hash: AKRZMLUDI2UTVOCSX5CFX3QXBYAORZFY X-MailFrom: guy.godfroy@gugod.fr X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: pkrempa@redhat.com, Guy Godfroy X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Guy Godfroy via Devel Reply-To: Guy Godfroy X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1774102510314154100 Content-Type: text/plain; charset="utf-8" When outgoing migration fails after the "migrate-outgoing begin source" hook was executed, the source host has no way to be notified and cannot undo changes made in the begin hook (e.g., restoring exclusive storage locks after switching to shared mode). Add a hook call on the source host when migration fails, using the "migrate-outgoing" operation with "end" as the sub-operation and "failed" as the extra argument. The hook output and return code are ignored since migration has already failed. For qemu, the fail hook is called in the confirm phase when retcode !=3D 0. For libxl, the fail hook is called in both the perform phase (when perform fails, since confirm is not called) and the confirm phase when cancelled is true. Resolves: https://gitlab.com/libvirt/libvirt/-/issues/37 Signed-off-by: Guy Godfroy --- docs/hooks.rst | 27 ++++++++++++++++++++++++++- src/libxl/libxl_migration.c | 22 ++++++++++++++++++++++ src/qemu/qemu_migration.c | 12 ++++++++++++ 3 files changed, 60 insertions(+), 1 deletion(-) diff --git a/docs/hooks.rst b/docs/hooks.rst index cff1711536..4fe02b7c28 100644 --- a/docs/hooks.rst +++ b/docs/hooks.rst @@ -269,6 +269,17 @@ operation. There is no specific operation to indicate = a "restart" is occurring. script returns failure, the migration will be canceled. This hook may b= e used, e.g., to change storage lock mode from exclusive to shared before migra= tion. =20 +- :since:`Since 12.3.0`, when migration fails on the source host, the qemu + hook script is called to allow the source host to undo any changes made= in + the begin hook. It is called as: + + :: + + /etc/libvirt/hooks/qemu guest_name migrate-outgoing end failed + + with domain XML sent to standard input of the script. Any output and the + return code of the script are ignored. + - :since:`Since 1.2.9`, the qemu hook script is also called when restorin= g a saved image either via the API or automatically when restoring a manage= d save machine. It is called as: @@ -454,6 +465,17 @@ operation. There is no specific operation to indicate = a "restart" is occurring. script returns failure, the migration will be canceled. This hook may b= e used, e.g., to change storage lock mode from exclusive to shared before migra= tion. =20 +- :since:`Since 12.3.0`, when migration fails on the source host, the lib= xl + hook script is called to allow the source host to undo any changes made= in + the begin hook. It is called as: + + :: + + /etc/libvirt/hooks/libxl guest_name migrate-outgoing end failed + + with domain XML sent to standard input of the script. Any output and the + return code of the script are ignored. + - :since:`Since 6.5.0`, you can also place several hook scripts in the directory ``/etc/libvirt/hooks/libxl.d/``. They are executed in alphabe= tical order after main script. In this case each script also acts as filter a= nd can @@ -599,7 +621,10 @@ destination hosts: called for domain start are executed on **destination** host. #. If all of these hook script executions exit successfully (exit status 0= ), the migration continues. Any other exit code indicates failure, and the - migration is aborted. + migration is aborted. If migration is aborted, the *qemu* hook script on + the **source** host is executed with the "migrate-outgoing" operation, + "end" sub-operation, and "failed" as the extra argument + (:since:`since 12.3.0`). The return code is ignored. #. The QEMU guest is then migrated to the destination host. #. Unless an error occurs during the migration process, the *qemu* hook sc= ript on the **source** host is then executed with the "stopped" and "release" diff --git a/src/libxl/libxl_migration.c b/src/libxl/libxl_migration.c index be51cfd316..4e7e2bdbe9 100644 --- a/src/libxl/libxl_migration.c +++ b/src/libxl/libxl_migration.c @@ -1237,6 +1237,17 @@ libxlDomainMigrationSrcPerform(libxlDriverPrivate *d= river, VIR_WARN("Unable to release lease on %s", vm->def->name); } } else { + /* Call hook to notify source host that migration failed */ + if (virHookPresent(VIR_HOOK_DRIVER_LIBXL)) { + g_autofree char *hookxml =3D NULL; + + if ((hookxml =3D virDomainDefFormat(vm->def, driver->xmlopt, + VIR_DOMAIN_DEF_FORMAT_SECURE= ))) + virHookCall(VIR_HOOK_DRIVER_LIBXL, vm->def->name, + VIR_HOOK_LIBXL_OP_MIGRATE_OUTGOING, VIR_HOOK_S= UBOP_END, + "failed", hookxml, NULL); + } + /* * Confirm phase will not be executed if perform fails. End the * job started in begin phase. @@ -1358,6 +1369,17 @@ libxlDomainMigrationSrcConfirm(libxlDriverPrivate *d= river, virObjectEvent *event =3D NULL; =20 if (cancelled) { + /* Call hook to notify source host that migration failed */ + if (virHookPresent(VIR_HOOK_DRIVER_LIBXL)) { + g_autofree char *hookxml =3D NULL; + + if ((hookxml =3D virDomainDefFormat(vm->def, driver->xmlopt, + VIR_DOMAIN_DEF_FORMAT_SECURE= ))) + virHookCall(VIR_HOOK_DRIVER_LIBXL, vm->def->name, + VIR_HOOK_LIBXL_OP_MIGRATE_OUTGOING, VIR_HOOK_S= UBOP_END, + "failed", hookxml, NULL); + } + /* Resume lock process that was paused in MigrationSrcPerform */ virDomainLockProcessResume(driver->lockManager, "xen:///system", diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index e9ce2d8b8b..afb5161ea3 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -4218,6 +4218,18 @@ qemuMigrationSrcConfirmPhase(virQEMUDriver *driver, qemuDomainSetMaxMemLock(vm, 0, &priv->preMigrationMemlock); } =20 + /* Call hook to notify source host that migration failed */ + if (virHookPresent(VIR_HOOK_DRIVER_QEMU)) { + g_autofree char *xml =3D NULL; + + if ((xml =3D qemuDomainDefFormatLive(driver, priv->qemuCaps, + vm->def, priv->origCPU, + false, true))) + virHookCall(VIR_HOOK_DRIVER_QEMU, vm->def->name, + VIR_HOOK_QEMU_OP_MIGRATE_OUTGOING, VIR_HOOK_SU= BOP_END, + "failed", xml, NULL); + } + qemuDomainSaveStatus(vm); virErrorRestore(&orig_err); } --=20 2.53.0