[pve-devel] r6076 - qemu-server/pve2

svn-commits at proxmox.com svn-commits at proxmox.com
Wed Jun 15 07:03:59 CEST 2011


Author: dietmar
Date: 2011-06-15 07:03:59 +0200 (Wed, 15 Jun 2011)
New Revision: 6076

Modified:
   qemu-server/pve2/ChangeLog
   qemu-server/pve2/qm
Log:


Modified: qemu-server/pve2/ChangeLog
===================================================================
--- qemu-server/pve2/ChangeLog	2011-06-14 13:05:21 UTC (rev 6075)
+++ qemu-server/pve2/ChangeLog	2011-06-15 05:03:59 UTC (rev 6076)
@@ -1,3 +1,7 @@
+2011-06-15  Proxmox Support Team  <support at proxmox.com>
+
+	* qm (status): impl. verbose option 
+
 2011-03-09  Proxmox Support Team  <support at proxmox.com>
 
 	* PVE/QemuServer.pm (vmstatus): report sizes in bytes, list disk

Modified: qemu-server/pve2/qm
===================================================================
--- qemu-server/pve2/qm	2011-06-14 13:05:21 UTC (rev 6075)
+++ qemu-server/pve2/qm	2011-06-15 05:03:59 UTC (rev 6076)
@@ -108,24 +108,33 @@
     	additionalProperties => 0,
 	properties => {
 	    vmid => get_standard_option('pve-vmid'),
+	    verbose => {
+		description => "Verbose output format",
+		type => 'boolean',
+		optional => 1,
+	    }
 	},
     },
     returns => { type => 'null'},
     code => sub {
 	my ($param) = @_;
 
-	my $status = 'unknown';
+	# test if VM exists
+	my $conf = PVE::QemuServer::load_config ($param->{vmid});
 
-	eval { 
-	    if (PVE::QemuServer::check_running($param->{vmid})) {
-		$status = 'running';
-	    } else {
-		$status = 'stopped';
+	my $vmstatus = PVE::QemuServer::vmstatus($param->{vmid});
+	my $stat = $vmstatus->{$param->{vmid}};
+	if ($param->{verbose}) {
+	    foreach my $k (sort (keys %$stat)) {
+		next if $k eq 'cpu' || $k eq 'relcpu'; # always 0
+		my $v = $stat->{$k};
+		print "$k: $v\n";
 	    }
-	};
+	} else {
+	    my $status = $stat->{status} || 'unknown';
+	    print "status: $status\n";
+	}
 
-	print "$status\n";
-
 	return undef;
     }});
 




More information about the pve-devel mailing list