Install qemu-ga package during conversion

Pick up upstream/rhel-9.1 7dd396af54df ("convert_linux: start the QEMU
guest agent in a distro-specific way", 2022-08-18).

Hoist the previous rhbz#2028764 section in the %changelog to the top.

resolves: rhbz#2028764
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
This commit is contained in:
Laszlo Ersek 2022-08-18 11:35:50 +02:00
parent 2dca36ed01
commit cc82339c1c
2 changed files with 104 additions and 3 deletions

View File

@ -0,0 +1,98 @@
From 7dd396af54df3f7563aa3a42b3c17547710aec67 Mon Sep 17 00:00:00 2001
From: Laszlo Ersek <lersek@redhat.com>
Date: Wed, 17 Aug 2022 16:47:36 +0200
Subject: [PATCH] convert_linux: start the QEMU guest agent in a
distro-specific way
The current command "service <package-name> start" does not apply to
RHEL-6; the service name ("qemu-ga") differs from the package name
("qemu-guest-agent") there.
Overhaul the logic -- detach the command from the package name; cover the
RHEL, ALT, SUSE and Debian families separately. Remove the "chkconfig"
command, as in all tested / investigated cases, it is unnecessary.
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2028764
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20220817144736.18850-1-lersek@redhat.com>
Acked-by: Richard W.M. Jones <rjones@redhat.com>
(cherry picked from commit ad2b4f2e50950a5798a75359badb526290aa92e7)
---
convert/convert_linux.ml | 56 ++++++++++++++++++++++++++++------------
1 file changed, 40 insertions(+), 16 deletions(-)
diff --git a/convert/convert_linux.ml b/convert/convert_linux.ml
index 2aaa438e..b8e9ad15 100644
--- a/convert/convert_linux.ml
+++ b/convert/convert_linux.ml
@@ -66,6 +66,34 @@ let convert (g : G.guestfs) source inspect keep_serial_console _ =
| _ -> None
in
+ let qga_svc_start_cmd family distro major =
+ match family, distro, major with
+ | `RHEL_family, ( "rhel" | "centos" | "scientificlinux" | "redhat-based" |
+ "oraclelinux" ), 6 ->
+ (* https://bugzilla.redhat.com/show_bug.cgi?id=2028764#c52 *)
+ Some "service qemu-ga start"
+
+ | `RHEL_family, _, _ ->
+ (* https://bugzilla.redhat.com/show_bug.cgi?id=2028764#c52 *)
+ Some "systemctl start qemu-guest-agent"
+
+ | `ALT_family, _, _ ->
+ (* https://bugzilla.redhat.com/show_bug.cgi?id=2028764#c45 *)
+ Some "systemctl start qemu-guest-agent"
+
+ | `SUSE_family, _, _ ->
+ (* https://bugzilla.redhat.com/show_bug.cgi?id=2028764#c51 *)
+ None
+
+ | `Debian_family, _, _ ->
+ (* https://bugzilla.redhat.com/show_bug.cgi?id=2028764#c42 *)
+ Some "service qemu-guest-agent start"
+
+ | _ ->
+ (* should never be called when "qga_pkg_of_family" returns None *)
+ assert false
+ in
+
assert (inspect.i_package_format = "rpm" || inspect.i_package_format = "deb");
(* Fail early if i_apps is empty. Certain steps such as kernel
@@ -615,23 +643,19 @@ let convert (g : G.guestfs) source inspect keep_serial_console _ =
\ \ rm -f %s\n\
fi\n" selinux_enforcing selinux_enforcing);
- (* Start the agent now and at subsequent boots. The following
- * commands should work on both sysvinit distros / distro versions
- * (regardless of "/etc/rc.d/" vs. "/etc/init.d/" being the scheme
- * in use) and systemd distros (via redirection to systemctl).
- *
- * On distros where the chkconfig command is redirected to
- * systemctl, the chkconfig command is likely superfluous. That's
- * because on systemd distros, the QGA package comes with such
- * runtime dependencies / triggers that the presence of the
- * virtio-serial port named "org.qemu.guest_agent.0" automatically
- * starts the agent during (second and later) boots. However, even
- * on such distros, the chkconfig command should do no harm.
+ (* On all the distro families covered by "qga_pkg_of_family" and
+ * "qga_svc_start_cmd", the QEMU guest agent service is always
+ * enabled by package installation for *subsequent* boots. Package
+ * installation may or may not enable the service for the current
+ * (i.e., first) boot, however, so try that here manually.
*)
- fbs "start qga"
- (sprintf "#!/bin/sh\n\
- service %s start\n\
- chkconfig %s on\n" qga_pkg qga_pkg)
+ match qga_svc_start_cmd family inspect.i_distro inspect.i_major_version
+ with
+ | None -> ()
+ | Some start_cmd ->
+ fbs "start qga"
+ (sprintf "#!/bin/sh\n\
+ %s\n" start_cmd)
with
| Guest_packages.Unknown_package_manager msg
| Guest_packages.Unimplemented_package_manager msg ->

View File

@ -16,7 +16,7 @@
Name: virt-v2v
Epoch: 1
Version: 2.0.7
Release: 5%{?dist}
Release: 6%{?dist}
Summary: Convert a virtual machine to run on KVM
License: GPLv2+
@ -66,6 +66,7 @@ Patch0030: 0030-output-create_libvirt_xml-relax-VCPU-feature-checkin.patch
Patch0031: 0031-input-xen-cover-RHEL9-OpenSSL-crypto-settings.patch
Patch0032: 0032-convert_linux-remove-LVM2-devices-file.patch
Patch0033: 0033-convert-linux-Add-support-for-Zstandard-compressed-k.patch
Patch0034: 0034-convert_linux-start-the-QEMU-guest-agent-in-a-distro.patch
%if !0%{?rhel}
# libguestfs hasn't been built on i686 for a while since there is no
@ -344,6 +345,10 @@ rm $RPM_BUILD_ROOT%{_mandir}/man1/virt-v2v-in-place.1*
%changelog
* Thu Aug 18 2022 Laszlo Ersek <lersek@redhat.com> - 1:2.0.7-6
- Install qemu-ga package during conversion
resolves: rhbz#2028764
* Wed Aug 10 2022 Richard W.M. Jones <rjones@redhat.com> - 1:2.0.7-5
- Remove LVM2 "devices file" during conversion
resolves: rhbz#2112801
@ -402,8 +407,6 @@ rm $RPM_BUILD_ROOT%{_mandir}/man1/virt-v2v-in-place.1*
resolves: rhbz#2102719
- Add -oo compressed support
resolves: rhbz#2047660
- Install qemu-ga package during conversion
resolves: rhbz#2028764
- Limit the maximum of disks per guest
resolves: rhbz#2051564
- Add support for LUKS encrypted guests using Clevis & Tang