[pve-devel] [PATCH pve-docs 1/1] Add pre/post-migrate events for target and source to example hookscript

Stefan Hanreich s.hanreich at proxmox.com
Thu Sep 22 16:13:20 CEST 2022


Signed-off-by: Stefan Hanreich <s.hanreich at proxmox.com>
---
 examples/guest-example-hookscript.pl | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/examples/guest-example-hookscript.pl b/examples/guest-example-hookscript.pl
index adeed59..e4adf6d 100755
--- a/examples/guest-example-hookscript.pl
+++ b/examples/guest-example-hookscript.pl
@@ -54,6 +54,34 @@ if ($phase eq 'pre-start') {
 
     print "$vmid stopped. Doing cleanup.\n";
 
+} elsif ($phase eq 'pre-migrate-source') {
+
+    # Phase 'pre-migrate-source' will be run before a migration on the source
+    # node of the VM/CT
+
+    print "preparing $vmid for migration on source.\n";
+
+} elsif ($phase eq 'post-migrate-source') {
+
+    # Phase 'post-migrate-source' will be run after a migration on the source
+    # node of the VM/CT
+
+    print "$vmid finished migrating on source.\n";
+
+} elsif ($phase eq 'pre-migrate-target') {
+
+    # Phase 'pre-migrate-target' will be run before a migration on the target
+    # node of the VM/CT
+
+    print "preparing $vmid for migration on target.\n";
+
+} elsif ($phase eq 'post-migrate-target') {
+
+    # Phase 'post-migrate-target' will be run after a migration on the target
+    # node of the VM/CT
+
+    print "$vmid finished migrating on target.\n";
+
 } else {
     die "got unknown phase '$phase'\n";
 }
-- 
2.30.2





More information about the pve-devel mailing list