On November 22, 2019 1:35 pm, Oguz Bektas wrote:
> hi,
> 
> will this get applied?

applied this patch, with the following additional check:

commit a85c6be13e40230ae9ca201fcf92cfc381bdd26a
Author:     Fabian Grünbichler <f.gruenbich...@proxmox.com>
AuthorDate: Mon Nov 25 10:02:46 2019 +0100
Commit:     Fabian Grünbichler <f.gruenbich...@proxmox.com>
CommitDate: Mon Nov 25 10:02:48 2019 +0100

    api: catch 'pending' as snapshot name early
    
    instead of only at write_config time.
    
    Signed-off-by: Fabian Grünbichler <f.gruenbich...@proxmox.com>

diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index bd907cd..95a0cc5 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -3715,6 +3715,9 @@ __PACKAGE__->register_method({
        die "unable to use snapshot name 'current' (reserved name)\n"
            if $snapname eq 'current';
 
+       die "unable to use snapshot name 'pending' (reserved name)\n"
+           if lc($snapname) eq 'pending';
+
        my $realcmd = sub {
            PVE::Cluster::log_msg('info', $authuser, "snapshot VM $vmid: 
$snapname");
            PVE::QemuConfig->snapshot_create($vmid, $snapname, 
$param->{vmstate},

> 
> 
> On Thu, Oct 24, 2019 at 01:53:09PM +0200, Oguz Bektas wrote:
>> or any other variant of the word 'pending'.
>> 
>> note that we can actually allow this snapshot after PVE 7.0, since
>> pending section and snapshots will be properly namespaced.
>> ([pve:pending] and [snap:$snapname] or similar).
>> 
>> Signed-off-by: Oguz Bektas <o.bek...@proxmox.com>
>> ---
>>  PVE/QemuServer.pm | 5 ++++-
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>> 
>> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
>> index 8d7994e..3669643 100644
>> --- a/PVE/QemuServer.pm
>> +++ b/PVE/QemuServer.pm
>> @@ -2773,7 +2773,10 @@ sub write_vm_config {
>>      &$cleanup_config($conf->{pending}, 1);
>>  
>>      foreach my $snapname (keys %{$conf->{snapshots}}) {
>> -    die "internal error" if $snapname eq 'pending';
>> +    # TODO: we can allow snapshots with name 'pending' after PVE 7.0
>> +    # since pending section is namespaced with 'pve:'
>> +    # but for now, we should forbid it to avoid confusion in parser
>> +    die "internal error: snapshot name '$snapname' is forbidden" if 
>> lc($snapname) eq 'pending';
>>      &$cleanup_config($conf->{snapshots}->{$snapname}, undef, $snapname);
>>      }
>>  
>> -- 
>> 2.20.1
>> 
>> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel@pve.proxmox.com
> https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 
> 

_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to