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

Oguz Bektas o.bektas at proxmox.com
Mon Sep 30 14:44:37 CEST 2019


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({
-- 
2.20.1




More information about the pve-devel mailing list