[pve-devel] [PATCH manager 2/5] ceph: add 'scope' parameter to metadata api call

Dominik Csapak d.csapak at proxmox.com
Mon Mar 16 13:56:00 CET 2020


so that we can choose to only include the versions and not all metadata
this is done to avoid having a seperate 'versions' api call

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 PVE/API2/Cluster/Ceph.pm | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/PVE/API2/Cluster/Ceph.pm b/PVE/API2/Cluster/Ceph.pm
index 71d5cde6..e18d421e 100644
--- a/PVE/API2/Cluster/Ceph.pm
+++ b/PVE/API2/Cluster/Ceph.pm
@@ -59,7 +59,14 @@ __PACKAGE__->register_method ({
     },
     parameters => {
 	additionalProperties => 0,
-	properties => {},
+	properties => {
+	    scope => {
+		type => 'string',
+		optional => 1,
+		default => 'all',
+		enum => ['all', 'versions', ],
+	    },
+	},
     },
     returns => { type => 'object' },
     code => sub {
@@ -68,6 +75,7 @@ __PACKAGE__->register_method ({
 	PVE::Ceph::Tools::check_ceph_inited();
 
 	my $rados = PVE::RADOS->new();
+	my $scope = $param->{scope} // 'all';
 
 	my $res = {
 	    # FIXME: remove with 7.0 depreacated by structured 'versions'
@@ -78,6 +86,8 @@ __PACKAGE__->register_method ({
 	    $res->{node} = $vers;
 	}
 
+	return $res if ($scope eq 'versions');
+
 	for my $type ( qw(mon mgr mds) ) {
 	    my $typedata = PVE::Ceph::Services::get_cluster_service($type);
 	    my $data = {};
-- 
2.20.1





More information about the pve-devel mailing list