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
-
#==(other) ⇒ Boolean
Provide a meaningful equality check so that two storage volumes can eaisly be checked for equality.
-
#allocation ⇒ Integer
Returns the currently allocated number of bytes.
-
#capacity ⇒ Integer
Returns the capacity of this volume in bytes.
-
#delete ⇒ Boolean
Delete the storage volume rom the pool.
-
#initialize(pointer) ⇒ StorageVolume
constructor
Initializes a new StorageVolume object given a
virStorageVolPtr
. -
#key ⇒ String
(also: #uuid)
Returns a key for this storage volume.
-
#name ⇒ String
Returns the name of this storage volume.
-
#path ⇒ String
Returns the path of this storage volume.
-
#to_ptr ⇒ FFI::Pointer
Returns the actual
virStorageVolPtr
underlying this structure. -
#type ⇒ Symbol
Returns the type of this storage volume.
-
#wipe ⇒ Boolean
Wipe the contents of a volume so it is not readable in the future.
-
#xml ⇒ String
Returns the XML description of this storage volume.
Constructor Details
#initialize(pointer) ⇒ StorageVolume
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
#==(other) ⇒ Boolean
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 |
#allocation ⇒ Integer
Returns the currently allocated number of bytes.
51 52 53 |
# File 'lib/libvirt/storage_volume.rb', line 51 def allocation info[:allocation] end |
#capacity ⇒ Integer
Returns the capacity of this volume in bytes.
44 45 46 |
# File 'lib/libvirt/storage_volume.rb', line 44 def capacity info[:capacity] end |
#delete ⇒ Boolean
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 |
#key ⇒ String 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 |
#name ⇒ String
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 |
#path ⇒ String
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 |
#to_ptr ⇒ FFI::Pointer
Returns the actual virStorageVolPtr
underlying this structure.
79 80 81 |
# File 'lib/libvirt/storage_volume.rb', line 79 def to_ptr @pointer end |
#type ⇒ Symbol
Returns the type of this storage volume.
37 38 39 |
# File 'lib/libvirt/storage_volume.rb', line 37 def type info[:type] end |