]> git.proxmox.com Git - pve-client.git/commitdiff
Add the remaining guest commands
authorRené Jochum <r.jochum@proxmox.com>
Thu, 14 Jun 2018 10:15:38 +0000 (12:15 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 14 Jun 2018 10:41:12 +0000 (12:41 +0200)
Signed-off-by: René Jochum <r.jochum@proxmox.com>
PVE/APIClient/Commands/GuestStatus.pm
pveclient

index 57784e58b17400ab66a434cb900c6f1c9d0b4c75..92f424d1a937f86dfb1c0dcf7d52ce21c1895e77 100644 (file)
@@ -61,6 +61,11 @@ __PACKAGE__->register_method ({
        properties => {
            remote => get_standard_option('pveclient-remote-name'),
            vmid => get_standard_option('pve-vmid'),
        properties => {
            remote => get_standard_option('pveclient-remote-name'),
            vmid => get_standard_option('pve-vmid'),
+           timeout => {
+               description => "Timeout in seconds",
+               type => 'integer',
+               minimum => 1
+           },
        },
     },
     returns => { type => 'null'},
        },
     },
     returns => { type => 'null'},
@@ -75,6 +80,88 @@ __PACKAGE__->register_method ({
        return undef;
     }});
 
        return undef;
     }});
 
+__PACKAGE__->register_method ({
+    name => 'shutdown',
+    path => 'shutdown',
+    method => 'POST',
+    description => "Stop a guest (VM/Container).",
+    parameters => {
+       additionalProperties => 0,
+       properties => {
+           remote => get_standard_option('pveclient-remote-name'),
+           vmid => get_standard_option('pve-vmid'),
+           force => {
+               description => "Make sure the Container/VM stops.",
+               type => 'boolean',
+               optional => 1,
+           },
+           timeout => {
+               description => "Timeout in seconds",
+               type => 'integer',
+               minimum => 1
+           },
+       },
+    },
+    returns => { type => 'null'},
+    code => sub {
+       my ($param) = @_;
+
+       my $remote = PVE::APIClient::Tools::extract_param($param, 'remote');
+       my $vmid = PVE::APIClient::Tools::extract_param($param, 'vmid');
+
+       $guest_status_command->($remote, $vmid, 'shutdown', $param);
+
+       return undef;
+    }});
+
+__PACKAGE__->register_method ({
+    name => 'suspend',
+    path => 'suspend',
+    method => 'POST',
+    description => "Suspend a guest VM.",
+    parameters => {
+       additionalProperties => 0,
+       properties => {
+           remote => get_standard_option('pveclient-remote-name'),
+           vmid => get_standard_option('pve-vmid'),
+       },
+    },
+    returns => { type => 'null'},
+    code => sub {
+       my ($param) = @_;
+
+       my $remote = PVE::APIClient::Tools::extract_param($param, 'remote');
+       my $vmid = PVE::APIClient::Tools::extract_param($param, 'vmid');
+
+       $guest_status_command->($remote, $vmid, 'suspend', $param);
+
+       return undef;
+    }});
+
+__PACKAGE__->register_method ({
+    name => 'resume',
+    path => 'resume',
+    method => 'POST',
+    description => "Resume a guest VM.",
+    parameters => {
+       additionalProperties => 0,
+       properties => {
+           remote => get_standard_option('pveclient-remote-name'),
+           vmid => get_standard_option('pve-vmid'),
+       },
+    },
+    returns => { type => 'null'},
+    code => sub {
+       my ($param) = @_;
+
+       my $remote = PVE::APIClient::Tools::extract_param($param, 'remote');
+       my $vmid = PVE::APIClient::Tools::extract_param($param, 'vmid');
+
+       $guest_status_command->($remote, $vmid, 'resume', $param);
+
+       return undef;
+    }});
+
 __PACKAGE__->register_method ({
     name => 'spice',
     path => 'spice',
 __PACKAGE__->register_method ({
     name => 'spice',
     path => 'spice',
index 6498622565dbf6171bca920d5cb1448616156443..34e2aab8b1b14028e534bc0024cf8420ad529fa1 100755 (executable)
--- a/pveclient
+++ b/pveclient
@@ -178,9 +178,12 @@ our $cmddef = {
     lxc => $PVE::APIClient::Commands::lxc::cmddef,
     remote => $PVE::APIClient::Commands::remote::cmddef,
 
     lxc => $PVE::APIClient::Commands::lxc::cmddef,
     remote => $PVE::APIClient::Commands::remote::cmddef,
 
+    resume => [ 'PVE::APIClient::Commands::GuestStatus', 'resume', ['remote', 'vmid']],
+    shutdown => [ 'PVE::APIClient::Commands::GuestStatus', 'shutdown', ['remote', 'vmid']],
     spice => [ 'PVE::APIClient::Commands::GuestStatus', 'spice', ['remote', 'vmid']],
     start => [ 'PVE::APIClient::Commands::GuestStatus', 'start', ['remote', 'vmid']],
     stop => [ 'PVE::APIClient::Commands::GuestStatus', 'stop', ['remote', 'vmid']],
     spice => [ 'PVE::APIClient::Commands::GuestStatus', 'spice', ['remote', 'vmid']],
     start => [ 'PVE::APIClient::Commands::GuestStatus', 'start', ['remote', 'vmid']],
     stop => [ 'PVE::APIClient::Commands::GuestStatus', 'stop', ['remote', 'vmid']],
+    suspend => [ 'PVE::APIClient::Commands::GuestStatus', 'suspend', ['remote', 'vmid']],
 
     api => {
        get => [ __PACKAGE__, 'pveclient_get', ['remote', 'api_path'], {}, $format_result ],
 
     api => {
        get => [ __PACKAGE__, 'pveclient_get', ['remote', 'api_path'], {}, $format_result ],