Class: DRBD::Status

Inherits:
Object
  • Object
show all
Defined in:
lib/drbd.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw) ⇒ Status

Returns a new instance of Status.



289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
# File 'lib/drbd.rb', line 289

def initialize raw
  xml = Nokogiri::XML(raw)
  resources = xml.xpath("//drbd-status/resources/resource")
  @resources = resources.map do |resource|
    r = {}
    r[:name] = resource["name"]
    r[:minor] = resource["minor"]
    r[:cs] = resource["cs"]
    r[:ro1] = resource["ro1"]
    r[:ro2] = resource["ro2"]
    r[:ds1] = resource["ds1"]
    r[:ds2] = resource["ds2"]
    r[:resynced_percent] = resource["resynced_percent"]
    r
  end
end

Instance Attribute Details

#resourcesObject (readonly)

Returns the value of attribute resources.



288
289
290
# File 'lib/drbd.rb', line 288

def resources
  @resources
end