[pve-devel] [PATCH qemu-server v2 5/8] add an guest agent index call
Dominik Csapak
d.csapak at proxmox.com
Thu Feb 15 14:04:50 CET 2018
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
PVE/API2/Qemu/Agent.pm | 38 ++++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/PVE/API2/Qemu/Agent.pm b/PVE/API2/Qemu/Agent.pm
index e082aec..864bdfe 100644
--- a/PVE/API2/Qemu/Agent.pm
+++ b/PVE/API2/Qemu/Agent.pm
@@ -63,6 +63,44 @@ my $guest_agent_commands = {
},
};
+__PACKAGE__->register_method({
+ name => 'index',
+ path => '',
+ proxyto => 'node',
+ method => 'GET',
+ description => "Qemu Agent command index.",
+ permissions => {
+ user => 'all',
+ },
+ parameters => {
+ additionalProperties => 1,
+ properties => {
+ node => get_standard_option('pve-node'),
+ vmid => get_standard_option('pve-vmid', {
+ completion => \&PVE::QemuServer::complete_vmid_running }),
+ },
+ },
+ returns => {
+ type => 'array',
+ items => {
+ type => "object",
+ properties => {},
+ },
+ links => [ { rel => 'child', href => '{name}' } ],
+ description => "Returns the list of Qemu Agent commands",
+ },
+ code => sub {
+ my ($param) = @_;
+
+ my $result = [];
+
+ for my $cmd (sort keys %$guest_agent_commands) {
+ push @$result, { name => $cmd };
+ }
+
+ return $result;
+ }});
+
sub register_command {
my ($class, $command, $method, $perm) = @_;
--
2.11.0
More information about the pve-devel
mailing list