From 154ccdcdbcd590d0d3c751d8a532aacc732aa521 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Mon, 10 Sep 2012 07:58:06 +0200 Subject: [PATCH] improve snapshot REST interface --- PVE/API2/Qemu.pm | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm index 56b30717..82df3828 100644 --- a/PVE/API2/Qemu.pm +++ b/PVE/API2/Qemu.pm @@ -457,7 +457,6 @@ __PACKAGE__->register_method({ { subdir => 'rrddata' }, { subdir => 'monitor' }, { subdir => 'snapshot' }, - { subdir => 'rollback' }, ]; return $res; @@ -1990,9 +1989,47 @@ __PACKAGE__->register_method({ return $rpcenv->fork_worker('qmsnapshot', $vmid, $authuser, $realcmd); }}); +__PACKAGE__->register_method({ + name => 'snapshot_cmd_idx', + path => '{vmid}/snapshot/{snapname}', + description => '', + method => 'GET', + permissions => { + user => 'all', + }, + parameters => { + additionalProperties => 0, + properties => { + vmid => get_standard_option('pve-vmid'), + node => get_standard_option('pve-node'), + snapname => { + type => 'string', + description => "The name of the snapshot", + maxLength => 40, + }, + }, + }, + returns => { + type => 'array', + items => { + type => "object", + properties => {}, + }, + links => [ { rel => 'child', href => "{cmd}" } ], + }, + code => sub { + my ($param) = @_; + + my $res = []; + + push @$res, { cmd => 'rollback' }; + + return $res; + }}); + __PACKAGE__->register_method({ name => 'rollback', - path => '{vmid}/rollback', + path => '{vmid}/snapshot/{snapname}/rollback', method => 'POST', protected => 1, proxyto => 'node',