[pve-devel] [PATCH 7/7] update_vm api : add optionnal revert option

Alexandre DERUMIER aderumier at odiso.com
Wed Jan 7 10:48:24 CET 2015


Damn, I really don't known what I have done here ...sorry

I wanted to do:

foreach my $opt (@revert) {

----- Mail original -----
De: "dietmar" <dietmar at proxmox.com>
À: "pve-devel" <pve-devel at pve.proxmox.com>
Envoyé: Mercredi 7 Janvier 2015 10:26:04
Objet: Re: [pve-devel] [PATCH 7/7] update_vm api : add optionnal revert option

On 01/02/2015 03:16 PM, Alexandre Derumier wrote: 
> Signed-off-by: Alexandre Derumier <aderumier at 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)) { 

I do not really understand that - why do you try to split an array? 

_______________________________________________ 
pve-devel mailing list 
pve-devel at pve.proxmox.com 
http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel 




More information about the pve-devel mailing list