virt-v2v/0018-windows_virtio-remove-...

204 lines
7.8 KiB
Diff
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

From 2aa40ec1db2af2310a649bf6142f8de1ef0cd8e2 Mon Sep 17 00:00:00 2001
From: Laszlo Ersek <lersek@redhat.com>
Date: Mon, 13 Jun 2022 19:01:33 +0200
Subject: [PATCH] windows_virtio: remove "install_linux_tools"
"Windows_virtio.install_linux_tools" has never really worked in practice;
we've never managed to get the right content into the right location on
the virtio-win ISO.
Later patches in this series will install the qemu guest agent in a
firstboot script, using the guest's own package manager. For now, for ease
of review, only remove "Windows_virtio.install_linux_tools", and its
dependencies that now become unused:
- Linux.architecture_string
- Linux.binary_package_extension
- Linux.install_local
Salvage the comment (at the outermost call site) that failure to install
QGA is not fatal. This will be relevant for exception handling in the
subsequent patches.
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2028764
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Richard W.M. Jones <rjones@redhat.com>
Message-Id: <20220613170135.12557-3-lersek@redhat.com>
(cherry picked from commit 52e9cd77a8ef7c1b7975d4f72056f8f6b45fb10b)
---
convert/convert_linux.ml | 4 +++-
convert/linux.ml | 35 -------------------------------
convert/linux.mli | 11 ----------
convert/windows_virtio.ml | 42 --------------------------------------
convert/windows_virtio.mli | 4 ----
5 files changed, 3 insertions(+), 93 deletions(-)
diff --git a/convert/convert_linux.ml b/convert/convert_linux.ml
index 56604949..79462aa1 100644
--- a/convert/convert_linux.ml
+++ b/convert/convert_linux.ml
@@ -538,13 +538,15 @@ let convert (g : G.guestfs) source inspect keep_serial_console _ =
)
and install_linux_tools () =
+ (* It is not fatal if we fail to install the QEMU guest agent. *)
let has_qemu_guest_agent =
List.exists (
fun { G.app2_name = name } ->
name = "qemu-guest-agent"
) inspect.i_apps in
if not has_qemu_guest_agent then
- Windows_virtio.install_linux_tools g inspect
+ (* FIXME -- install qemu-guest-agent here *)
+ ()
and configure_kernel () =
(* Previously this function would try to install kernels, but we
diff --git a/convert/linux.ml b/convert/linux.ml
index e2908d02..f9acd63f 100644
--- a/convert/linux.ml
+++ b/convert/linux.ml
@@ -33,20 +33,6 @@ let augeas_reload g =
g#aug_load ();
debug_augeas_errors g
-let rec install_local g { i_package_format = package_format } packages =
- if packages <> [] then (
- match package_format with
- | "rpm" ->
- let cmd = [ "rpm"; "--upgrade"; "-v" ] @ packages in
- let cmd = Array.of_list cmd in
- ignore (g#command cmd)
- | format ->
- error (f_"dont know how to install packages using %s: packages: %s")
- format (String.concat " " packages)
- (* Reload Augeas in case anything changed. *)
- augeas_reload g
- )
-
let rec remove g inspect packages =
if packages <> [] then (
do_remove g inspect packages;
@@ -187,24 +173,3 @@ let is_package_manager_save_file filename =
(* Recognized suffixes of package managers. *)
let suffixes = [ ".dpkg-old"; ".dpkg-new"; ".rpmsave"; ".rpmnew"; ] in
List.exists (Filename.check_suffix filename) suffixes
-
-let binary_package_extension { i_package_format = package_format } =
- match package_format with
- | "deb" -> "deb"
- | "rpm" -> "rpm"
- | format ->
- error (f_"dont know what is the extension of binary packages using %s")
- format
-
-let architecture_string { i_package_format = package_format; i_arch = arch;
- i_distro = distro } =
- match package_format, distro, arch with
- | "deb", _, "x86_64" -> "amd64"
- | "deb", _, a -> a
- | "rpm", ("sles"|"suse-based"|"opensuse"), "i386" -> "i586"
- | "rpm", ("sles"|"suse-based"|"opensuse"), a -> a
- | "rpm", _, "i386" -> "i686"
- | "rpm", _, a -> a
- | format, distro, arch ->
- error (f_"dont know what is the architecture string of %s using %s on %s")
- arch format distro
diff --git a/convert/linux.mli b/convert/linux.mli
index 856ffe3c..57898310 100644
--- a/convert/linux.mli
+++ b/convert/linux.mli
@@ -23,9 +23,6 @@ val augeas_reload : Guestfs.guestfs -> unit
additional debugging information about parsing problems
that augeas found. *)
-val install_local: Guestfs.guestfs -> Types.inspect -> string list -> unit
-(** Install package(s). *)
-
val remove : Guestfs.guestfs -> Types.inspect -> string list -> unit
(** Uninstall package(s). *)
@@ -38,11 +35,3 @@ val is_file_owned : Guestfs.guestfs -> Types.inspect -> string -> bool
val is_package_manager_save_file : string -> bool
(** Return true if the filename is something like [*.rpmsave], ie.
a package manager save-file. *)
-
-val binary_package_extension : Types.inspect -> string
-(** Return the extension typically used for binary packages in the
- specified package format. *)
-
-val architecture_string : Types.inspect -> string
-(** Return the architecture string typically used for binary packages
- in the specified package format, and for the specified distro. *)
diff --git a/convert/windows_virtio.ml b/convert/windows_virtio.ml
index 301f7544..183166b7 100644
--- a/convert/windows_virtio.ml
+++ b/convert/windows_virtio.ml
@@ -113,48 +113,6 @@ let rec install_drivers ((g, _) as reg) inspect =
virtio_rng_supported, virtio_ballon_supported, isa_pvpanic_supported, virtio_socket_supported)
)
-and install_linux_tools g inspect =
- let os =
- match inspect.i_distro with
- | "fedora" -> Some "fc28"
- | "rhel" | "centos" | "scientificlinux" | "redhat-based"
- | "oraclelinux" ->
- (* map 6 -> "el6" etc. *)
- if inspect.i_major_version >= 6 then
- Some (sprintf "el%d" inspect.i_major_version)
- else
- None
- | "sles" | "suse-based" | "opensuse" -> Some "lp151"
- | _ -> None in
-
- match os with
- | None -> ()
- | Some os ->
- let src_path = "linux" // os in
- let dst_path = "/var/tmp" in
- let pkg_arch = Linux.architecture_string inspect in
- let pkg_ext = Linux.binary_package_extension inspect in
- let package_suffixes = [
- sprintf ".%s.%s" pkg_arch pkg_ext;
- sprintf "_%s.%s" pkg_arch pkg_ext;
- ] in
- let package_filter path _ =
- List.exists (String.is_suffix path) package_suffixes
- in
- debug "locating packages in %s" src_path;
- let packages =
- copy_from_virtio_win g inspect src_path dst_path
- package_filter
- (fun () -> ()) in
- debug "done copying %d files" (List.length packages);
- let packages = List.map ((//) dst_path) packages in
- try
- Linux.install_local g inspect packages;
- if packages <> [] then
- info (f_"QEMU Guest Agent installed for this guest.");
- with G.Error msg ->
- warning (f_"failed to install QEMU Guest Agent: %s") msg
-
and add_guestor_to_registry ((g, root) as reg) inspect drv_name drv_pciid =
let ddb_node = g#hivex_node_get_child root "DriverDatabase" in
diff --git a/convert/windows_virtio.mli b/convert/windows_virtio.mli
index a92cc01d..73ec95c7 100644
--- a/convert/windows_virtio.mli
+++ b/convert/windows_virtio.mli
@@ -38,10 +38,6 @@ val install_drivers
reflecting what devices are now required by the guest, either virtio
devices if we managed to install those, or legacy devices if we didn't. *)
-val install_linux_tools : Guestfs.guestfs -> Types.inspect -> unit
-(** installs QEMU Guest Agent on Linux guest OS from the driver directory or
- driver ISO. It is not fatal if we fail to install the agent. *)
-
val copy_qemu_ga : Guestfs.guestfs -> Types.inspect -> string list
(** copy MSIs (idealy just one) with QEMU Guest Agent to Windows guest. The
MSIs are not installed by this function. *)
--
2.31.1