Class: Libvirt::StorageVolume
- Inherits:
-
Object
- Object
- Libvirt::StorageVolume
- Defined in:
- lib/libvirt/storage_volume.rb
Overview
Represents a single storage volume.
Instance Method Summary (collapse)
-
- (Boolean) ==(other)
Provide a meaningful equality check so that two storage volumes can eaisly be checked for equality.
-
- (Integer) allocation
Returns the currently allocated number of bytes.
-
- (Integer) capacity
Returns the capacity of this volume in bytes.
-
- (Boolean) delete
Delete the storage volume rom the pool.
-
- (StorageVolume) initialize(pointer)
constructor
Initializes a new StorageVolume object given a
virStorageVolPtr. -
- (String) key
(also: #uuid)
Returns a key for this storage volume.
-
- (String) name
Returns the name of this storage volume.
-
- (String) path
Returns the path of this storage volume.
-
- (FFI::Pointer) to_ptr
Returns the actual
virStorageVolPtrunderlying this structure. -
- (Symbol) type
Returns the type of this storage volume.
-
- (Boolean) wipe
Wipe the contents of a volume so it is not readable in the future.
-
- (String) xml
Returns the XML description of this storage volume.
Constructor Details
- (StorageVolume) initialize(pointer)
Initializes a new Libvirt::StorageVolume object given a virStorageVolPtr.
Do not call this directly. Instead, use the Libvirt::StoragePool#volumes collection
object to retrieve a specific Libvirt::StorageVolume.
7 8 9 10 |
# File 'lib/libvirt/storage_volume.rb', line 7 def initialize(pointer) @pointer = pointer ObjectSpace.define_finalizer(self, method(:finalize)) end |
Instance Method Details
- (Boolean) ==(other)
Provide a meaningful equality check so that two storage volumes can eaisly be checked for equality.
87 88 89 |
# File 'lib/libvirt/storage_volume.rb', line 87 def ==(other) other.is_a?(StorageVolume) && other.uuid == uuid end |
- (Integer) allocation
Returns the currently allocated number of bytes.
51 52 53 |
# File 'lib/libvirt/storage_volume.rb', line 51 def allocation info[:allocation] end |
- (Integer) capacity
Returns the capacity of this volume in bytes.
44 45 46 |
# File 'lib/libvirt/storage_volume.rb', line 44 def capacity info[:capacity] end |
- (Boolean) delete
Delete the storage volume rom the pool.
65 66 67 |
# File 'lib/libvirt/storage_volume.rb', line 65 def delete FFI::Libvirt.virStorageVolDelete(self, 0) == 0 end |
- (String) key Also known as: uuid
Returns a key for this storage volume. The key is a unique identifier.
15 16 17 |
# File 'lib/libvirt/storage_volume.rb', line 15 def key FFI::Libvirt.virStorageVolGetKey(self) end |
- (String) name
Returns the name of this storage volume.
23 24 25 |
# File 'lib/libvirt/storage_volume.rb', line 23 def name FFI::Libvirt.virStorageVolGetName(self) end |
- (String) path
Returns the path of this storage volume.
30 31 32 |
# File 'lib/libvirt/storage_volume.rb', line 30 def path FFI::Libvirt.virStorageVolGetPath(self) end |
- (FFI::Pointer) to_ptr
Returns the actual virStorageVolPtr underlying this structure.
79 80 81 |
# File 'lib/libvirt/storage_volume.rb', line 79 def to_ptr @pointer end |
- (Symbol) type
Returns the type of this storage volume.
37 38 39 |
# File 'lib/libvirt/storage_volume.rb', line 37 def type info[:type] end |
- (Boolean) wipe
Wipe the contents of a volume so it is not readable in the future.
58 59 60 |
# File 'lib/libvirt/storage_volume.rb', line 58 def wipe FFI::Libvirt.virStorageVolWipe(self, 0) == 0 end |
- (String) xml
Returns the XML description of this storage volume.
72 73 74 |
# File 'lib/libvirt/storage_volume.rb', line 72 def xml FFI::Libvirt.virStorageVolGetXMLDesc(self, 0) end |