X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=slave.mli;h=f60f83536419b4761c5088544abf8a9321822915;hb=refs%2Ftags%2F0.0.1;hp=994890f8547c86296e8659a0ba683907d568bab4;hpb=bbfe03c47f1d7f03c3e6c0cab9e4f500f588c80a;p=guestfs-browser.git diff --git a/slave.mli b/slave.mli index 994890f..f60f835 100644 --- a/slave.mli +++ b/slave.mli @@ -51,6 +51,7 @@ val connect : string option -> unit callback -> unit doesn't make sense to use remote URIs. *) type domain = { + dom_id : int; dom_name : string; dom_state : Libvirt.Domain.state; } @@ -58,7 +59,7 @@ type domain = { Note that [dom_state] is the state of the domain and should control whether we are allowed to write to the domain's - filesystem (disallowed if [dom_state] is [InfoRunning]). *) + filesystem (disallowed if [dom_state] is not [InfoShutoff]). *) val get_domains : domain list callback -> unit (** [get_domains cb] sends the [Get_domains] message to the @@ -69,6 +70,67 @@ val get_domains : domain list callback -> unit [cb] is called in the main thread with the list of domains. See also the {!domain} type. *) +type rw_flag = RO | RW + (** This flag is passed to open callbacks to indicate whether + we could open the disks read-only ([RO]) or read-write ([RW]). *) + +val open_domain : string -> rw_flag callback -> unit + (** [open_domain name cb] sends the [Open_domain] message to the + slave thread. + + This causes the slave thread to retrieve the list of + block devices for the libvirt domain [name], create a + libguestfs handle, add those block devices, and launch + the handle. If this is successful, then [cb] is called + in the main thread. + + If the domain is live then the disks are opened read only, + else they are opened read write if write_flag is true. + The [rw_flag] is passed into the callback accordingly. + + The slave thread must be connected to libvirt (see {!connect}) + else this command will fail. *) + +val open_images : string list -> rw_flag callback -> unit + (** [open_images images cb] is like {!open_domain} except + that it opens local disk image(s) directly. *) + +type volume = { + vol_device : string; + vol_type : string; + vol_label : string; + vol_uuid : string; + vol_statvfs : Guestfs.statvfs; +} + (** The volume structure which is passed to the {!get_volumes} callback. *) + +val get_volumes : volume callback -> unit + (** [get_volumes cb] sends the [Get_volumes] message to the + slave thread. + + This causes the slave thread to examine all partitions, LVs + etc within the current disk image, and for each that contains + a mountable filesystem, [cb] is called. (Note [cb] can be + called multiple times). *) + +type direntry = { + dent_name : string; (** Basename in directory. *) + dent_stat : Guestfs.stat; (** stat(2) for this entry. *) + dent_link : string; (** (for symlinks only) readlink(2). *) +} + +val read_directory : string -> string -> direntry list callback -> unit + (** [read_directory dev dir cb] sends the [Read_directory] message + to the slave thread. + + This causes the slave thread to read the contents of the + directory [dir] from volume [dev], and call [cb] with the + complete result. If [dir] is not a directory then this + is an error. + + Note that [.] and [..] entries are not included in the result, + and the list is sorted on the [filename] field. *) + val discard_command_queue : unit -> unit (** [discard_command_queue ()] discards any commands on the command queue. The currently running command is not (and can not be)