Class: Fog::Compute::XenServer::VBD
- Inherits:
-
Model
- Object
- Model
- Fog::Compute::XenServer::VBD
- Defined in:
- lib/fog/xenserver/models/compute/vbd.rb
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.
Instance Method Details
#eject ⇒ Object
65 66 67 |
# File 'lib/fog/xenserver/models/compute/vbd.rb', line 65 def eject service.eject_vbd reference end |
#insert(vdi) ⇒ Object
69 70 71 |
# File 'lib/fog/xenserver/models/compute/vbd.rb', line 69 def insert(vdi) service.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/fog/xenserver/models/compute/vbd.rb', line 80 def metrics return nil unless currently_attached rec = service.get_record( __metrics, 'VBD_metrics' ) Fog::Compute::XenServer::VbdMetrics.new(rec) end |
#save ⇒ Object
51 52 53 54 55 |
# File 'lib/fog/xenserver/models/compute/vbd.rb', line 51 def save requires :vdi, :server ref = service.create_vbd attributes[:server], attributes[:vdi], attributes merge_attributes service.vbds.get(ref).attributes end |
#server ⇒ Object
TODO: May it return nil?
47 48 49 |
# File 'lib/fog/xenserver/models/compute/vbd.rb', line 47 def server service.servers.get __vm end |
#unplug ⇒ Object
57 58 59 |
# File 'lib/fog/xenserver/models/compute/vbd.rb', line 57 def unplug service.unplug_vbd reference end |
#unplug_force ⇒ Object
61 62 63 |
# File 'lib/fog/xenserver/models/compute/vbd.rb', line 61 def unplug_force service.unplug_force_vbd reference end |
#vdi ⇒ Object
May return nil
40 41 42 |
# File 'lib/fog/xenserver/models/compute/vbd.rb', line 40 def vdi service.vdis.get __vdi end |