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

Wolfgang Link w.link at proxmox.com
Wed Apr 20 12:07:36 CEST 2016



On 04/20/2016 11:07 AM, Thomas Lamprecht wrote:
> 
> 
> 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?

What race condition if the CT is running it fail, after the the quorum
check?
The code does noting until this line.
> 
>>  	    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;
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 



More information about the pve-devel mailing list