Pino Toscano
2019-Feb-27  16:57 UTC
[Libguestfs] [PATCH] v2v: linux: do not uninstall open-vm-tools w/ ubuntu-server
ubuntu-server depends on open-vm-tools on Ubuntu, so if v2v tries to
uninstall open-vm-tools then dpkg will (rightfully) fail with a
dependency issue.
Since open-vm-tools is harmless after the conversion anyway (it will
not even run), then do not attempt to uninstall it if ubuntu-server is
installed too.
Followup of commit 2bebacf8bf611f0f80a66915f78653ce30b38129.
---
 v2v/convert_linux.ml | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/v2v/convert_linux.ml b/v2v/convert_linux.ml
index 3d61400b5..b4b2f24c4 100644
--- a/v2v/convert_linux.ml
+++ b/v2v/convert_linux.ml
@@ -289,6 +289,18 @@ let convert (g : G.guestfs) inspect source output rcaps  
     (* Uninstall VMware Tools. *)
     let remove = ref [] and libraries = ref [] in
+    (* On Ubuntu, the ubuntu-server metapackage depends on
+     * open-vm-tools, and thus any attempt to remove it will cause
+     * dependency issues.  Hence, special case this situation, and
+     * leave open-vm-tools installed in this case.
+     *)
+    let has_ubuntu_server +      if family = `Debian_family then
+        List.exists (
+          fun { G.app2_name = name } ->
+            name = "ubuntu-server"
+        ) inspect.i_apps
+      else false in
     List.iter (
       fun { G.app2_name = name } ->
         if String.is_prefix name "vmware-tools-libraries-" then
@@ -301,7 +313,7 @@ let convert (g : G.guestfs) inspect source output rcaps     
List.push_front name remove
         else if String.is_prefix name "open-vm-tools-" then
           List.push_front name remove
-        else if name = "open-vm-tools" then
+        else if name = "open-vm-tools" && not
has_ubuntu_server then
           List.push_front name remove
     ) inspect.i_apps;
     let libraries = !libraries in
-- 
2.20.1
Pino Toscano
2019-Feb-27  17:00 UTC
Re: [Libguestfs] [PATCH] v2v: linux: do not uninstall open-vm-tools w/ ubuntu-server
On Wednesday, 27 February 2019 17:57:08 CET Pino Toscano wrote:> ubuntu-server depends on open-vm-tools on Ubuntu, so if v2v tries to > uninstall open-vm-tools then dpkg will (rightfully) fail with a > dependency issue. > > Since open-vm-tools is harmless after the conversion anyway (it will > not even run), then do not attempt to uninstall it if ubuntu-server is > installed too. > > Followup of commit 2bebacf8bf611f0f80a66915f78653ce30b38129. > ---Forgot to append after this: Thanks to: Ming Xie. (already in my local copy) -- Pino Toscano
Richard W.M. Jones
2019-Mar-25  15:01 UTC
Re: [Libguestfs] [PATCH] v2v: linux: do not uninstall open-vm-tools w/ ubuntu-server
On Wed, Feb 27, 2019 at 06:00:08PM +0100, Pino Toscano wrote:> On Wednesday, 27 February 2019 17:57:08 CET Pino Toscano wrote: > > ubuntu-server depends on open-vm-tools on Ubuntu, so if v2v tries to > > uninstall open-vm-tools then dpkg will (rightfully) fail with a > > dependency issue. > > > > Since open-vm-tools is harmless after the conversion anyway (it will > > not even run), then do not attempt to uninstall it if ubuntu-server is > > installed too. > > > > Followup of commit 2bebacf8bf611f0f80a66915f78653ce30b38129. > > --- > > Forgot to append after this: > > Thanks to: Ming Xie. > > (already in my local copy)Patch looks sensible, ACK. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v
Reasonably Related Threads
- [PATCH] v2v: linux: Move kernel detection to a separate module.
- [v2v PATCH 1/2] linux: split kernel packages filtering from processing
- [PATCH 2/2] v2v: linux: do not install qemu-guest-agent if already installed
- [PATCH 5/5] mllib: Replace various ad hoc string_* functions with String.*
- [PATCH] v2v: linux: try to fix removal of VMware tools