Pino Toscano
2018-Oct-04 10:11 UTC
[Libguestfs] [PATCH 0/2] v2v: uninstall VMware tools on all Linux guests
Hi, this patch series attempt to uninstall VMware tools on all the Linux guests, and reduce the uninstallation time needed in some cases: - v2v tries to workaround the slowest part of the tarball-installed VMware tools - v2v uninstalls the open source VMware tools (open-vm-tools) Thanks, Pino Toscano (2): v2v: linux: remove open-vm-tools packages v2v: linux: try to trick vmware-uninstall-tools.pl v2v/convert_linux.ml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) -- 2.17.1
Pino Toscano
2018-Oct-04 10:11 UTC
[Libguestfs] [PATCH 1/2] v2v: linux: remove open-vm-tools packages
Linux distributions usually ship the open source VMware tools as open-vm-tools (and open-vm-tools-desktop for the integration with X). While they will not run already anymore after the conversion, uninstall them during the conversion, to save some space in the converted guest. --- v2v/convert_linux.ml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/v2v/convert_linux.ml b/v2v/convert_linux.ml index 726915875..c401b7f74 100644 --- a/v2v/convert_linux.ml +++ b/v2v/convert_linux.ml @@ -297,6 +297,10 @@ let convert (g : G.guestfs) inspect source output rcaps List.push_front name remove else if String.is_prefix name "kmod-vmware-tools" then 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 + List.push_front name remove ) inspect.i_apps; let libraries = !libraries in -- 2.17.1
Pino Toscano
2018-Oct-04 10:11 UTC
[Libguestfs] [PATCH 2/2] v2v: linux: try to trick vmware-uninstall-tools.pl
When installing the VMware tools from tarball, the installation script rebuilds the initramdisk of all the available kernels to inject the missing kernel drivers; in the end, the information on which kernels were changed is recorded in the internal "database" of the installation answers. When uninstalling the VMware tools, the uninstallation script reads the saved answers, and in the case of ramdisks will do the reverse job done during the installation (which is done again when new kernels are installed). OTOH, virt-v2v already rebuilds the initramdisk of the default kernel, not touching the other available kernels (no matter whether they have the right modules or not). Hence, trick the answers "database" of the VMware tools to discard all the information about ramdisks to restore on uninstallation: this way they are not rebuilt, and the whole uninstallation time will be reasonable enough (a couple of minutes or so). --- v2v/convert_linux.ml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/v2v/convert_linux.ml b/v2v/convert_linux.ml index c401b7f74..e8c64ac1b 100644 --- a/v2v/convert_linux.ml +++ b/v2v/convert_linux.ml @@ -370,6 +370,21 @@ let convert (g : G.guestfs) inspect source output rcaps let uninstaller = "/usr/bin/vmware-uninstall-tools.pl" in if g#is_file ~followsymlinks:true uninstaller then ( try + (* The VMware tools uninstaller will rebuild the ramdisk for + * the kernels present either at installation time, or at + * later time (when the tools are applied to newly + * installed kernels). Since we do not want to potentially + * rebuilt all the available kernels, trick the "database" + * of the VMware tools installation to not do any ramdisk + * restore. In any case, we will rebuilt the ramdisk of the + * default kernel already. + *) + let locations = "/etc/vmware-tools/locations" in + if g#is_file ~followsymlinks:true locations then ( + g#write_append locations "remove_answer RESTORE_RAMDISK_CMD\n"; + g#write_append locations "remove_answer RESTORE_RAMDISK_KERNELS\n"; + g#write_append locations "remove_answer RESTORE_RAMDISK_ONECALL\n"; + ); if family = `SUSE_family then ignore (g#command [| "/usr/bin/env"; "rootdev=" ^ inspect.i_root; -- 2.17.1
Richard W.M. Jones
2018-Oct-04 11:19 UTC
Re: [Libguestfs] [PATCH 2/2] v2v: linux: try to trick vmware-uninstall-tools.pl
On Thu, Oct 04, 2018 at 12:11:12PM +0200, Pino Toscano wrote:> When installing the VMware tools from tarball, the installation script > rebuilds the initramdisk of all the available kernels to inject the > missing kernel drivers; in the end, the information on which kernels > were changed is recorded in the internal "database" of the installation > answers. When uninstalling the VMware tools, the uninstallation script > reads the saved answers, and in the case of ramdisks will do the reverse > job done during the installation (which is done again when new kernels > are installed). > > OTOH, virt-v2v already rebuilds the initramdisk of the default kernel, > not touching the other available kernels (no matter whether they have > the right modules or not). Hence, trick the answers "database" of the > VMware tools to discard all the information about ramdisks to restore on > uninstallation: this way they are not rebuilt, and the whole > uninstallation time will be reasonable enough (a couple of minutes or > so). > --- > v2v/convert_linux.ml | 15 +++++++++++++++ > 1 file changed, 15 insertions(+) > > diff --git a/v2v/convert_linux.ml b/v2v/convert_linux.ml > index c401b7f74..e8c64ac1b 100644 > --- a/v2v/convert_linux.ml > +++ b/v2v/convert_linux.ml > @@ -370,6 +370,21 @@ let convert (g : G.guestfs) inspect source output rcaps > let uninstaller = "/usr/bin/vmware-uninstall-tools.pl" in > if g#is_file ~followsymlinks:true uninstaller then ( > try > + (* The VMware tools uninstaller will rebuild the ramdisk for > + * the kernels present either at installation time, or at > + * later time (when the tools are applied to newly > + * installed kernels). Since we do not want to potentially > + * rebuilt all the available kernels, trick the "database" > + * of the VMware tools installation to not do any ramdisk > + * restore. In any case, we will rebuilt the ramdisk of the > + * default kernel already. > + *) > + let locations = "/etc/vmware-tools/locations" in > + if g#is_file ~followsymlinks:true locations then ( > + g#write_append locations "remove_answer RESTORE_RAMDISK_CMD\n"; > + g#write_append locations "remove_answer RESTORE_RAMDISK_KERNELS\n"; > + g#write_append locations "remove_answer RESTORE_RAMDISK_ONECALL\n"; > + ); > if family = `SUSE_family then > ignore (g#command [| "/usr/bin/env"; > "rootdev=" ^ inspect.i_root; > -- > 2.17.1Looks sensible based on the discussions we had on IRC, so ACK series. Thanks, 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 0/2] v2v: uninstall VMware tools on all Linux guests
- [PATCH v3 1/2] v2v: linux: correctly reconfigure the initrd on Debian
- [PATCH 1/2] v2v: linux: correctly reconfigure the initrd on Debian
- [PATCH 1/2] v2v: linux: correctly reconfigure the initrd on Debian
- Re: [PATCH 8/8] v2v: linux: correctly reconfigure the initrd on Debian