[pve-devel] [PATCH 7/7] update_vm api : add optionnal revert option
Dietmar Maurer
dietmar at proxmox.com
Wed Jan 7 10:26:04 CET 2015
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?
More information about the pve-devel
mailing list