Class: Libvirt::NodeDevice
- Inherits:
-
Object
- Object
- Libvirt::NodeDevice
- Defined in:
- lib/libvirt/node_device.rb
Overview
Represents a device on a node.
Instance Method Summary collapse
-
#destroy ⇒ Boolean
Destroy the device, removing the virtual device from the host operating system.
-
#dettach ⇒ Boolean
Detaches the device from the node itself so that it may be bound to a guest domain.
-
#initialize(pointer) ⇒ NodeDevice
constructor
Initializes a node device with the given
virNodeDevicePtr
. -
#name ⇒ String
Returns the name of this device.
-
#reattach ⇒ Boolena
Reattach the device onto the node.
-
#reset ⇒ Boolena
Reset the device.
-
#to_ptr ⇒ FFI::Pointer
Returns the underlying
virNodeDevicePtr
. -
#xml ⇒ String
Returns the XML specification for this device.
Constructor Details
#initialize(pointer) ⇒ NodeDevice
Initializes a node device with the given virNodeDevicePtr
. This
should not be called directly. Instead, call Libvirt::Node#devices to get
a list of the devices.
9 10 11 12 |
# File 'lib/libvirt/node_device.rb', line 9 def initialize(pointer) @pointer = pointer ObjectSpace.define_finalizer(self, method(:finalize)) end |
Instance Method Details
#destroy ⇒ Boolean
Destroy the device, removing the virtual device from the host operating system.
55 56 57 |
# File 'lib/libvirt/node_device.rb', line 55 def destroy FFI::Libvirt.virNodeDeviceDestroy(self) == 0 end |
#dettach ⇒ Boolean
Detaches the device from the node itself so that it may be bound to a guest domain.
32 33 34 |
# File 'lib/libvirt/node_device.rb', line 32 def dettach FFI::Libvirt.virNodeDeviceDettach(self) == 0 end |
#name ⇒ String
Returns the name of this device.
17 18 19 |
# File 'lib/libvirt/node_device.rb', line 17 def name FFI::Libvirt.virNodeDeviceGetName(self) end |
#reattach ⇒ Boolena
Reattach the device onto the node.
39 40 41 |
# File 'lib/libvirt/node_device.rb', line 39 def reattach FFI::Libvirt.virNodeDeviceReAttach(self) == 0 end |
#reset ⇒ Boolena
Reset the device. The exact semantics of this method are hypervisor specific.
47 48 49 |
# File 'lib/libvirt/node_device.rb', line 47 def reset FFI::Libvirt.virNodeDeviceReset(self) == 0 end |
#to_ptr ⇒ FFI::Pointer
Returns the underlying virNodeDevicePtr
. This allows this object to
be used directly with FFI methods.
63 64 65 |
# File 'lib/libvirt/node_device.rb', line 63 def to_ptr @pointer end |