[pve-devel] [PATCH qemu-server 2/2] fix #2367: do not allow snapshot with name PENDING
Thomas Lamprecht
t.lamprecht at proxmox.com
Thu Oct 24 12:28:30 CEST 2019
On 10/22/19 12:23 PM, Oguz Bektas wrote:
> On Tue, Oct 22, 2019 at 12:15:35PM +0200, Stefan Reiter wrote:
>> On 10/22/19 12:12 PM, 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.bektas at proxmox.com>
>>> ---
>>> PVE/QemuServer.pm | 5 ++++-
>>> 1 file changed, 4 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
>>> index 694e1f4..0f685d0 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" if $snapname =~ m/^pending$/i;
>>
>> Maybe a more descriptive error message would make sense too?
>>
>> "internal error: snapshot name 'pending' is forbidden\n" ?
>
> sure. even better:
> "internal error: snapshot name '$snapname' is forbidden\n"
and please change the check to
.. if lc($snapname) eq 'pending';
More information about the pve-devel
mailing list