type rw = [`R|`W]
type ro = [`R]
-type ('a, 'b) job_t
-
module Connect =
struct
type 'rw t
external list_all_domains : 'a Connect.t -> ?want_info:bool -> list_flag list -> 'a t array * info array = "ocaml_libvirt_connect_list_all_domains"
external create_linux : [>`W] Connect.t -> xml -> rw t = "ocaml_libvirt_domain_create_linux"
- external create_linux_job : [>`W] Connect.t -> xml -> ([`Domain], rw) job_t = "ocaml_libvirt_domain_create_linux_job"
external lookup_by_id : 'a Connect.t -> int -> 'a t = "ocaml_libvirt_domain_lookup_by_id"
external lookup_by_uuid : 'a Connect.t -> uuid -> 'a t = "ocaml_libvirt_domain_lookup_by_uuid"
external lookup_by_uuid_string : 'a Connect.t -> string -> 'a t = "ocaml_libvirt_domain_lookup_by_uuid_string"
external suspend : [>`W] t -> unit = "ocaml_libvirt_domain_suspend"
external resume : [>`W] t -> unit = "ocaml_libvirt_domain_resume"
external save : [>`W] t -> filename -> unit = "ocaml_libvirt_domain_save"
- external save_job : [>`W] t -> filename -> ([`Domain_nocreate], rw) job_t = "ocaml_libvirt_domain_save_job"
external restore : [>`W] Connect.t -> filename -> unit = "ocaml_libvirt_domain_restore"
- external restore_job : [>`W] Connect.t -> filename -> ([`Domain_nocreate], rw) job_t = "ocaml_libvirt_domain_restore_job"
external core_dump : [>`W] t -> filename -> unit = "ocaml_libvirt_domain_core_dump"
- external core_dump_job : [>`W] t -> filename -> ([`Domain_nocreate], rw) job_t = "ocaml_libvirt_domain_core_dump_job"
external shutdown : [>`W] t -> unit = "ocaml_libvirt_domain_shutdown"
external reboot : [>`W] t -> unit = "ocaml_libvirt_domain_reboot"
external get_name : [>`R] t -> string = "ocaml_libvirt_domain_get_name"
external define_xml : [>`W] Connect.t -> xml -> rw t = "ocaml_libvirt_domain_define_xml"
external undefine : [>`W] t -> unit = "ocaml_libvirt_domain_undefine"
external create : [>`W] t -> unit = "ocaml_libvirt_domain_create"
- external create_job : [>`W] t -> ([`Domain_nocreate], rw) job_t = "ocaml_libvirt_domain_create_job"
external get_autostart : [>`R] t -> bool = "ocaml_libvirt_domain_get_autostart"
external set_autostart : [>`W] t -> bool -> unit = "ocaml_libvirt_domain_set_autostart"
external set_vcpus : [>`W] t -> int -> unit = "ocaml_libvirt_domain_set_vcpus"
external migrate : [>`W] t -> [>`W] Connect.t -> migrate_flag list -> ?dname:string -> ?uri:string -> ?bandwidth:int -> unit -> rw t = "ocaml_libvirt_domain_migrate_bytecode" "ocaml_libvirt_domain_migrate_native"
external block_stats : [>`R] t -> string -> block_stats = "ocaml_libvirt_domain_block_stats"
external interface_stats : [>`R] t -> string -> interface_stats = "ocaml_libvirt_domain_interface_stats"
- external block_peek : [>`R] t -> string -> int64 -> int -> string -> int -> unit = "ocaml_libvirt_domain_block_peek_bytecode" "ocaml_libvirt_domain_block_peek_native"
- external memory_peek : [>`R] t -> memory_flag list -> int64 -> int -> string -> int -> unit = "ocaml_libvirt_domain_memory_peek_bytecode" "ocaml_libvirt_domain_memory_peek_native"
+ external block_peek : [>`W] t -> string -> int64 -> int -> string -> int -> unit = "ocaml_libvirt_domain_block_peek_bytecode" "ocaml_libvirt_domain_block_peek_native"
+ external memory_peek : [>`W] t -> memory_flag list -> int64 -> int -> string -> int -> unit = "ocaml_libvirt_domain_memory_peek_bytecode" "ocaml_libvirt_domain_memory_peek_native"
external const : [>`R] t -> ro t = "%identity"
external lookup_by_uuid : 'a Connect.t -> uuid -> 'a t = "ocaml_libvirt_network_lookup_by_uuid"
external lookup_by_uuid_string : 'a Connect.t -> string -> 'a t = "ocaml_libvirt_network_lookup_by_uuid_string"
external create_xml : [>`W] Connect.t -> xml -> rw t = "ocaml_libvirt_network_create_xml"
- external create_xml_job : [>`W] Connect.t -> xml -> ([`Network], rw) job_t = "ocaml_libvirt_network_create_xml_job"
external define_xml : [>`W] Connect.t -> xml -> rw t = "ocaml_libvirt_network_define_xml"
external undefine : [>`W] t -> unit = "ocaml_libvirt_network_undefine"
external create : [>`W] t -> unit = "ocaml_libvirt_network_create"
- external create_job : [>`W] t -> ([`Network_nocreate], rw) job_t = "ocaml_libvirt_network_create_job"
external destroy : [>`W] t -> unit = "ocaml_libvirt_network_destroy"
external free : [>`R] t -> unit = "ocaml_libvirt_network_free"
external get_name : [>`R] t -> string = "ocaml_libvirt_network_get_name"
external const : [>`R] t -> ro t = "%identity"
end
-module Job =
-struct
- type ('jobclass, 'rw) t = ('jobclass, 'rw) job_t
- type job_type = Bounded | Unbounded
- type job_state = Running | Complete | Failed | Cancelled
- type job_info = {
- typ : job_type;
- state : job_state;
- running_time : int;
- remaining_time : int;
- percent_complete : int
- }
- external get_info : ('a,'b) t -> job_info = "ocaml_libvirt_job_get_info"
- external get_domain : ([`Domain], 'a) t -> 'a Domain.t = "ocaml_libvirt_job_get_domain"
- external get_network : ([`Network], 'a) t -> 'a Network.t = "ocaml_libvirt_job_get_network"
- external cancel : ('a,'b) t -> unit = "ocaml_libvirt_job_cancel"
- external free : ('a, [>`R]) t -> unit = "ocaml_libvirt_job_free"
- external const : ('a, [>`R]) t -> ('a, ro) t = "%identity"
-end
-
(* Initialization. *)
external c_init : unit -> unit = "ocaml_libvirt_init"
let () =