Module Libvirt.Domain


module Domain: sig .. end
Module dealing with domains. Domain.t is the domain object.

type 'a t 
Domain handle. Read-only handles have type ro Domain.t and read-write handles have type rw Domain.t.

type state =
| InfoNoState
| InfoRunning
| InfoBlocked
| InfoPaused
| InfoShutdown
| InfoShutoff
| InfoCrashed

type info = {
   state : state; (*running state*)
   max_mem : int64; (*maximum memory in kilobytes*)
   memory : int64; (*memory used in kilobytes*)
   nr_virt_cpu : int; (*number of virtual CPUs*)
   cpu_time : int64; (*CPU time used in nanoseconds*)
}
type vcpu_state =
| VcpuOffline
| VcpuRunning
| VcpuBlocked

type vcpu_info = {
   number : int; (*virtual CPU number*)
   vcpu_state : vcpu_state; (*state*)
   vcpu_time : int64; (*CPU time used in nanoseconds*)
   cpu : int; (*real CPU number, -1 if offline*)
}
type sched_param = string * sched_param_value 

type sched_param_value =
| SchedFieldInt32 of int32
| SchedFieldUInt32 of int32
| SchedFieldInt64 of int64
| SchedFieldUInt64 of int64
| SchedFieldFloat of float
| SchedFieldBool of bool

type migrate_flag =
| Live

type block_stats = {
   rd_req : int64;
   rd_bytes : int64;
   wr_req : int64;
   wr_bytes : int64;
   errs : int64;
}
type interface_stats = {
   rx_bytes : int64;
   rx_packets : int64;
   rx_errs : int64;
   rx_drop : int64;
   tx_bytes : int64;
   tx_packets : int64;
   tx_errs : int64;
   tx_drop : int64;
}
val create_linux : [> `W ] Libvirt.Connect.t -> Libvirt.xml -> Libvirt.rw t
val lookup_by_id : 'a Libvirt.Connect.t -> int -> 'a t
val lookup_by_uuid : 'a Libvirt.Connect.t -> Libvirt.uuid -> 'a t
val lookup_by_uuid_string : 'a Libvirt.Connect.t -> string -> 'a t
val lookup_by_name : 'a Libvirt.Connect.t -> string -> 'a t
val destroy : [> `W ] t -> unit
val free : [> `R ] t -> unit
free domain frees the domain object in memory.

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

val suspend : [> `W ] t -> unit
val resume : [> `W ] t -> unit
val save : [> `W ] t -> string -> unit
val restore : [> `W ] Libvirt.Connect.t -> string -> unit
val core_dump : [> `W ] t -> string -> unit
val shutdown : [> `W ] t -> unit
val reboot : [> `W ] t -> unit
val get_name : [> `R ] t -> string
val get_uuid : [> `R ] t -> Libvirt.uuid
val get_uuid_string : [> `R ] t -> string
val get_id : [> `R ] t -> int
getid dom returns the ID of the domain.

Do not call this on a defined but not running domain. Those domains don't have IDs, and you'll get an error here.

val get_os_type : [> `R ] t -> string
val get_max_memory : [> `R ] t -> int64
val set_max_memory : [> `W ] t -> int64 -> unit
val set_memory : [> `W ] t -> int64 -> unit
val get_info : [> `R ] t -> info
val get_xml_desc : [> `R ] t -> Libvirt.xml
val get_scheduler_type : [> `R ] t -> string * int
val get_scheduler_parameters : [> `R ] t -> int -> sched_param array
val set_scheduler_parameters : [> `W ] t -> sched_param array -> unit
val define_xml : [> `W ] Libvirt.Connect.t -> Libvirt.xml -> Libvirt.rw t
val undefine : [> `W ] t -> unit
val create : [> `W ] t -> unit
val get_autostart : [> `R ] t -> bool
val set_autostart : [> `W ] t -> bool -> unit
val set_vcpus : [> `W ] t -> int -> unit
val pin_vcpu : [> `W ] t -> int -> string -> unit
val get_vcpus : [> `R ] t ->
int -> int -> int * vcpu_info array * string
val get_max_vcpus : [> `R ] t -> int
val attach_device : [> `W ] t -> Libvirt.xml -> unit
val detach_device : [> `W ] t -> Libvirt.xml -> unit
val migrate : [> `W ] t ->
[> `W ] Libvirt.Connect.t ->
migrate_flag list ->
?dname:string ->
?uri:string -> ?bandwidth:int -> unit -> Libvirt.rw t
val block_stats : [> `R ] t -> string -> block_stats
val interface_stats : [> `R ] t -> string -> interface_stats
val const : [> `R ] t -> Libvirt.ro t
const dom turns a read/write domain handle into a read-only domain handle. Note that the opposite operation is impossible.