Class: Fog::Compute::XenServer::VBD
- Defined in:
- lib/rackspace-fog/xenserver/models/compute/vbd.rb
Instance Attribute Summary
Attributes inherited from Model
Instance Method Summary collapse
- #eject ⇒ Object
- #insert(vdi) ⇒ Object
-
#metrics ⇒ Object
return nil if the VBD is not attached.
- #save ⇒ Object
-
#server ⇒ Object
TODO: May it return nil?.
- #unplug ⇒ Object
- #unplug_force ⇒ Object
-
#vdi ⇒ Object
May return nil.
Methods inherited from Model
#initialize, #inspect, #reload, #symbolize_keys, #to_json, #wait_for
Methods included from Attributes::ClassMethods
#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes
Methods included from Attributes::InstanceMethods
#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #requires, #requires_one
Constructor Details
This class inherits a constructor from Fog::Model
Instance Method Details
#eject ⇒ Object
65 66 67 |
# File 'lib/rackspace-fog/xenserver/models/compute/vbd.rb', line 65 def eject connection.eject_vbd reference end |
#insert(vdi) ⇒ Object
69 70 71 |
# File 'lib/rackspace-fog/xenserver/models/compute/vbd.rb', line 69 def insert(vdi) connection.insert_vbd reference, vdi.reference end |
#metrics ⇒ Object
return nil if the VBD is not attached
TODO: Confirm that the VBD_metrics handle is invalid when the VBD is NOT attached. I get a HANDLE_INVALID exception in that case.
80 81 82 83 84 |
# File 'lib/rackspace-fog/xenserver/models/compute/vbd.rb', line 80 def metrics return nil unless currently_attached rec = connection.get_record( __metrics, 'VBD_metrics' ) Fog::Compute::XenServer::VbdMetrics.new(rec) end |
#save ⇒ Object
51 52 53 54 55 |
# File 'lib/rackspace-fog/xenserver/models/compute/vbd.rb', line 51 def save requires :vdi, :server ref = connection.create_vbd attributes[:server], attributes[:vdi], attributes merge_attributes connection.vbds.get(ref).attributes end |
#server ⇒ Object
TODO: May it return nil?
47 48 49 |
# File 'lib/rackspace-fog/xenserver/models/compute/vbd.rb', line 47 def server connection.servers.get __vm end |
#unplug ⇒ Object
57 58 59 |
# File 'lib/rackspace-fog/xenserver/models/compute/vbd.rb', line 57 def unplug connection.unplug_vbd reference end |
#unplug_force ⇒ Object
61 62 63 |
# File 'lib/rackspace-fog/xenserver/models/compute/vbd.rb', line 61 def unplug_force connection.unplug_force_vbd reference end |
#vdi ⇒ Object
May return nil
40 41 42 |
# File 'lib/rackspace-fog/xenserver/models/compute/vbd.rb', line 40 def vdi connection.vdis.get __vdi end |