mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
v2v: types: Rearrange types and headings.
Also moves the mpstat structure & print_mpstat function into the v2v.ml file, since that is the only place which uses it. No functional change.
This commit is contained in:
13
v2v/types.ml
13
v2v/types.ml
@@ -379,19 +379,6 @@ i_windows_current_control_set = %s
|
||||
inspect.i_windows_system_hive
|
||||
inspect.i_windows_current_control_set
|
||||
|
||||
type mpstat = {
|
||||
mp_dev : string;
|
||||
mp_path : string;
|
||||
mp_statvfs : Guestfs.statvfs;
|
||||
mp_vfs : string;
|
||||
}
|
||||
|
||||
let print_mpstat chan { mp_dev = dev; mp_path = path;
|
||||
mp_statvfs = s; mp_vfs = vfs } =
|
||||
fprintf chan "mountpoint statvfs %s %s (%s):\n" dev path vfs;
|
||||
fprintf chan " bsize=%Ld blocks=%Ld bfree=%Ld bavail=%Ld\n"
|
||||
s.Guestfs.bsize s.Guestfs.blocks s.Guestfs.bfree s.Guestfs.bavail
|
||||
|
||||
type guestcaps = {
|
||||
gcaps_block_bus : guestcaps_block_type;
|
||||
gcaps_net_bus : guestcaps_net_type;
|
||||
|
||||
@@ -205,7 +205,7 @@ type target = {
|
||||
|
||||
val string_of_target : target -> string
|
||||
|
||||
(** {2 Other data structures} *)
|
||||
(** {2 Guest firmware} *)
|
||||
|
||||
type target_firmware = TargetBIOS | TargetUEFI
|
||||
|
||||
@@ -215,44 +215,7 @@ type i_firmware =
|
||||
| I_BIOS
|
||||
| I_UEFI of string list
|
||||
|
||||
type inspect = {
|
||||
i_root : string; (** Root device. *)
|
||||
i_type : string; (** Usual inspection fields. *)
|
||||
i_distro : string;
|
||||
i_arch : string;
|
||||
i_major_version : int;
|
||||
i_minor_version : int;
|
||||
i_package_format : string;
|
||||
i_package_management : string;
|
||||
i_product_name : string;
|
||||
i_product_variant : string;
|
||||
i_mountpoints : (string * string) list;
|
||||
i_apps : Guestfs.application2 list; (** List of packages installed. *)
|
||||
i_apps_map : Guestfs.application2 list StringMap.t;
|
||||
(** This is a map from the app name to the application object.
|
||||
Since RPM allows multiple packages with the same name to be
|
||||
installed, the value is a list. *)
|
||||
i_firmware : i_firmware;
|
||||
(** The list of EFI system partitions for the guest with UEFI,
|
||||
otherwise the BIOS identifier. *)
|
||||
i_windows_systemroot : string;
|
||||
i_windows_software_hive : string;
|
||||
i_windows_system_hive : string;
|
||||
i_windows_current_control_set : string;
|
||||
}
|
||||
(** Inspection information. *)
|
||||
|
||||
val string_of_inspect : inspect -> string
|
||||
|
||||
type mpstat = {
|
||||
mp_dev : string; (** Filesystem device (eg. /dev/sda1) *)
|
||||
mp_path : string; (** Guest mountpoint (eg. /boot) *)
|
||||
mp_statvfs : Guestfs.statvfs; (** Free space stats. *)
|
||||
mp_vfs : string; (** VFS type (eg. "ext4") *)
|
||||
}
|
||||
(** Mountpoint stats, used for free space estimation. *)
|
||||
|
||||
val print_mpstat : out_channel -> mpstat -> unit
|
||||
(** {2 Guest capabilities} *)
|
||||
|
||||
type guestcaps = {
|
||||
gcaps_block_bus : guestcaps_block_type;
|
||||
@@ -289,6 +252,8 @@ and guestcaps_video_type = QXL | Cirrus
|
||||
val string_of_guestcaps : guestcaps -> string
|
||||
val string_of_requested_guestcaps : requested_guestcaps -> string
|
||||
|
||||
(** {2 Guest buses} *)
|
||||
|
||||
type target_buses = {
|
||||
target_virtio_blk_bus : target_bus_slot array;
|
||||
target_ide_bus : target_bus_slot array;
|
||||
@@ -331,6 +296,39 @@ and target_bus_slot =
|
||||
|
||||
val string_of_target_buses : target_buses -> string
|
||||
|
||||
(** {2 Inspection data} *)
|
||||
|
||||
type inspect = {
|
||||
i_root : string; (** Root device. *)
|
||||
i_type : string; (** Usual inspection fields. *)
|
||||
i_distro : string;
|
||||
i_arch : string;
|
||||
i_major_version : int;
|
||||
i_minor_version : int;
|
||||
i_package_format : string;
|
||||
i_package_management : string;
|
||||
i_product_name : string;
|
||||
i_product_variant : string;
|
||||
i_mountpoints : (string * string) list;
|
||||
i_apps : Guestfs.application2 list; (** List of packages installed. *)
|
||||
i_apps_map : Guestfs.application2 list StringMap.t;
|
||||
(** This is a map from the app name to the application object.
|
||||
Since RPM allows multiple packages with the same name to be
|
||||
installed, the value is a list. *)
|
||||
i_firmware : i_firmware;
|
||||
(** The list of EFI system partitions for the guest with UEFI,
|
||||
otherwise the BIOS identifier. *)
|
||||
i_windows_systemroot : string;
|
||||
i_windows_software_hive : string;
|
||||
i_windows_system_hive : string;
|
||||
i_windows_current_control_set : string;
|
||||
}
|
||||
(** Inspection information. *)
|
||||
|
||||
val string_of_inspect : inspect -> string
|
||||
|
||||
(** {2 Command line parameters} *)
|
||||
|
||||
type root_choice = AskRoot | SingleRoot | FirstRoot | RootDev of string
|
||||
(** Type of [--root] (root choice) option. *)
|
||||
|
||||
|
||||
19
v2v/v2v.ml
19
v2v/v2v.ml
@@ -32,9 +32,18 @@ open Cmdline
|
||||
|
||||
module G = Guestfs
|
||||
|
||||
(* Conversion mode, either normal (copying) or [--in-place]. *)
|
||||
type conversion_mode =
|
||||
| Copying of overlay list * target list
|
||||
| In_place
|
||||
| Copying of overlay list * target list
|
||||
| In_place
|
||||
|
||||
(* Mountpoint stats, used for free space estimation. *)
|
||||
type mpstat = {
|
||||
mp_dev : string; (* Filesystem device (eg. /dev/sda1) *)
|
||||
mp_path : string; (* Guest mountpoint (eg. /boot) *)
|
||||
mp_statvfs : Guestfs.statvfs; (* Free space stats. *)
|
||||
mp_vfs : string; (* VFS type (eg. "ext4") *)
|
||||
}
|
||||
|
||||
let () = Random.self_init ()
|
||||
|
||||
@@ -390,6 +399,12 @@ and get_mpstats g =
|
||||
|
||||
mpstats
|
||||
|
||||
and print_mpstat chan { mp_dev = dev; mp_path = path;
|
||||
mp_statvfs = s; mp_vfs = vfs } =
|
||||
fprintf chan "mountpoint statvfs %s %s (%s):\n" dev path vfs;
|
||||
fprintf chan " bsize=%Ld blocks=%Ld bfree=%Ld bavail=%Ld\n"
|
||||
s.Guestfs.bsize s.Guestfs.blocks s.Guestfs.bfree s.Guestfs.bavail
|
||||
|
||||
(* Conversion can fail if there is no space on the guest filesystems
|
||||
* (RHBZ#1139543). To avoid this situation, check there is some
|
||||
* headroom. Mainly we care about the root filesystem.
|
||||
|
||||
Reference in New Issue
Block a user