From fef20e25d936421c01b79219f35c7ef1246fa604 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 1 Jan 1970 00:00:00 +0000 Subject: [PATCH] Version 0.3.3.3. * libvirt/libvirt.mli: Added filename = string type to clarify some function signatures which take a filename. Added lots of function documentation. * libvirt/libvirt.ml: Added VIR_FROM_OPENVZ. --- ChangeLog | 8 ++++ configure.ac | 2 +- libvirt/libvirt.ml | 12 ++++-- libvirt/libvirt.mli | 115 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 4 files changed, 128 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index ce393f7..b63912b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2007-11-14 Richard Jones + * libvirt/libvirt.mli: Added filename = string type to clarify + some function signatures which take a filename. Added lots + of function documentation. + * libvirt/libvirt.ml: Added VIR_FROM_OPENVZ. + * configure.ac: Version 0.3.3.3 for release. + +2007-11-14 Richard Jones + * Makefile.in: New rules for releasing and uploading. 2007-11-14 Richard Jones diff --git a/configure.ac b/configure.ac index bddcac8..635b49a 100644 --- a/configure.ac +++ b/configure.ac @@ -17,7 +17,7 @@ dnl Process this file with autoconf to produce a configure script. -AC_INIT(ocaml-libvirt,0.3.3.2) +AC_INIT(ocaml-libvirt,0.3.3.3) dnl Check for basic C environment. AC_PROG_CC diff --git a/libvirt/libvirt.ml b/libvirt/libvirt.ml index 7b75eb8..586aa7b 100644 --- a/libvirt/libvirt.ml +++ b/libvirt/libvirt.ml @@ -21,6 +21,8 @@ type uuid = string type xml = string +type filename = string + external get_version : ?driver:string -> unit -> int * int = "ocaml_libvirt_get_version" let uuid_length = 16 @@ -55,7 +57,7 @@ struct external get_max_vcpus : [>`R] t -> ?type_:string -> unit -> int = "ocaml_libvirt_connect_get_max_vcpus" external list_domains : [>`R] t -> int -> int array = "ocaml_libvirt_connect_list_domains" external num_of_domains : [>`R] t -> int = "ocaml_libvirt_connect_num_of_domains" - external get_capabilities : [>`R] t -> string = "ocaml_libvirt_connect_get_capabilities" + external get_capabilities : [>`R] t -> xml = "ocaml_libvirt_connect_get_capabilities" external num_of_defined_domains : [>`R] t -> int = "ocaml_libvirt_connect_num_of_defined_domains" external list_defined_domains : [>`R] t -> int -> string array = "ocaml_libvirt_connect_list_defined_domains" external num_of_networks : [>`R] t -> int = "ocaml_libvirt_connect_num_of_networks" @@ -150,9 +152,9 @@ struct external free : [>`R] t -> unit = "ocaml_libvirt_domain_free" external suspend : [>`W] t -> unit = "ocaml_libvirt_domain_suspend" external resume : [>`W] t -> unit = "ocaml_libvirt_domain_resume" - external save : [>`W] t -> string -> unit = "ocaml_libvirt_domain_save" - external restore : [>`W] Connect.t -> string -> unit = "ocaml_libvirt_domain_restore" - external core_dump : [>`W] t -> string -> unit = "ocaml_libvirt_domain_core_dump" + external save : [>`W] t -> filename -> unit = "ocaml_libvirt_domain_save" + external restore : [>`W] Connect.t -> filename -> unit = "ocaml_libvirt_domain_restore" + external core_dump : [>`W] t -> filename -> unit = "ocaml_libvirt_domain_core_dump" 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" @@ -330,6 +332,7 @@ struct | VIR_FROM_NET | VIR_FROM_TEST | VIR_FROM_REMOTE + | VIR_FROM_OPENVZ let string_of_domain = function | VIR_FROM_NONE -> "VIR_FROM_NONE" @@ -346,6 +349,7 @@ struct | VIR_FROM_NET -> "VIR_FROM_NET" | VIR_FROM_TEST -> "VIR_FROM_TEST" | VIR_FROM_REMOTE -> "VIR_FROM_REMOTE" + | VIR_FROM_OPENVZ -> "VIR_FROM_OPENVZ" type t = { code : code; diff --git a/libvirt/libvirt.mli b/libvirt/libvirt.mli index 73bfcb5..1d9da1e 100644 --- a/libvirt/libvirt.mli +++ b/libvirt/libvirt.mli @@ -25,6 +25,9 @@ type xml = string xml-light, etc. if you want to do anything useful with the XML. *) +type filename = string +(** A filename. *) + val get_version : ?driver:string -> unit -> int * int (** [get_version ()] returns the library version in the first part of the tuple, and [0] in the second part. @@ -86,24 +89,58 @@ sig *) val get_type : [>`R] t -> string + (** Returns the name of the driver (hypervisor). *) + val get_version : [>`R] t -> int + (** Returns the driver version + [major * 1_000_000 + minor * 1000 + release] + *) val get_hostname : [>`R] t -> string + (** Returns the hostname of the physical server. *) val get_uri : [>`R] t -> string + (** Returns the canonical connection URI. *) val get_max_vcpus : [>`R] t -> ?type_:string -> unit -> int + (** Returns the maximum number of virtual CPUs + supported by a guest VM of a particular type. *) val list_domains : [>`R] t -> int -> int array + (** [list_domains conn max] returns the running domain IDs, + up to a maximum of [max] entries. + Call {!num_of_domains} first to get a value for [max]. + *) val num_of_domains : [>`R] t -> int - val get_capabilities : [>`R] t -> string + (** Returns the number of running domains. *) + val get_capabilities : [>`R] t -> xml + (** Returns the hypervisor capabilities (as XML). *) val num_of_defined_domains : [>`R] t -> int + (** Returns the number of inactive (shutdown) domains. *) val list_defined_domains : [>`R] t -> int -> string array + (** [list_defined_domains conn max] + returns the names of the inactive domains, up to + a maximum of [max] entries. + Call {!num_of_defined_domains} first to get a value for [max]. + *) val num_of_networks : [>`R] t -> int + (** Returns the number of networks. *) val list_networks : [>`R] t -> int -> string array + (** [list_networks conn max] + returns the names of the networks, up to a maximum + of [max] entries. + Call {!num_of_networks} first to get a value for [max]. + *) val num_of_defined_networks : [>`R] t -> int + (** Returns the number of inactive networks. *) val list_defined_networks : [>`R] t -> int -> string array + (** [list_defined_networks conn max] + returns the names of the inactive networks, up to a maximum + of [max] entries. + Call {!num_of_defined_networks} first to get a value for [max]. + *) (* The name of this function is inconsistent, but the inconsistency * is really in libvirt itself. *) val get_node_info : [>`R] t -> node_info + (** Return information about the physical server. *) val node_get_free_memory : [> `R] t -> int64 (** @@ -204,11 +241,19 @@ sig } val create_linux : [>`W] Connect.t -> xml -> rw t + (** Create a new guest domain (not necessarily a Linux one) + from the given XML. + *) val lookup_by_id : 'a Connect.t -> int -> 'a t + (** Lookup a domain by ID. *) val lookup_by_uuid : 'a Connect.t -> uuid -> 'a t + (** Lookup a domain by UUID. This uses the packed byte array UUID. *) val lookup_by_uuid_string : 'a Connect.t -> string -> 'a t + (** Lookup a domain by (string) UUID. *) val lookup_by_name : 'a Connect.t -> string -> 'a t + (** Lookup a domain by name. *) val destroy : [>`W] t -> unit + (** Abruptly destroy a domain. *) val free : [>`R] t -> unit (** [free domain] frees the domain object in memory. @@ -218,15 +263,25 @@ sig *) val suspend : [>`W] t -> unit + (** Suspend a domain. *) val resume : [>`W] t -> unit - val save : [>`W] t -> string -> unit - val restore : [>`W] Connect.t -> string -> unit - val core_dump : [>`W] t -> string -> unit + (** Resume a domain. *) + val save : [>`W] t -> filename -> unit + (** Suspend a domain, then save it to the file. *) + val restore : [>`W] Connect.t -> filename -> unit + (** Restore a domain from a file. *) + val core_dump : [>`W] t -> filename -> unit + (** Force a domain to core dump to the named file. *) val shutdown : [>`W] t -> unit + (** Shutdown a domain. *) val reboot : [>`W] t -> unit + (** Reboot a domain. *) val get_name : [>`R] t -> string + (** Get the domain name. *) val get_uuid : [>`R] t -> uuid + (** Get the domain UUID (as a packed byte array). *) val get_uuid_string : [>`R] t -> string + (** Get the domain UUID (as a printable string). *) val get_id : [>`R] t -> int (** [getid dom] returns the ID of the domain. @@ -235,31 +290,67 @@ sig *) val get_os_type : [>`R] t -> string + (** Get the operating system type. *) val get_max_memory : [>`R] t -> int64 + (** Get the maximum memory allocation. *) val set_max_memory : [>`W] t -> int64 -> unit + (** Set the maximum memory allocation. *) val set_memory : [>`W] t -> int64 -> unit + (** Set the normal memory allocation. *) val get_info : [>`R] t -> info + (** Get information about a domain. *) val get_xml_desc : [>`R] t -> xml + (** Get the XML description of a domain. *) val get_scheduler_type : [>`R] t -> string * int + (** Get the scheduler type. *) val get_scheduler_parameters : [>`R] t -> int -> sched_param array + (** Get the array of scheduler parameters. *) val set_scheduler_parameters : [>`W] t -> sched_param array -> unit + (** Set the array of scheduler parameters. *) val define_xml : [>`W] Connect.t -> xml -> rw t + (** Define a new domain (but don't start it up) from the XML. *) val undefine : [>`W] t -> unit + (** Undefine a domain - removes its configuration. *) val create : [>`W] t -> unit + (** Launch a defined (inactive) domain. *) val get_autostart : [>`R] t -> bool + (** Get the autostart flag for a domain. *) val set_autostart : [>`W] t -> bool -> unit + (** Set the autostart flag for a domain. *) val set_vcpus : [>`W] t -> int -> unit + (** Change the number of vCPUs available to a domain. *) val pin_vcpu : [>`W] t -> int -> string -> unit + (** [pin_vcpu dom vcpu bitmap] pins a domain vCPU to a bitmap of physical + CPUs. See the libvirt documentation for details of the + layout of the bitmap. *) val get_vcpus : [>`R] t -> int -> int -> int * vcpu_info array * string + (** [get_vcpus dom maxinfo maplen] returns the pinning information + for a domain. See the libvirt documentation for details + of the array and bitmap returned from this function. + *) val get_max_vcpus : [>`R] t -> int + (** Returns the maximum number of vCPUs supported for this domain. *) val attach_device : [>`W] t -> xml -> unit + (** Attach a device (described by the device XML) to a domain. *) val detach_device : [>`W] t -> xml -> unit + (** Detach a device (described by the device XML) from a domain. *) val migrate : [>`W] t -> [>`W] Connect.t -> migrate_flag list -> ?dname:string -> ?uri:string -> ?bandwidth:int -> unit -> rw t + (** [migrate dom dconn flags ()] migrates a domain to a + destination host described by [dconn]. + + The optional flag [?dname] is used to rename the domain. + + The optional flag [?uri] is used to route the migration. + + The optional flag [?bandwidth] is used to limit the bandwidth + used for migration (in Mbps). *) val block_stats : [>`R] t -> string -> block_stats + (** Returns block device stats. *) val interface_stats : [>`R] t -> string -> interface_stats + (** Returns network interface stats. *) external const : [>`R] t -> ro t = "%identity" (** [const dom] turns a read/write domain handle into a read-only @@ -278,13 +369,21 @@ sig *) val lookup_by_name : 'a Connect.t -> string -> 'a t + (** Lookup a network by name. *) val lookup_by_uuid : 'a Connect.t -> uuid -> 'a t + (** Lookup a network by (packed) UUID. *) val lookup_by_uuid_string : 'a Connect.t -> string -> 'a t + (** Lookup a network by UUID string. *) val create_xml : [>`W] Connect.t -> xml -> rw t + (** Create a network. *) val define_xml : [>`W] Connect.t -> xml -> rw t + (** Define but don't activate a network. *) val undefine : [>`W] t -> unit + (** Undefine configuration of a network. *) val create : [>`W] t -> unit + (** Start up a defined (inactive) network. *) val destroy : [>`W] t -> unit + (** Destroy a network. *) val free : [>`R] t -> unit (** [free network] frees the network object in memory. @@ -294,12 +393,19 @@ sig *) val get_name : [>`R] t -> string + (** Get network name. *) val get_uuid : [>`R] t -> uuid + (** Get network packed UUID. *) val get_uuid_string : [>`R] t -> string + (** Get network UUID as a printable string. *) val get_xml_desc : [>`R] t -> xml + (** Get XML description of a network. *) val get_bridge_name : [>`R] t -> string + (** Get bridge device name of a network. *) val get_autostart : [>`R] t -> bool + (** Get the autostart flag for a network. *) val set_autostart : [>`W] t -> bool -> unit + (** Set the autostart flag for a network. *) external const : [>`R] t -> ro t = "%identity" (** [const network] turns a read/write network handle into a read-only @@ -384,6 +490,7 @@ sig | VIR_FROM_NET | VIR_FROM_TEST | VIR_FROM_REMOTE + | VIR_FROM_OPENVZ (** Subsystem / driver which produced the error. *) val string_of_domain : domain -> string -- 1.8.3.1