[pve-devel] [pve-container cli cleanup 3/5] pct status: use print_api_result
Dietmar Maurer
dietmar at proxmox.com
Thu Aug 9 11:43:44 CEST 2018
Signed-off-by: Dietmar Maurer <dietmar at proxmox.com>
---
src/PVE/CLI/pct.pm | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/src/PVE/CLI/pct.pm b/src/PVE/CLI/pct.pm
index 5e2bcc5..6be735f 100755
--- a/src/PVE/CLI/pct.pm
+++ b/src/PVE/CLI/pct.pm
@@ -747,7 +747,24 @@ our $cmddef = {
migrate => [ "PVE::API2::LXC", 'migrate_vm', ['vmid', 'target'], { node => $nodename }, $upid_exit],
move_volume => [ "PVE::API2::LXC", 'move_volume', ['vmid', 'volume', 'storage'], { node => $nodename }, $upid_exit ],
- status => [ __PACKAGE__, 'status', ['vmid']],
+ status => [ "PVE::API2::LXC::Status", 'vm_status', ['vmid'], { node => $nodename },
+ sub {
+ my ($data, $schema, $options) = @_;
+
+ if ($options->{verbose}) {
+ delete $data->{cpu}; # always 0
+ PVE::CLIFormatter::print_api_result($data, $schema, undef, $options);
+ } else {
+ my $status = $data->{status} || 'unknown';
+ PVE::CLIFormatter::print_api_result($status, { type => 'string' }, undef, $options);
+ }
+
+ }, PVE::RESTHandler::add_standard_output_properties({
+ verbose => {
+ description => "Verbose output format.",
+ type => 'boolean',
+ optional => 1,
+ }})],
console => [ __PACKAGE__, 'console', ['vmid']],
enter => [ __PACKAGE__, 'enter', ['vmid']],
unlock => [ __PACKAGE__, 'unlock', ['vmid']],
--
2.11.0
More information about the pve-devel
mailing list