craigwatson / puppet-vmwaretools

Puppet module for non-OSP VMware Tools Installation
http://forge.puppetlabs.com/CraigWatson1987/vmwaretools
Apache License 2.0
28 stars 40 forks source link

Exec['vmware_config_tools'] always running at each puppet run #68

Closed jgrumboe closed 8 years ago

jgrumboe commented 9 years ago

Hi Craig,

thx for your module, but i got one problem with it. Each puppet run is now marked as "something changed" because Exec['vmware_config_tools'] is always running. The problem for me is the "unless" statement: unless => '/sbin/lsmod | /bin/grep -q vmci',

I also read http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1025260 and VMCI is also disabled in our vsphere cluster VMs.

Would it be better to test for the kernel module "vmw_balloon" ? Or would it be better to check "/etc/init.d/vmware-tools status"? What do you think about it?

Best regards, Johannes

jgrumboe commented 9 years ago

After having a little bit more time looking into this, i've got a question: in the former version we hade you only called vmware_config_tools this way: exec { 'vmware_config_tools': command => '/usr/bin/vmware-config-tools.pl -d', creates => $vmwaretools::params::config_creates, } And the variable was set this way: if $::kernelrelease >= '3.' { $config_creates = "/lib/modules/${::kernelrelease}/kernel/drivers/misc/vmw_balloon.ko" } else { $config_creates = "/lib/modules/${::kernelrelease}/misc/vmci.ko" }

This way worked well in our SLES 10/11 environment. Why did you changed it to checked if a kernel module is loaded or not?

jgrumboe commented 9 years ago

Sorry, checked again. The way to check if kernel modules are created ("the old way") only worked well for SLES10 and RHEL 6, since there's no vmci.ko module. In SLES11 and RHEL 7 (kernel >= 3.x) a vmw_balloon.ko is already deployed with the standard kernel. So vmware-config-tools.pl would never be executed i think.

So personally i would go for "/etc/init.d/vmware-tools status".

craigwatson commented 9 years ago

Hi Johannes,

Thanks for investigating this - apologies for not having the time recently!

It seems /etc/init.d/vmware-tools status doesn't exist on my Ubuntu 14.04 box running on vSphere 5.5 - can you check if vmware-toolbox-cmd stat balloon returns correctly for you on SuSE and RHEL?

Also, the $config_creates variable should trigger when the tools are installed but not compiled, so that the command runs after a kernel upgrade. Are you able to test this as well?

Thanks, Craig

craigwatson commented 9 years ago

Hi Johannes,

Can you confirm if this issue still happens on the latest version (2.0.0) of the module?

Thanks, Craig

jgrumboe commented 9 years ago

Hi, Can test in office on tuesday after weekend and national holiday. Greetings, Jo

craigwatson commented 9 years ago

Hi Johannes, I'm going to close this issue after just over a month of inactivity - if this is still an issue for you, please feel free to reopen the issue :)

brahama commented 8 years ago

Hi Craig! I am having same issue. Exec is always running on every run. Just updated to latest version of the module and still the same.

facter -p vmwaretools_version 9.0.12-1897911

In hiera on the node

"classes" : [ "vmwaretools" ], "vmwaretools::version": "9.0.12-1897911", "vmwaretools::working_dir" : "/tmp/vmwaretools"

This is in CentOS release 6.5 (Final) Thanks!

craigwatson commented 8 years ago

Hi,

Can you confirm the output of lsmod | grep vmci?

Thanks, Craig

brahama commented 8 years ago

Sure Craig!

Its empty.

vmware-toolbox-cmd -v 9.0.12.35149 (build-1897911)

lsmod |grep vm vmware_balloon 7199 0 vmxnet3 46317 0

Thanks!

craigwatson commented 8 years ago

Very odd. Can you run the install manually and post the output?

brahama commented 8 years ago

Sure Craig. By install manually what do you mean? Run the vmware-tools perl or the puppet run?

Thanks!

craigwatson commented 8 years ago

Apologies, I meant the perl installer - if the installer is hanging/crashing it would just be retried on the next run.

brahama commented 8 years ago

OK. WIll do taht now. Wouldnt that raise an error in the run? or it will run ok? i had to raise the timeout for that exec as the isntaller takes almost 700 secs. (crazy)

Cheers

brahama commented 8 years ago

I see Warning: The "/tmp" directory may be under attack. quite a few times :S

Warning: The "/tmp" directory may be under attack.

Warning: The "/tmp" directory may be under attack.

Warning: The "/tmp" directory may be under attack.

Warning: The "/tmp" directory may be under attack.

Creating a new initrd boot image for the kernel. vmware-tools start/running The configuration of VMware Tools 9.0.12 build-1897911 for Linux for this running kernel completed successfully.

You must restart your X session before any mouse or graphics changes take effect.

You can now run VMware Tools by invoking "/usr/bin/vmware-toolbox-cmd" from the command line.

To enable advanced X features (e.g., guest resolution fit, drag and drop, and file and text copy/paste), you will need to do one (or more) of the following:

  1. Manually start /usr/bin/vmware-user
  2. Log out and log back into your desktop session; and,
  3. Restart your X session.

Enjoy,

--the VMware team

real 6m33.356s user 0m36.425s sys 0m6.433s

Seems all ok. WEhats weird is that the .pl still runs

root 5745 0.5 0.5 132452 10244 ? Ss 16:57 0:02 /usr/bin/perl -w /usr/bin/vmware-config-tools.pl -d root 14840 0.0 0.0 113948 1164 ? S 17:04 0:00 /sbin/initctl start vmware-tools root 14841 99.5 0.0 11432 1560 ? Rs 17:04 2:00 /bin/sh /etc/vmware-tools/services.sh start

craigwatson commented 8 years ago

Can you post the full output of the script?

It seems you already have a version of VMware Tools installed (as shown by the output of your facter -p vmwaretools_version command).

Can you try manually uninstalling the tools by running vmware-uninstall-tools.pl and then try again using Puppet?

brahama commented 8 years ago

Yes. Uninstalled tools. run puppet agent

Error: /Stage[main]/Vmwaretools::Install::Archive/File[/tmp/vmwaretools/VMwareTools-9.0.12-1897911.tar.gz]: Could not evaluate: Could not retrieve information from environment production source(s) puppet:///modules/vmwaretools/VMwareTools-9.0.12-1897911.tar.gz Notice: /Stage[main]/Vmwaretools::Install::Exec/Exec[uncompress_vmwaretools]: Dependency File[/tmp/vmwaretools/VMwareTools-9.0.12-1897911.tar.gz] has failures: true Warning: /Stage[main]/Vmwaretools::Install::Exec/Exec[uncompress_vmwaretools]: Skipping because of failed dependencies Notice: /Stage[main]/Vmwaretools::Install::Exec/Exec[install_vmwaretools]: Dependency File[/tmp/vmwaretools/VMwareTools-9.0.12-1897911.tar.gz] has failures: true

seems like it cant find or copy the gz?

craigwatson commented 8 years ago

That does look like the case.

As per the module's Readme, you can either place the gzip file in the module's files directory and use Puppet to copy it, or you can put it an HTTP-accessible location and provide the base URL (the fill path will be automatically completed) and MD5 for the file.

For example, for HTTP:

class { 'vmwaretools':
  version     => '9.0.12-1897911',
  archive_url => 'http://server.local/my/dir',
  archive_md5 => '9df56c317ecf466f954d91f6c5ce8a6f',
}
brahama commented 8 years ago

Seems the upgrade removed the files :S it was in place.. Jusut copied it again and it works. Now it seems to be working correctly at least on that node. I will try o a node that already had used the module and has the tools installed..

puppet-agent[30187]: (/Stage[main]/Vmwaretools::Config_tools/Exec[vmware_config_tools]/returns) executed successfully puppet-agent[30187]: Finished catalog run in 361.27 seconds puppet-agent[7713]: (/Stage[main]/Vmwaretools::Config_tools/Exec[vmware_config_tools]/returns) executed successfully puppet-agent[7713]: Finished catalog run in 69.98 seconds

First run took 300 seconds and the second one 69, but it is the only resource i see on the logs. this means the Exec is running or checks if its installed and does nothing?

Thanks!

craigwatson commented 8 years ago

The exec should only run once - on first install. I'm not sure what you mean by "it was in place" - do you mean that you manually deployed the gzip on the node, or you put the gzip into the files directory within the module?

Can you run the vmware-install.pl -d command manually on the node, and post the full output of that command? For some reason, the installer isn't placing or loading the VMCI kernel module on your OS.

brahama commented 8 years ago

Sure Craig! I meant that it was in files dir. After upgrading the module it seems it dissapeared. I put it and it installed correctly in first run (took 300 aprox) but i see the reource on every run as i put in the logs above.

Will run the command now.

brahama commented 8 years ago

I dont see anything...

time vmware-config-tools.pl -d Initializing...

Making sure services for VMware Tools are stopped.

vmware-tools stop/waiting

WARNING: This program cannot compile any modules for the following reason(s)...

[ Press Enter key to continue ]

The communication service is used in addition to the standard communication between the guest and the host. The rest of the software provided by VMware Tools is designed to work independently of this feature. If you wish to have the VMCI feature, you can install the driver by running vmware-config-tools.pl again after making sure that gcc, binutils, make and the kernel sources for your running kernel are installed on your machine. These packages are available on your distribution's installation CD. [ Press Enter key to continue ]

The VM communication interface socket family is used in conjunction with the VM communication interface to provide a new communication path among guests and host. The rest of this software provided by VMware Tools is designed to work independently of this feature. If you wish to have the VSOCK feature you can install the driver by running vmware-config-tools.pl again after making sure that gcc, binutils, make and the kernel sources for your running kernel are installed on your machine. These packages are available on your distribution's installation CD. [ Press the Enter key to continue.]

The module vmxnet3 has already been installed on this system by another installer or package and will not be modified by this installer.

Use the flag --clobber-kernel-modules=vmxnet3 to override.

The module pvscsi has already been installed on this system by another installer or package and will not be modified by this installer.

Use the flag --clobber-kernel-modules=pvscsi to override.

The module vmmemctl has already been installed on this system by another installer or package and will not be modified by this installer.

Use the flag --clobber-kernel-modules=vmmemctl to override.

The VMware Host-Guest Filesystem allows for shared folders between the host OS and the guest OS in a Fusion or Workstation virtual environment. Do you wish to enable this feature? [no]

The fast network device driver (vmxnet module) is used only for our fast networking interface. The rest of the software provided by VMware Tools is designed to work independently of this feature. If you wish to have the fast network driver enabled, you can install the driver by running vmware-config-tools.pl again after making sure that gcc, binutils, make and the kernel sources for your running kernel are installed on your machine. These packages are available on your distribution's installation CD. [ Press Enter key to continue ]

The vmblock enables dragging or copying files between host and guest in a Fusion or Workstation virtual environment. Do you wish to enable this feature? [no]

!!! [EXPERIMENTAL] !!! VMware automatic kernel modules enables automatic building and installation of VMware kernel modules at boot that are not already present. By selecting yes, you will be enabling this experimental feature. You can always disable this feature by re-running vmware-config-tools.pl.

Would you like to enable VMware automatic kernel modules? [no]

No X install found.

Creating a new initrd boot image for the kernel. vmware-tools start/running The configuration of VMware Tools 9.0.12 build-1897911 for Linux for this running kernel completed successfully.

You must restart your X session before any mouse or graphics changes take effect.

You can now run VMware Tools by invoking "/usr/bin/vmware-toolbox-cmd" from the command line.

To enable advanced X features (e.g., guest resolution fit, drag and drop, and file and text copy/paste), you will need to do one (or more) of the following:

  1. Manually start /usr/bin/vmware-user
  2. Log out and log back into your desktop session; and,
  3. Restart your X session.

Enjoy,

--the VMware team

real 0m47.813s user 0m32.007s sys 0m6.863s

brahama commented 8 years ago

Well.. it doesnt compile the vmci module and it seems to equally run and exit ok.. If you wish to have the VMCI feature, you can install the driver by running vmware-config-tools.pl again after making sure that gcc, binutils, make and the kernel sources for your running kernel are installed on your machine

Should i try to install gcc and utils to compile it or maybe we could find another way to do the check in puppet?

I mean, i dont really know if not compiling vmci brakes something..

Thanks!

brahama commented 8 years ago

Morning Craig!

It seems that it doesnt matter if it doesnt compile and loads the vmci module as the tools per the vcenter appear as running and current. So i think the unless there could be changed for a vmware-tools-cmd -v output to see if tools are installed.

Cheers!

craigwatson commented 8 years ago

Hi,

You can force the development tools to install by setting the install_devel parameter to be true:

class { 'vmwaretools':
  install_devel => true,
  ....
}

The reason why the VMCI module is chosen is to avoid conflicts with the open-vm-tools and OSP Tools VMware packages - the trigger for the exec needs to be specific to the gzip tools distributed with vSphere, and also specific for the running kernel so that the module auto-upgrades for new kernels.

Can you check if the tools install with Puppet and the install_devel setting?

Cheers, Craig

brahama commented 8 years ago

Great! That did it. That installed the kernel module and next run it didnt run!

Thanks Craig! We should probably add like a mention about this in the docs so its more clear if someone runs with this maybe.. just a suggestion.

Cheers! thanks!