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.1
Looks 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