Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for setting guestinfo variables #174

Merged
1 commit merged into from
Mar 8, 2016

Conversation

Sharpie
Copy link
Contributor

@Sharpie Sharpie commented Feb 18, 2016

This patch adds an extra_config section to the provider configuration which
can be set to a hash. This hash is used to populate the extraConfig section
of the VirtualMachineConfigSpec used to clone new VMs. The keys of the hash
must start with guestinfo. and the values are available to guest VMs with
VMware tools installed via the vmtoolsd command.

@Sharpie Sharpie force-pushed the add-guestinfo-support branch 2 times, most recently from 477dc07 to bf84188 Compare February 18, 2016 18:46
@Sharpie
Copy link
Contributor Author

Sharpie commented Feb 18, 2016

Cleaned up some RuboCop issues reported by the Travis runs, but there are still style failures that don't appear to be related to my changes.

@rylarson
Copy link
Contributor

rylarson commented Mar 3, 2016

This would be good to have. It needs unit tests though. Take a look at clone_spec.rb. You should add a spec that asserts that if you set these properties, they end up on the VirtualMachineConfigSpec

@Sharpie Sharpie force-pushed the add-guestinfo-support branch from bf84188 to b2f41a1 Compare March 7, 2016 22:35
@Sharpie
Copy link
Contributor Author

Sharpie commented Mar 7, 2016

@rylarson Good call. Some tests were failing because extra_config needed to be added to the test doubles. Updated patch pushed with test coverage.

@Sharpie Sharpie force-pushed the add-guestinfo-support branch from b2f41a1 to f0eca6a Compare March 7, 2016 22:38
This patch adds an `extra_config` section to the provider configuration which
can be set to a hash. This hash is used to populate the `extraConfig` section
of the `VirtualMachineConfigSpec` used to clone new VMs. The keys of the hash
must start with `guestinfo.` and the values are available to guest VMs with
VMware tools installed via the `vmtoolsd` command.
@Sharpie Sharpie force-pushed the add-guestinfo-support branch from f0eca6a to 226ff96 Compare March 7, 2016 22:49
@ghost ghost self-assigned this Mar 8, 2016
@ghost
Copy link

ghost commented Mar 8, 2016

Hi @Sharpie,

While testing your changes on our vSphere host, I haven't been able to get the guestinfo variables set on creation of a VM. With vsphere.extra_config = { 'guestinfo.foo' => 'testpasses' } in my Vagrantfile, I get this output:

  > vagrant up --provider=vsphere
Bringing machine 'default' up with 'vsphere' provider...
==> default: Calling vSphere CloneVM with the following settings:
==> default:  -- Template VM: NSIDC/vm/Linux/SCM/trusty64-nsidc
==> default:  -- Target VM: NSIDC/vm/Linux/SCM/dev/mbrandt-vsphere-pr-testing
NoPermission: Permission to perform this operation was denied.

However, if I remove the extra_config setting from my Vagrantfile and create a machine, after SSHing to it, I can set guestinfo variables with vmtoolsd:

vagrant@trusty64:~$ vmtoolsd --cmd 'info-get guestinfo.foo'
No value found
vagrant@trusty64:~$ vmtoolsd --cmd 'info-set guestinfo.foo bar'

vagrant@trusty64:~$ vmtoolsd --cmd 'info-get guestinfo.foo'
bar

Do you know if there's some vSphere setting that we need to change for the guestinfo variables to be set when creating the VM?

I've also filed a ticket with our SysAdmins to see if they can be of any help. Naturally, I'd like to be able to see your changes work before merging them in 😄

- Michael

@rylarson
Copy link
Contributor

rylarson commented Mar 8, 2016

It looks like you are getting a permission denied error. You probably just don't have the required Reconfigure privilege: VirtualMachine.Config.AdvancedConfig permission. This is the only operation in VirtualMachineConfigSpec that requires this permission.

@ghost
Copy link

ghost commented Mar 8, 2016

I have a couple follow-up questions from our SAs:

Are the guestinfo settings stored in vSphere? If not, how are they stored?

vagrant-vsphere provides support for Custom Attributes, which are stored in vSphere, and can be viewed in the vSphere Web Client. How do guestinfo variables differ from Custom Attributes? I'm having trouble finding info comparing the two in web searches.

ghost pushed a commit that referenced this pull request Mar 8, 2016
Add support for setting guestinfo variables
@ghost ghost merged commit e4a2af8 into nsidc:master Mar 8, 2016
@ghost
Copy link

ghost commented Mar 8, 2016

Since the issue I'm having is only with NSIDC's internal vSphere configuration, and not with the code here, I'll go ahead and merge it now.

Thanks @Sharpie! And thanks @rylarson for the note about the relevant permissions.

@Sharpie Sharpie deleted the add-guestinfo-support branch March 22, 2016 00:00
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants