[pve-devel] [PATCH manager v2 1/5] also return the ceph flags in osd api call

Dominik Csapak d.csapak at proxmox.com
Wed Nov 30 11:52:06 CET 2016


we want to set/get the flags in the ceph/osd tab, so we have to
return it there

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 PVE/API2/Ceph.pm | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/PVE/API2/Ceph.pm b/PVE/API2/Ceph.pm
index 7b1bbd0..3dd1439 100644
--- a/PVE/API2/Ceph.pm
+++ b/PVE/API2/Ceph.pm
@@ -30,6 +30,8 @@ my $get_osd_status = sub {
 
     my $osdlist = $stat->{osds} || [];
 
+    my $flags = $stat->{flags} || undef;
+
     my $osdstat;
     foreach my $d (@$osdlist) {
 	$osdstat->{$d->{osd}} = $d if defined($d->{osd});    
@@ -39,7 +41,7 @@ my $get_osd_status = sub {
 	return $osdstat->{$osdid};
     }
 
-    return $osdstat;
+    return wantarray? ($osdstat, $flags):$osdstat;
 };
 
 my $get_osd_usage = sub {
@@ -86,7 +88,7 @@ __PACKAGE__->register_method ({
 
         die "no tree nodes found\n" if !($res && $res->{nodes});
 
-	my $osdhash = &$get_osd_status($rados);
+	my ($osdhash, $flags) = &$get_osd_status($rados);
 
 	my $usagehash = &$get_osd_usage($rados);
 
@@ -151,6 +153,9 @@ __PACKAGE__->register_method ({
 
 	my $data = { root => { leaf =>  0, children => $roots } };
 
+	# we want this for the noout flag
+	$data->{flags} = $flags if $flags;
+
 	return $data;
     }});
 
-- 
2.1.4





More information about the pve-devel mailing list