[pve-devel] [PATCH] Remove snapshots from LXC config, when you create LXC Backup

Wolfgang Link w.link at proxmox.com
Wed Jul 29 12:44:49 CEST 2015


---
 src/PVE/VZDump/LXC.pm | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/PVE/VZDump/LXC.pm b/src/PVE/VZDump/LXC.pm
index 21fb3c1..fc74007 100644
--- a/src/PVE/VZDump/LXC.pm
+++ b/src/PVE/VZDump/LXC.pm
@@ -221,14 +221,20 @@ sub resume_vm {
 sub assemble {
     my ($self, $task, $vmid) = @_;
 
-    my $conffile = PVE::LXC::config_file($vmid);
-
     my $dir = $task->{snapdir};
 
     $task->{cleanup}->{etc_vzdump} = 1;
 
     mkpath "$dir/etc/vzdump/";
-    $self->cmd ("cp '$conffile' '$dir/etc/vzdump/lxc.conf'");
+
+    my $conf = PVE::LXC::load_config($vmid);
+    delete $conf->{snapshots};
+
+    open (my $fh, ">",  "$dir/etc/vzdump/lxc.conf") ||
+	die "unable to open file '$dir/etc/vzdump/lxc.conf'\n";
+
+    print $fh PVE::LXC::write_lxc_config("/lxc/$vmid/config", $conf);
+    close $fh;
 }
 
 sub archive {
-- 
2.1.4





More information about the pve-devel mailing list