[pve-devel] [PATCH v2 container] refuse to add non-replicatable disks to replicating VMs

Dietmar Maurer dietmar at proxmox.com
Tue Jun 27 11:46:26 CEST 2017


> diff --git a/src/PVE/API2/LXC/Config.pm b/src/PVE/API2/LXC/Config.pm
> index e3909a3..bf6b399 100644
> --- a/src/PVE/API2/LXC/Config.pm
> +++ b/src/PVE/API2/LXC/Config.pm
> @@ -128,6 +128,26 @@ __PACKAGE__->register_method({
>  
>  	my $storage_cfg = cfs_read_file("storage.cfg");
>  
> +	my $repl_conf = PVE::ReplicationConfig->new();
> +	my $is_replicated = $repl_conf->check_for_existing_jobs($vmid, 1);
> +	if ($is_replicated) {
> +	    PVE::LXC::Config->foreach_mountpoint_full($param, 0, sub {
> +		my ($opt, $mountpoint) = @_;
> +		my $volid = $mountpoint->{volume};
> +		return if !$volid || !($mountpoint->{replicate}//1);
> +		my ($storeid, $format);
> +		if ($volid =~ $PVE::LXC::NEW_DISK_RE) {
> +		    $storeid = $1;
> +		    $format = $mountpoint->{format} ||
> PVE::Storage::storage_default_format($storage_cfg, $storeid);
> +		} else {
> +		    ($storeid, undef) = PVE::Storage::parse_volume_id($volid, 1);

This does not work for bind mounts?




More information about the pve-devel mailing list