[pve-devel] [PATCH guest-common 3/6] Delete replication snapshots only if last_sync exists.

Thomas Lamprecht t.lamprecht at proxmox.com
Thu Dec 14 07:49:46 CET 2017


On 12/14/2017 07:47 AM, Thomas Lamprecht wrote:
> On 12/13/2017 03:46 PM, Wolfgang Link wrote:
>> @@ -134,10 +134,13 @@ sub prepare {
>>  	    if ((defined($snapname) && ($snap eq $snapname)) ||
>>  		(defined($parent_snapname) && ($snap eq $parent_snapname))) {
>>  		$last_snapshots->{$volid}->{$snap} = 1;
>> -	    } elsif ($snap =~ m/^\Q$prefix\E/) {
>> +	    } elsif ($snap =~ m/^\Q$prefix\E/ && $last_sync != 0) {
>>  		$logfunc->("delete stale replication snapshot '$snap' on $volid");
>>  		PVE::Storage::volume_snapshot_delete($storecfg, $volid, $snap);
>>  		$cleaned_replicated_volumes->{$volid} = 1;
>> +	    # Last_sync=0 and a replication snapshot only occur, if the VM was stolen
>> +	    } elsif ($snap =~ m/^\Q$prefix\E/) {
> 
> Hmm, with this we have to checks for if the $snap matches the prefix,

ugh, sorry: s/to checks/two checks/

> maybe do something in the like of:
> 
> } elsif ($snap =~ m/^\Q$prefix\E/) {
>      if ($last_sync) {
>            ...
>      } else {
>           # last_sync==0 but a snapshot => the VM was stolen (HA or manual move)
>           $last_snapshots->{$volid}->{$snap} = 1;
>      }
> }
> 
> 
>> +		$last_snapshots->{$volid}->{$snap} = 1;
>>  	    }
>>  	}
>>      }




More information about the pve-devel mailing list