diff options
author | Eric Wong <e@80x24.org> | 2015-01-15 23:54:16 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2015-01-16 00:16:26 +0000 |
commit | 80a0fe8ac20a5e3c248a9c377fa09bc7e06487f0 (patch) | |
tree | 111659f02bf35e3135ad27b1f1b3099ea6f19924 /lib/mogilefs | |
parent | 65058f1b7c76e82f5958531001e67ef4c94bc159 (diff) | |
download | mogilefs-client-80a0fe8ac20a5e3c248a9c377fa09bc7e06487f0.tar.gz |
This adds the reject_bad_md5 and utilization fields. While we're at it, be more explicit with mapping and avoid creating an unnecessary hash.
Diffstat (limited to 'lib/mogilefs')
-rw-r--r-- | lib/mogilefs/admin.rb | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/mogilefs/admin.rb b/lib/mogilefs/admin.rb index a48aaa0..eeff6bd 100644 --- a/lib/mogilefs/admin.rb +++ b/lib/mogilefs/admin.rb @@ -64,17 +64,18 @@ class MogileFS::Admin < MogileFS::Client def get_devices(devid = nil) to_i = %w(mb_asof mb_free mb_used mb_total devid weight hostid) - want = %w(status observed_state).concat(to_i) + want = %w(status reject_bad_md5 observed_state utilization).concat(to_i) rv = @backend.get_devices(devid ? { :devid => devid } : {}) rv = clean('devices', 'dev', rv, true, to_i, want) - ostates = Hash[%w(readable writeable unreachable).map! { |f| [f,f] }] rv.each do |row| u = row["utilization"] and row["utilization"] = nil == u ? nil : u.to_f - # maps "" to nil (for dead devices) - row["observed_state"] = ostates[row["observed_state"]] + case row["observed_state"] + when "" + row["observed_state"] = nil + end # be sure we do not set this at all for pre-2.60 MogileFS-Server case row["reject_bad_md5"] |