type => 'number',
optional => 1,
},
+ lock => {
+ description => "The current config lock, if any.",
+ type => 'string',
+ optional => 1,
+ }
};
sub vmstatus {
eval { $d->{pid} = find_lxc_pid($vmid) if defined($active_hash->{$vmid}); };
warn $@ if $@; # ignore errors (consider them stopped)
- $d->{status} = $d->{pid} ? 'running' : 'stopped';
+ $d->{status} = $active_hash->{$vmid} ? 'running' : 'stopped';
my $cfspath = PVE::LXC::Config->cfs_config_path($vmid);
my $conf = PVE::Cluster::cfs_read_file($cfspath) || {};
$d->{diskwrite} = 0;
$d->{template} = PVE::LXC::Config->is_template($conf);
+ $d->{lock} = $conf->{lock} if $conf->{lock};
}
foreach my $vmid (keys %$list) {
}
my $copy_volume = sub {
- my ($src_volid, $src, $dst_volid, $dest, $storage_cfg, $snapname) = @_;
+ my ($src_volid, $src, $dst_volid, $dest, $storage_cfg, $snapname, $bwlimit) = @_;
my $src_mp = { volume => $src_volid, mp => '/', ro => 1 };
$src_mp->{type} = PVE::LXC::Config->classify_mountpoint($src_volid);
mountpoint_mount($dst_mp, $dest, $storage_cfg);
push @mounted, $dest;
+ $bwlimit //= 0;
+
PVE::Tools::run_command(['/usr/bin/rsync', '--stats', '-X', '-A', '--numeric-ids',
'-aH', '--whole-file', '--sparse', '--one-file-system',
- "$src/", $dest]);
+ "--bwlimit=$bwlimit", "$src/", $dest]);
};
my $err = $@;
foreach my $mount (reverse @mounted) {
# Should not be called after unsharing the mount namespace!
sub copy_volume {
- my ($mp, $vmid, $storage, $storage_cfg, $conf, $snapname) = @_;
+ my ($mp, $vmid, $storage, $storage_cfg, $conf, $snapname, $bwlimit) = @_;
die "cannot copy volumes of type $mp->{type}\n" if $mp->{type} ne 'volume';
File::Path::make_path("/var/lib/lxc/$vmid");
}
run_unshared(sub {
- $copy_volume->($mp->{volume}, $src, $new_volid, $dest, $storage_cfg, $snapname);
+ $copy_volume->($mp->{volume}, $src, $new_volid, $dest, $storage_cfg, $snapname, $bwlimit);
});
};
if (my $err = $@) {