[pve-devel] [PATCH qemu-server 1/1] Add VM hooks for pre/post-clone

Stefan Hanreich s.hanreich at proxmox.com
Fri Sep 23 11:55:29 CEST 2022


Signed-off-by: Stefan Hanreich <s.hanreich at proxmox.com>
---
 PVE/API2/Qemu.pm | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index 3ec31c2..23a7658 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -3417,6 +3417,8 @@ __PACKAGE__->register_method({
 	    my ($conffile, $newconf, $oldconf, $vollist, $drives, $fullclone) = $load_and_check->();
 	    my $storecfg = PVE::Storage::config();
 
+	    PVE::GuestHelpers::exec_hookscript($newconf, $newid, "pre-clone", 1);
+
 	    # auto generate a new uuid
 	    my $smbios1 = PVE::QemuServer::parse_smbios1($newconf->{smbios1} || '');
 	    $smbios1->{uuid} = PVE::QemuServer::generate_uuid();
@@ -3545,6 +3547,8 @@ __PACKAGE__->register_method({
 		die "clone failed: $err";
 	    }
 
+	    PVE::GuestHelpers::exec_hookscript($newconf, $newid, "post-clone");
+
 	    return;
 	};
 
-- 
2.30.2





More information about the pve-devel mailing list