[pve-devel] [PATCH v2 qemu-server 05/18] use load_current_config for config GET call

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Oct 2 11:43:20 CEST 2019


On 9/30/19 2:44 PM, Oguz Bektas wrote:
> Signed-off-by: Oguz Bektas <o.bektas at proxmox.com>
> ---
>  PVE/API2/Qemu.pm | 35 +----------------------------------
>  1 file changed, 1 insertion(+), 34 deletions(-)
> 
> diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
> index 267a08e..aa1cd16 100644
> --- a/PVE/API2/Qemu.pm
> +++ b/PVE/API2/Qemu.pm
> @@ -865,40 +865,7 @@ __PACKAGE__->register_method({
>      code => sub {
>  	my ($param) = @_;
>  
> -	my $conf = PVE::QemuConfig->load_config($param->{vmid});
> -
> -	if (my $snapname = $param->{snapshot}) {
> -	    my $snapshot = $conf->{snapshots}->{$snapname};
> -	    die "snapshot '$snapname' does not exist\n" if !defined($snapshot);
> -
> -	    $snapshot->{digest} = $conf->{digest}; # keep file digest for API
> -
> -	    $conf = $snapshot;
> -	}
> -
> -	delete $conf->{snapshots};
> -
> -	if (!$param->{current}) {
> -	    foreach my $opt (keys %{$conf->{pending}}) {
> -		next if $opt eq 'delete';
> -		my $value = $conf->{pending}->{$opt};
> -		next if ref($value); # just to be sure
> -		$conf->{$opt} = $value;
> -	    }
> -	    my $pending_delete_hash = PVE::QemuServer::split_flagged_list($conf->{pending}->{delete});
> -	    foreach my $opt (keys %$pending_delete_hash) {
> -		delete $conf->{$opt} if $conf->{$opt};
> -	    }
> -	}
> -
> -	delete $conf->{pending};
> -
> -	# hide cloudinit password
> -	if ($conf->{cipassword}) {
> -	    $conf->{cipassword} = '**********';
> -	}
> -
> -	return $conf;
> +	return PVE::QemuConfig->load_current_config($param->{vmid}, $param->{snapshot}, $param->{current});
>      }});
>  
>  __PACKAGE__->register_method({
> 

I'd squash 05/18 and 04/18, IMO they are a single logical change and
it helps to connect the changes and overwrite much better together,
for me at least.




More information about the pve-devel mailing list