pass $clone=1 to avoid removing the file. instead we truncate it to an
empty file

Signed-off-by: Oguz Bektas <o.bek...@proxmox.com>
---
v2->v3:
* clear machine-id at the end of clone task worker

 src/PVE/API2/LXC.pm | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm
index a9ea3a6..d5c12dc 100644
--- a/src/PVE/API2/LXC.pm
+++ b/src/PVE/API2/LXC.pm
@@ -1590,6 +1590,12 @@ __PACKAGE__->register_method({
                die "clone failed: $err";
            }
 
+           my $lastconf = PVE::LXC::Config->load_config($newid);
+           my $rootdir = PVE::LXC::mount_all($newid, $storecfg, $lastconf, 1);
+           my $lxc_setup = PVE::LXC::Setup->new($lastconf, $rootdir);
+           $lxc_setup->clear_machine_id($lastconf, 1);
+           PVE::LXC::umount_all($newid, $storecfg, $lastconf, 1);
+
            return;
        };
 
-- 
2.20.1



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to