Class: Ceph::Crush::Location::Bucket
- Inherits:
-
Object
- Object
- Ceph::Crush::Location::Bucket
- Defined in:
- lib/ceph/crush/location/bucket.rb
Overview
Derives a Bucket line for Crush
Instance Method Summary collapse
- #from_config ⇒ Object
-
#initialize ⇒ Bucket
constructor
A new instance of Bucket.
- #to_s ⇒ Object
Constructor Details
#initialize ⇒ Bucket
Returns a new instance of Bucket.
6 7 8 9 |
# File 'lib/ceph/crush/location/bucket.rb', line 6 def initialize Ceph::Crush::Location::Logger.send('Bucket.initialize') @osd = OSD.new end |
Instance Method Details
#from_config ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/ceph/crush/location/bucket.rb', line 11 def from_config require 'shellwords' ceph_conf_bin = '/usr/bin/ceph-conf' cluster = ::Shellwords.escape @osd.cluster type = 'osd' id = ::Shellwords.escape @osd.id location_command = "#{ceph_conf_bin} --cluster=#{cluster} "\ "--name=#{type}.#{id} --lookup crush_location" `#{location_command}` rescue '' end |
#to_s ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/ceph/crush/location/bucket.rb', line 24 def to_s Ceph::Crush::Location::Logger.send('Bucket.to_s') ceph_location_config = from_config return ceph_location_config unless ceph_location_config == '' [root_bucket, datacenter_bucket, row_bucket, rack_bucket, chassis_bucket, host_bucket, disk_chassis_bucket, enclosure_bucket].join('') end |