[pve-devel] [PATCH_V2] Remove snapshots from LXC config, when you create LXC Backup
Wolfgang Link
w.link at proxmox.com
Thu Jul 30 13:45:10 CEST 2015
---
src/PVE/VZDump/LXC.pm | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/src/PVE/VZDump/LXC.pm b/src/PVE/VZDump/LXC.pm
index 21fb3c1..6fad10f 100644
--- a/src/PVE/VZDump/LXC.pm
+++ b/src/PVE/VZDump/LXC.pm
@@ -9,6 +9,7 @@ use PVE::Cluster qw(cfs_read_file);
use PVE::Storage;
use PVE::VZDump;
use PVE::LXC;
+use PVE::Tools;
use base qw (PVE::VZDump::Plugin);
@@ -221,14 +222,22 @@ 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};
+ delete $conf->{'pve.parent'};
+
+ open (my $fh, ">", "$dir/etc/vzdump/lxc.conf") ||
+ die "unable to open file '$dir/etc/vzdump/lxc.conf'\n";
+
+ PVE::Tools::safe_print("$dir/etc/vzdump/lxc.conf", $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