[pve-devel] [PATCH container] Fix #1070: vzdump: handle sparse files in suspend mode
Wolfgang Bumiller
w.bumiller at proxmox.com
Fri Jul 29 09:48:59 CEST 2016
In suspend mode we perform two rsyncs with --inplace which
is incompatible to --sparse. However, only the second one
really needs to do in-place updates, so the first stage
should use --sparse instead.
---
src/PVE/VZDump/LXC.pm | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/PVE/VZDump/LXC.pm b/src/PVE/VZDump/LXC.pm
index c4fa2b1..7062bf3 100644
--- a/src/PVE/VZDump/LXC.pm
+++ b/src/PVE/VZDump/LXC.pm
@@ -17,7 +17,7 @@ use base qw (PVE::VZDump::Plugin);
my $default_mount_point = "/mnt/vzsnap0";
my $rsync_vm = sub {
- my ($self, $task, $to, $text) = @_;
+ my ($self, $task, $to, $text, $first) = @_;
my $disks = $task->{disks};
my $from = $disks->[0]->{dir} . '/';
@@ -28,7 +28,8 @@ my $rsync_vm = sub {
my @xattr = $task->{no_xattrs} ? () : ('-X', '-A');
my $rsync = ['rsync', '--stats', @xattr, '--numeric-ids',
- '-aH', '--delete', '--no-whole-file', '--inplace',
+ '-aH', '--delete', '--no-whole-file',
+ ($first ? '--sparse' : '--inplace'),
'--one-file-system', '--relative'];
push @$rsync, "--bwlimit=$opts->{bwlimit}" if $opts->{bwlimit};
push @$rsync, map { "--exclude=$_" } @{$self->{vzdump}->{findexcl}};
@@ -235,13 +236,13 @@ sub copy_data_phase1 {
}
}
- $self->$rsync_vm($task, $task->{snapdir}, "first");
+ $self->$rsync_vm($task, $task->{snapdir}, "first", 1);
}
sub copy_data_phase2 {
my ($self, $task) = @_;
- $self->$rsync_vm($task, $task->{snapdir}, "final");
+ $self->$rsync_vm($task, $task->{snapdir}, "final", 0);
}
sub stop_vm {
--
2.1.4
More information about the pve-devel
mailing list