Signed-off-by: Alexandre Derumier <aderum...@odiso.com> --- PVE/API2/Qemu.pm | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-)
diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm index e39e59b..d097662 100644 --- a/PVE/API2/Qemu.pm +++ b/PVE/API2/Qemu.pm @@ -832,9 +832,11 @@ my $update_vm_api = sub { my $delete_str = extract_param($param, 'delete'); + my $revert_str = extract_param($param, 'revert'); + my $force = extract_param($param, 'force'); - die "no options specified\n" if !$delete_str && !scalar(keys %$param); + die "no options specified\n" if !$delete_str && !$revert_str && !scalar(keys %$param); my $storecfg = PVE::Storage::config(); @@ -858,6 +860,15 @@ my $update_vm_api = sub { push @delete, $opt; } + my @revert = (); + foreach my $opt (PVE::Tools::split_list($revert_str)) { + if (!PVE::QemuServer::option_exists($opt)) { + raise_param_exc({ revert => "unknown option '$opt'" }); + } + + push @revert, $opt; + } + foreach my $opt (keys %$param) { if (PVE::QemuServer::valid_drivename($opt)) { # cleanup drive path @@ -900,6 +911,14 @@ my $update_vm_api = sub { print "update VM $vmid: " . join (' ', @paramarr) . "\n"; + foreach my $opt (PVE::Tools::split_list(@revert)) { + if (defined($conf->{$opt})) { + $param->{$opt} = $conf->{$opt}; + }elsif (defined($conf->{pending}->{$opt})) { + push @delete, $opt; + } + } + # write updates to pending section my $modified = {}; # record what $option we modify @@ -1081,6 +1100,11 @@ __PACKAGE__->register_method({ description => "A list of settings you want to delete.", optional => 1, }, + revert => { + type => 'string', format => 'pve-configid-list', + description => "Revert a pending change.", + optional => 1, + }, force => { type => 'boolean', description => $opt_force_description, @@ -1131,6 +1155,11 @@ __PACKAGE__->register_method({ description => "A list of settings you want to delete.", optional => 1, }, + revert => { + type => 'string', format => 'pve-configid-list', + description => "Revert a pending change.", + optional => 1, + }, force => { type => 'boolean', description => $opt_force_description, -- 1.7.10.4 _______________________________________________ pve-devel mailing list pve-devel@pve.proxmox.com http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel