Matthew Booth
2011-Feb-01 16:19 UTC
[Libguestfs] [PATCH] Check for, and uninstall, VMware Tools installed from tarball
VMware Tools can be installed by RPM or from a tarball. We were only looking for the RPM. If it was installed by tarball, we would end up leaving it in place. If VMware Tools detects that it is not running on a VMware platform when it starts, it will clumsily try to uninstall itself, leading to misconfiguration. This patch looks for tarball-installed VMware Tools and uninstalls it. Fixes RHBZ#623571 --- lib/Sys/VirtV2V/Converter/RedHat.pm | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-) diff --git a/lib/Sys/VirtV2V/Converter/RedHat.pm b/lib/Sys/VirtV2V/Converter/RedHat.pm index 762ee0e..114d876 100644 --- a/lib/Sys/VirtV2V/Converter/RedHat.pm +++ b/lib/Sys/VirtV2V/Converter/RedHat.pm @@ -756,6 +756,24 @@ sub _unconfigure_vmware _remove_application($name, $g); } } + + # VMwareTools may have been installed from tarball, in which case the above + # won't detect it. Look for the uninstall tool, and run it if it's present. + # + # Note that it's important we do this early in the conversion process, as + # this uninstallation script naively overwrites configuration files with + # versions it cached from prior to installation. + my $vmwaretools = '/usr/bin/vmware-uninstall-tools.pl'; + if ($g->exists($vmwaretools)) { + eval { $g->command([$vmwaretools]) }; + warn user_message(__x('VMware Tools was detected, but uninstallation '. + 'failed. The error message was: {error}', + error => $@)) if $@; + + # Reload augeas to detect changed made by vmware tools uninstallation + eval { $g->aug_load() }; + augeas_error($g, $@) if $@; + } } # Get a list of all foreign hypervisor specific kernel modules which are being -- 1.7.3.5
Richard W.M. Jones
2011-Feb-01 19:52 UTC
[Libguestfs] [PATCH] Check for, and uninstall, VMware Tools installed from tarball
On Tue, Feb 01, 2011 at 04:19:03PM +0000, Matthew Booth wrote:> VMware Tools can be installed by RPM or from a tarball. We were only > looking for the RPM. If it was installed by tarball, we would end up > leaving it in place. If VMware Tools detects that it is not running > on a VMware platform when it starts, it will clumsily try to > uninstall itself, leading to misconfiguration. This patch looks for > tarball-installed VMware Tools and uninstalls it. > > Fixes RHBZ#623571 > --- > lib/Sys/VirtV2V/Converter/RedHat.pm | 18 ++++++++++++++++++ > 1 files changed, 18 insertions(+), 0 deletions(-) > > diff --git a/lib/Sys/VirtV2V/Converter/RedHat.pm b/lib/Sys/VirtV2V/Converter/RedHat.pm > index 762ee0e..114d876 100644 > --- a/lib/Sys/VirtV2V/Converter/RedHat.pm > +++ b/lib/Sys/VirtV2V/Converter/RedHat.pm > @@ -756,6 +756,24 @@ sub _unconfigure_vmware > _remove_application($name, $g); > } > } > + > + # VMwareTools may have been installed from tarball, in which case the above > + # won't detect it. Look for the uninstall tool, and run it if it's present. > + # > + # Note that it's important we do this early in the conversion process, as > + # this uninstallation script naively overwrites configuration files with > + # versions it cached from prior to installation. > + my $vmwaretools = '/usr/bin/vmware-uninstall-tools.pl'; > + if ($g->exists($vmwaretools)) {I might use '$g->is_file' here, although that would fail if it was a symlink.> + eval { $g->command([$vmwaretools]) }; > + warn user_message(__x('VMware Tools was detected, but uninstallation '. > + 'failed. The error message was: {error}', > + error => $@)) if $@; > + > + # Reload augeas to detect changed made by vmware tools uninstallations/changed/changes/> + eval { $g->aug_load() }; > + augeas_error($g, $@) if $@; > + } > }ACK. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://et.redhat.com/~rjones/virt-df/
Reasonably Related Threads
- [PATCH 1/2] ESX: Look harder for potential transfer failures
- [PATCH] Don't remove foreign kernels during conversion
- [PATCH 1/4] Check that we're not overwriting an existing Libvirt domain
- [PATCH 1/2] Refactor guest and volume creation into Sys::VirtV2V::Target::LibVirt
- [PATCH] Fix subclassing of LibVirtXMLSource