]> git.proxmox.com Git - qemu-server.git/commitdiff
Close #880: ability to show paused state via the CLI
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Fri, 5 Feb 2016 07:46:34 +0000 (08:46 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Tue, 1 Mar 2016 10:59:44 +0000 (11:59 +0100)
qm list and qm status both show suspended VMs as 'running'
while the GUI's status summary shows them as 'paused'.

This patch makes 'qm status' always request the full status
and adds an optional '-full' parameter for 'qm list' to
use a full status query to include the 'paused' state. (This
is optional as it causes qmp requests to all running VMs.)

PVE/API2/Qemu.pm
PVE/CLI/qm.pm

index bf6f6fd75d50c64a0dc5bdaab4867f4d045b24af..efac2c77a38b914e540e5d9f0ca506285de94dfd 100644 (file)
@@ -228,6 +228,11 @@ __PACKAGE__->register_method({
        additionalProperties => 0,
        properties => {
            node => get_standard_option('pve-node'),
+           full => {
+               type => 'boolean',
+               optional => 1,
+               description => "Determine the full status of active VMs.",
+           },
        },
     },
     returns => {
@@ -244,7 +249,7 @@ __PACKAGE__->register_method({
        my $rpcenv = PVE::RPCEnvironment::get();
        my $authuser = $rpcenv->get_user();
 
-       my $vmstatus = PVE::QemuServer::vmstatus();
+       my $vmstatus = PVE::QemuServer::vmstatus(undef, $param->{full});
 
        my $res = [];
        foreach my $vmid (keys %$vmstatus) {
index fdac3d570070b03da25f2cd02d51c5d438b311df..0dd81590d6bacb5b4aee45c002d24087d611734e 100755 (executable)
@@ -119,7 +119,7 @@ __PACKAGE__->register_method ({
        # test if VM exists
        my $conf = PVE::QemuServer::load_config ($param->{vmid});
 
-       my $vmstatus = PVE::QemuServer::vmstatus($param->{vmid});
+       my $vmstatus = PVE::QemuServer::vmstatus($param->{vmid}, 1);
        my $stat = $vmstatus->{$param->{vmid}};
        if ($param->{verbose}) {
            foreach my $k (sort (keys %$stat)) {
@@ -129,7 +129,7 @@ __PACKAGE__->register_method ({
                print "$k: $v\n";
            }
        } else {
-           my $status = $stat->{status} || 'unknown';
+           my $status = $stat->{qmpstatus} || 'unknown';
            print "status: $status\n";
        }
 
@@ -392,7 +392,7 @@ our $cmddef = {
 
                 foreach my $rec (sort { $a->{vmid} <=> $b->{vmid} } @$vmlist) {
                     printf "%10s %-20s %-10s %-10s %12.2f %-10s\n", $rec->{vmid}, $rec->{name},
-                    $rec->{status},
+                    $rec->{qmpstatus} || $rec->{status},
                     ($rec->{maxmem} || 0)/(1024*1024),
                     ($rec->{maxdisk} || 0)/(1024*1024*1024),
                     $rec->{pid}||0;