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)
-
- (Boolean) destroy
Destroy the device, removing the virtual device from the host operating system.
-
- (Boolean) dettach
Detaches the device from the node itself so that it may be bound to a guest domain.
-
- (NodeDevice) initialize(pointer)
constructor
Initializes a node device with the given
virNodeDevicePtr. -
- (String) name
Returns the name of this device.
-
- (Boolena) reattach
Reattach the device onto the node.
-
- (Boolena) reset
Reset the device.
-
- (FFI::Pointer) to_ptr
Returns the underlying
virNodeDevicePtr. -
- (String) xml
Returns the XML specification for this device.
Constructor Details
- (NodeDevice) initialize(pointer)
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
- (Boolean) destroy
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 |
- (Boolean) dettach
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 |
- (String) name
Returns the name of this device.
17 18 19 |
# File 'lib/libvirt/node_device.rb', line 17 def name FFI::Libvirt.virNodeDeviceGetName(self) end |
- (Boolena) reattach
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 |
- (Boolena) reset
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 |
- (FFI::Pointer) to_ptr
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 |
- (String) xml
Returns the XML specification for this device.
24 25 26 |
# File 'lib/libvirt/node_device.rb', line 24 def xml FFI::Libvirt.virNodeDeviceGetXMLDesc(self, 0) end |