[pve-devel] [[PATCH pve-container] 4/4] Prevent that CT run at clone time.

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Apr 20 11:07:18 CEST 2016



On 04/20/2016 08:06 AM, Wolfgang Link wrote:
> If we make a linked clone the CT must be a template, so it is not allowed to run.
> If we make a full clone, it is safer to have the CT offline.
> ---
>  src/PVE/API2/LXC.pm | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm
> index 5c0ae99..1037f66 100644
> --- a/src/PVE/API2/LXC.pm
> +++ b/src/PVE/API2/LXC.pm
> @@ -1079,7 +1079,7 @@ __PACKAGE__->register_method({
>  
>  	PVE::Cluster::check_cfs_quorum();
>  
> -	my $running = PVE::LXC::check_running($vmid) || 0;
> +	die "Clone can't be done online\n." if  PVE::LXC::check_running($vmid) || 0;
>  
>  	my $clonefn = sub {
>  
> @@ -1089,10 +1089,6 @@ __PACKAGE__->register_method({
>  
>  	    PVE::LXC::Config->check_lock($conf);
>  
> -	    my $verify_running = PVE::LXC::check_running($vmid) || 0;
> -
> -	    die "unexpected state change\n" if $verify_running != $running;
> -

You are moving the online checks here from inside the locked code to
outside, possible race condition?

>  	    die "snapshot '$snapname' does not exist\n"
>  		if $snapname && !defined( $conf->{snapshots}->{$snapname});
>  
> @@ -1125,7 +1121,7 @@ __PACKAGE__->register_method({
>  			} else {
>  			    # not full means clone instead of copy
>  			    die "Linked clone feature for '$volid' is not available\n"
> -				if !PVE::Storage::volume_has_feature($storecfg, 'clone', $volid, $snapname, $running);
> +				if !PVE::Storage::volume_has_feature($storecfg, 'clone', $volid, $snapname, 0);
>  			}
>  
>  			$mountpoints->{$opt} = $mp;





More information about the pve-devel mailing list