Module: CephRuby::RadosBlockDeviceHelper
- Included in:
- RadosBlockDevice
- Defined in:
- lib/ceph-ruby/rados_block_device_helper.rb
Overview
Rados BlockDevice helper Methods
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.close_handle(handle) ⇒ Object
11 12 13 14 |
# File 'lib/ceph-ruby/rados_block_device_helper.rb', line 11 def self.close_handle(handle) Lib::Rbd.rbd_close(handle) true end |
.parse_dst_pool(dst_pool, pool) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/ceph-ruby/rados_block_device_helper.rb', line 16 def self.parse_dst_pool(dst_pool, pool) if dst_pool.is_a? String dst_pool = cluster.pool(dst_pool) elsif dst_pool.nil? dst_pool = pool end dst_pool.ensure_open dst_pool end |
.parse_stat(stat) ⇒ Object
4 5 6 7 8 9 |
# File 'lib/ceph-ruby/rados_block_device_helper.rb', line 4 def self.parse_stat(stat) Hash[[:size, :obj_size, :num_objs, :order].map { |k| [k, stat[k]] }] .tap do |hash| hash[:block_name_prefix] = stat[:block_name_prefix].to_ptr.read_string end end |
Instance Method Details
#ensure_open ⇒ Object
30 31 32 33 |
# File 'lib/ceph-ruby/rados_block_device_helper.rb', line 30 def ensure_open return if open? open end |
#log(message) ⇒ Object
35 36 37 |
# File 'lib/ceph-ruby/rados_block_device_helper.rb', line 35 def log() CephRuby.log("rbd image #{pool.name}/#{name} #{message}") end |
#open? ⇒ Boolean
26 27 28 |
# File 'lib/ceph-ruby/rados_block_device_helper.rb', line 26 def open? !handle.nil? end |