[pve-devel] r6449 - qemu-server/pve2
svn-commits at proxmox.com
svn-commits at proxmox.com
Wed Aug 10 14:17:03 CEST 2011
Author: dietmar
Date: 2011-08-10 14:17:03 +0200 (Wed, 10 Aug 2011)
New Revision: 6449
Modified:
qemu-server/pve2/qm
Log:
improve manual page
Modified: qemu-server/pve2/qm
===================================================================
--- qemu-server/pve2/qm 2011-08-10 11:48:11 UTC (rev 6448)
+++ qemu-server/pve2/qm 2011-08-10 12:17:03 UTC (rev 6449)
@@ -37,6 +37,12 @@
my $nodename = PVE::INotify::nodename();
+PVE::JSONSchema::register_standard_option('skiplock', {
+ description => "Ignore locks - only root is allowed to use this option.",
+ type => 'boolean',
+ optional => 1,
+});
+
sub run_vnc_proxy {
my ($vmid) = @_;
@@ -406,24 +412,46 @@
stopall => [ __PACKAGE__, 'stopall', []],
- mtunnel => [ __PACKAGE__, 'mtunnel', []],
+ mtunnel => [ __PACKAGE__, 'mtunnel', []],
+};
+sub register_vm_command {
+ my ($cmd, $descr) = @_;
- start => [ "PVE::API2::Qemu", 'vm_command', ['vmid'],
- { node => $nodename, command => 'start' } ],
- stop => [ "PVE::API2::Qemu", 'vm_command', ['vmid'],
- { node => $nodename, command => 'stop' } ],
- reset => [ "PVE::API2::Qemu", 'vm_command', ['vmid'],
- { node => $nodename, command => 'reset' } ],
- suspend => [ "PVE::API2::Qemu", 'vm_command', ['vmid'],
- { node => $nodename, command => 'suspend' } ],
- resume => [ "PVE::API2::Qemu", 'vm_command', ['vmid'],
- { node => $nodename, command => 'resume' } ],
- cad => [ "PVE::API2::Qemu", 'vm_command', ['vmid'],
- { node => $nodename, command => 'cad' } ],
-
-};
+ # we create a wrapper, because we want one 'description' per command
+ __PACKAGE__->register_method ({
+ name => $cmd,
+ path => $cmd,
+ method => 'PUT',
+ description => $descr,
+ parameters => {
+ additionalProperties => 0,
+ properties => {
+ vmid => get_standard_option('pve-vmid'),
+ skiplock => get_standard_option('skiplock'),
+ },
+ },
+ returns => { type => 'null'},
+ code => sub {
+ my ($param) = @_;
+ $param->{command} = $cmd;
+ $param->{node} = $nodename;
+
+ return PVE::API2::Qemu->vm_command($param);
+ }});
+
+ $cmddef->{$cmd} = [ __PACKAGE__, $cmd, ['vmid']];
+}
+
+register_vm_command('start', "Start virtual machine.");
+register_vm_command('stop', "Stop virtual machine.");
+register_vm_command('reset', "Reset virtual machine.");
+register_vm_command('shutdown', "Shutdown virtual machine (send ACPI showdown request)");
+register_vm_command('suspend', "Suspend virtual machine.");
+register_vm_command('resume', "Resume virtual machine.");
+register_vm_command('cad', "Send CTRL-ALT-DELETE keys.");
+
my $cmd = shift;
PVE::CLIHandler::handle_cmd($cmddef, "qm", $cmd, \@ARGV, undef, $0);
More information about the pve-devel
mailing list