mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-22 07:03:38 +00:00
v2v: Move the open_guestfs function into Common_utils.
Removes the somewhat ugly inclusion of this function in Types. Also means we can use this function elsewhere.
This commit is contained in:
@@ -356,6 +356,15 @@ let info fs =
|
||||
in
|
||||
ksprintf display fs
|
||||
|
||||
(* Common function to create a new Guestfs handle, with common options
|
||||
* (e.g. debug, tracing) already set.
|
||||
*)
|
||||
let open_guestfs () =
|
||||
let g = new Guestfs.guestfs () in
|
||||
if trace () then g#set_trace true;
|
||||
if verbose () then g#set_verbose true;
|
||||
g
|
||||
|
||||
(* All the OCaml virt-* programs use this wrapper to catch exceptions
|
||||
* and print them nicely.
|
||||
*)
|
||||
|
||||
@@ -149,6 +149,10 @@ val warning : ('a, unit, string, unit) format4 -> 'a
|
||||
val info : ('a, unit, string, unit) format4 -> 'a
|
||||
(** Standard info function. Note: Use full sentences for this. *)
|
||||
|
||||
val open_guestfs : unit -> Guestfs.guestfs
|
||||
(** Common function to create a new Guestfs handle, with common options
|
||||
(e.g. debug, tracing) already set. *)
|
||||
|
||||
val run_main_and_handle_errors : (unit -> unit) -> unit
|
||||
(** Common function for handling pretty-printing exceptions. *)
|
||||
|
||||
|
||||
@@ -382,13 +382,6 @@ let string_of_target_buses buses =
|
||||
string_of_target_bus_slots "ide" buses.target_ide_bus ^
|
||||
string_of_target_bus_slots "scsi" buses.target_scsi_bus
|
||||
|
||||
let open_guestfs () =
|
||||
(* Open the guestfs handle. *)
|
||||
let g = new Guestfs.guestfs () in
|
||||
if trace () then g#set_trace true;
|
||||
if verbose () then g#set_verbose true;
|
||||
g
|
||||
|
||||
class virtual input = object
|
||||
method virtual as_options : string
|
||||
method virtual source : unit -> source
|
||||
|
||||
@@ -253,8 +253,3 @@ type output_allocation = Sparse | Preallocated
|
||||
|
||||
type vmtype = Desktop | Server
|
||||
(** Type of [--vmtype] option. *)
|
||||
|
||||
val open_guestfs : unit -> Guestfs.guestfs
|
||||
(* Create a new Guestfs handle, with common options (e.g. debug, tracing)
|
||||
* already set.
|
||||
*)
|
||||
|
||||
Reference in New Issue
Block a user