]>
git.proxmox.com Git - qemu-server.git/blob - PVE/API2/Qemu/Agent.pm
1 package PVE
::API2
::Qemu
::Agent
;
7 use PVE
::JSONSchema
qw(get_standard_option);
10 use base
qw(PVE::RESTHandler);
12 my $guest_agent_commands = [
20 'network-get-interfaces',
24 'get-memory-block-info',
31 __PACKAGE__-
>register_method({
37 description
=> "Execute Qemu Guest Agent commands.",
39 check
=> ['perm', '/vms/{vmid}', [ 'VM.Monitor' ]],
42 additionalProperties
=> 0,
44 node
=> get_standard_option
('pve-node'),
45 vmid
=> get_standard_option
('pve-vmid', {
46 completion
=> \
&PVE
::QemuServer
::complete_vmid_running
}),
49 description
=> "The QGA command.",
50 enum
=> $guest_agent_commands,
56 description
=> "Returns an object with a single `result` property. The type of that
57 property depends on the executed command.",
62 my $vmid = $param->{vmid
};
64 my $conf = PVE
::QemuConfig-
>load_config ($vmid); # check if VM exists
66 die "No Qemu Guest Agent\n" if !defined($conf->{agent
});
67 die "VM $vmid is not running\n" if !PVE
::QemuServer
::check_running
($vmid);
69 my $cmd = $param->{command
};
71 my $res = PVE
::QemuServer
::vm_mon_cmd
($vmid, "guest-$cmd");
73 return { result
=> $res };