]> git.proxmox.com Git - pve-storage.git/commitdiff
Add apiinfo helper to pvesm
authorFabian Ebner <f.ebner@proxmox.com>
Wed, 8 Apr 2020 09:25:04 +0000 (11:25 +0200)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Thu, 9 Apr 2020 07:41:01 +0000 (09:41 +0200)
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
PVE/CLI/pvesm.pm

index 510faba0882bd43d7f1ef1f85498e2768777a89f..0d1d8160a4225f94c882c3e8d10854b053dd1c02 100755 (executable)
@@ -47,6 +47,30 @@ sub setup_environment {
     PVE::RPCEnvironment->setup_default_cli_env();
 }
 
+__PACKAGE__->register_method ({
+    name => 'apiinfo',
+    path => 'apiinfo',
+    method => 'GET',
+    description => "Returns APIVER and APIAGE.",
+    parameters => {
+       additionalProperties => 0,
+       properties => {},
+    },
+    returns => {
+       type => 'object',
+       properties => {
+           apiver => { type => 'integer' },
+           apiage => { type => 'integer' },
+       },
+    },
+    code => sub {
+       return {
+           apiver => PVE::Storage::APIVER,
+           apiage => PVE::Storage::APIAGE,
+       };
+    }
+});
+
 __PACKAGE__->register_method ({
     name => 'path',
     path => 'path',
@@ -778,6 +802,12 @@ our $cmddef = {
     extractconfig => [__PACKAGE__, 'extractconfig', ['volume']],
     export => [ __PACKAGE__, 'export', ['volume', 'format', 'filename']],
     import => [ __PACKAGE__, 'import', ['volume', 'format', 'filename']],
+    apiinfo => [ __PACKAGE__, 'apiinfo', [], {}, sub {
+       my $res = shift;
+
+       print "APIVER $res->{apiver}\n";
+       print "APIAGE $res->{apiage}\n";
+    }],
 };
 
 1;