implement monitor API

This commit is contained in:
Dietmar Maurer 2011-11-09 08:26:46 +01:00
parent 4f1be36cdc
commit 91c94f0a23

View File

@ -264,6 +264,7 @@ __PACKAGE__->register_method({
{ subdir => 'migrate' },
{ subdir => 'rrd' },
{ subdir => 'rrddata' },
{ subdir => 'monitor' },
];
return $res;
@ -1245,4 +1246,39 @@ __PACKAGE__->register_method({
return $upid;
}});
__PACKAGE__->register_method({
name => 'monitor',
path => '{vmid}/monitor',
method => 'POST',
protected => 1,
proxyto => 'node',
description => "Execute Qemu monitor commands.",
parameters => {
additionalProperties => 0,
properties => {
node => get_standard_option('pve-node'),
vmid => get_standard_option('pve-vmid'),
command => {
type => 'string',
description => "The monitor command.",
}
},
},
returns => { type => 'string'},
code => sub {
my ($param) = @_;
my $vmid = $param->{vmid};
my $conf = PVE::QemuServer::load_config ($vmid); # check if VM exists
my $res = '';
eval {
$res = PVE::QemuServer::vm_monitor_command($vmid, $param->{command});
};
$res = "ERROR: $@" if $@;
return $res;
}});
1;