On 10/24/19 1:53 PM, Oguz Bektas wrote:
> to make the pct/qemu config formats more similar, we can namespace the
> pending section using the 'pve:' prefix like in pct parser.
> 
> the new format is optional in the parser, but default in the writer.
> 
> with PVE 7.0, we can make it default in parser too.

no, we cannot simply do this, this is wrong, you can theoretically
have a PENDING now and it can be kept in their until a VM gets
live-migrated to 7.0, which still needs to work! Remove those
comments.

> Signed-off-by: Oguz Bektas <o.bek...@proxmox.com>
> ---
>  PVE/QemuServer.pm | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
> index 7b225da..8d7994e 100644
> --- a/PVE/QemuServer.pm
> +++ b/PVE/QemuServer.pm
> @@ -2643,7 +2643,8 @@ sub parse_vm_config {
>      foreach my $line (@lines) {
>       next if $line =~ m/^\s*$/;
>  
> -     if ($line =~ m/^\[PENDING\]\s*$/i) {
> +     if ($line =~ m/^\[(?:pve:)?pending\]\s*$/i) {
> +         # TODO: make 'pve:' prefix non-optional with PVE 7.0
>           $section = 'pending';
>           if (defined($descr)) {
>               $descr =~ s/\s+$//;


> @@ -2684,7 +2685,7 @@ sub parse_vm_config {
>           if ($section eq 'pending') {
>               $conf->{delete} = $value; # we parse this later
>           } else {
> -             warn "vm $vmid - propertry 'delete' is only allowed in 
> [PENDING]\n";
> +             warn "vm $vmid - property 'delete' is only allowed as a pending 
> change\n";
>           }
>       } elsif ($line =~ m/^([a-z][a-z_]*\d*):\s*(.+?)\s*$/) {
>           my $key = $1;
> @@ -2750,7 +2751,7 @@ sub write_vm_config {
>               $key eq 'snapstate' || $key eq 'pending';
>           my $value = $cref->{$key};
>           if ($key eq 'delete') {
> -             die "propertry 'delete' is only allowed in [PENDING]\n"
> +             die "property 'delete' is only allowed as a pending change\n"
>                   if !$pending;
>               # fixme: check syntax?
>               next;
> @@ -2810,7 +2811,7 @@ sub write_vm_config {
>      my $raw = &$generate_raw_config($conf);
>  
>      if (scalar(keys %{$conf->{pending}})){
> -     $raw .= "\n[PENDING]\n";
> +     $raw .= "\n[pve:pending]\n";
>       $raw .= &$generate_raw_config($conf->{pending}, 1);
>      }
>  
> @@ -4820,7 +4821,7 @@ my $fast_plug_option = {
>      'hookscript' => 1,
>  };
>  
> -# hotplug changes in [PENDING]
> +# hotplug changes in [pve:pending]
>  # $selection hash can be used to only apply specified options, for
>  # example: { cores => 1 } (only apply changed 'cores')
>  # $errors ref is used to return error messages
> 


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

Reply via email to