mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-22 07:03:38 +00:00
mllib, v2v: Allow open_guestfs to set the handle identifier.
Extend open_guestfs to take an optional ?identifier parameter. Use this parameter in virt-v2v which is currently the only place where we use the handle identifier.
This commit is contained in:
@@ -363,10 +363,11 @@ let info fs =
|
||||
(* Common function to create a new Guestfs handle, with common options
|
||||
* (e.g. debug, tracing) already set.
|
||||
*)
|
||||
let open_guestfs () =
|
||||
let open_guestfs ?identifier () =
|
||||
let g = new Guestfs.guestfs () in
|
||||
if trace () then g#set_trace true;
|
||||
if verbose () then g#set_verbose true;
|
||||
may g#set_identifier identifier;
|
||||
g
|
||||
|
||||
(* All the OCaml virt-* programs use this wrapper to catch exceptions
|
||||
|
||||
@@ -152,7 +152,7 @@ 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
|
||||
val open_guestfs : ?identifier:string -> unit -> Guestfs.guestfs
|
||||
(** Common function to create a new Guestfs handle, with common options
|
||||
(e.g. debug, tracing) already set. *)
|
||||
|
||||
|
||||
@@ -262,8 +262,7 @@ object
|
||||
?clustersize path format size =
|
||||
Changeuid.func changeuid_t (
|
||||
fun () ->
|
||||
let g = open_guestfs () in
|
||||
g#set_identifier "rhev_disk_create";
|
||||
let g = open_guestfs ~identifier:"rhev_disk_create" () in
|
||||
(* For qcow2, override v2v-supplied compat option, because RHEL 6
|
||||
* nodes cannot handle qcow2 v3 (RHBZ#1145582).
|
||||
*)
|
||||
|
||||
@@ -156,8 +156,7 @@ object
|
||||
|
||||
method disk_create ?backingfile ?backingformat ?preallocation ?compat
|
||||
?clustersize path format size =
|
||||
let g = open_guestfs () in
|
||||
g#set_identifier "vdsm_disk_create";
|
||||
let g = open_guestfs ~identifier:"vdsm_disk_create" () in
|
||||
(* For qcow2, override v2v-supplied compat option, because RHEL 6
|
||||
* nodes cannot handle qcow2 v3 (RHBZ#1145582).
|
||||
*)
|
||||
|
||||
@@ -74,8 +74,7 @@ let rec main () =
|
||||
| In_place -> message (f_"Opening the source VM")
|
||||
);
|
||||
|
||||
let g = open_guestfs () in
|
||||
g#set_identifier "v2v";
|
||||
let g = open_guestfs ~identifier:"v2v" () in
|
||||
g#set_network true;
|
||||
(match conversion_mode with
|
||||
| Copying (overlays, _) -> populate_overlays g overlays
|
||||
|
||||
@@ -72,8 +72,7 @@ let rec copy_virtio_drivers g inspect virtio_win driverdir =
|
||||
)
|
||||
else if is_regular_file virtio_win then (
|
||||
try
|
||||
let g2 = open_guestfs () in
|
||||
g2#set_identifier "virtio_win";
|
||||
let g2 = open_guestfs ~identifier:"virtio_win" () in
|
||||
g2#add_drive_opts virtio_win ~readonly:true;
|
||||
g2#launch ();
|
||||
let vio_root = "/" in
|
||||
|
||||
Reference in New Issue
Block a user