mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-07-09 21:54:46 +00:00
implement monitor API
This commit is contained in:
parent
4f1be36cdc
commit
91c94f0a23
@ -264,6 +264,7 @@ __PACKAGE__->register_method({
|
|||||||
{ subdir => 'migrate' },
|
{ subdir => 'migrate' },
|
||||||
{ subdir => 'rrd' },
|
{ subdir => 'rrd' },
|
||||||
{ subdir => 'rrddata' },
|
{ subdir => 'rrddata' },
|
||||||
|
{ subdir => 'monitor' },
|
||||||
];
|
];
|
||||||
|
|
||||||
return $res;
|
return $res;
|
||||||
@ -1245,4 +1246,39 @@ __PACKAGE__->register_method({
|
|||||||
return $upid;
|
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;
|
1;
|
||||||
|
Loading…
Reference in New Issue
Block a user