Module Libvirt.Volume

module Volume: sig .. end

Module dealing with storage volumes.


type 'rw t 

Storage volume handle.

type vol_type = 
| File
| Block
| Dir
| Network
| NetDir
| Ploop (*

Type of a storage volume.

*)
type vol_delete_flags = 
| Normal
| Zeroed (*

Flags for deleting a storage volume.

*)
type vol_info = {
   typ : vol_type; (*

Type of storage volume.

*)
   capacity : int64; (*

Logical size in bytes.

*)
   allocation : int64; (*

Currently allocated in bytes.

*)
}
val lookup_by_name : 'a Libvirt.Pool.t -> string -> 'a t
val lookup_by_key : 'a Libvirt.Connect.t -> string -> 'a t
val lookup_by_path : 'a Libvirt.Connect.t -> string -> 'a t

Look up a storage volume by name, key or path volume.

val pool_of_volume : 'a t -> 'a Libvirt.Pool.t

Get the storage pool containing this volume.

val get_name : [ `R ] t -> string

Name of the volume.

val get_key : [ `R ] t -> string

Key of the volume.

val get_path : [ `R ] t -> string

Path of the volume.

val get_info : [ `R ] t -> vol_info

Get information about the storage volume.

val get_xml_desc : [ `R ] t -> Libvirt.xml

Get the XML description.

val create_xml : [> `W ] Libvirt.Pool.t -> Libvirt.xml -> unit

Create a storage volume.

val delete : [> `W ] t -> vol_delete_flags -> unit

Delete a storage volume.

val free : [> `R ] t -> unit

Free a storage volume object in memory.

The storage volume object is automatically freed if it is garbage collected. This function just forces it to be freed right away.

val const : [> `R ] t -> Libvirt.ro t

const conn turns a read/write storage volume into a read-only volume. Note that the opposite operation is impossible.