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

(POOLER-83) Add ability to specify a datacenter for vsphere #223

Merged
merged 2 commits into from
Jun 27, 2017

Conversation

glennsarti
Copy link
Contributor

@glennsarti glennsarti commented Jun 15, 2017

This PR builds on PR #224

Previously the vsphere provider assumed that there was one and only one
datacenter (DC) in the vsphere instance. However this is simply not true for
many vSphere installations. This commit:

  • Adds the ability to define a vSphere datacenter at the Pool or Provider level
    whereby the Pool setting takes precedence
  • If no datacenter is specified the default behaviour of picking the first DC
    in the vSphere instance
  • Updated all tests for the new setting
  • Update the vmpooler configuration file example with relevant setting name
    and expected behaviour
  • Fixed a bug in the rvmomi_helper whereby if no DC was found it would return
    all DCs. This is opposite behaviour of the real RBVMOMI library as it returns
    nil

@glennsarti glennsarti force-pushed the pooler-83-specify-datacenter branch 4 times, most recently from 69a5b6b to 55d286f Compare June 15, 2017 23:16
@glennsarti
Copy link
Contributor Author

Code has been completed. Just pending an actual test on vsphere infrastructure to make sure it all works.

@glennsarti glennsarti changed the title {WIP} (POOLER-83) Add tests for multiple datacenters {WIP} (POOLER-83) Add ability to specify a datacenter for vsphere Jun 16, 2017
@glennsarti
Copy link
Contributor Author

Verified manually, against a real vSphere instance, that the datacenter setting is being used:

  • Not putting in a DC found the first DC
  • Specifying a DC name that does not exist in either the pool or provider config caused vSphere to throw errors saying it did not exist
  • Specifying the DC name that does exist, vmpooler ran correctly. e.g.
:vsphere:
  ...
  datacenter: 'pdx'
...

@glennsarti glennsarti changed the title {WIP} (POOLER-83) Add ability to specify a datacenter for vsphere (POOLER-83) Add ability to specify a datacenter for vsphere Jun 16, 2017
@glennsarti
Copy link
Contributor Author

This PR is ready for merge

@@ -422,8 +434,9 @@ def add_disk(vm, size, datastore, connection)
true
end

def find_datastore(datastorename, connection)
datacenter = connection.serviceInstance.find_datacenter
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes you're right. I'm concerned the specs didn't pick that up.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated. And modified the specs to fail if it regresses

Copy link
Contributor

@sbeaulie sbeaulie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added some method comment to find_folder because I was confused at first how a nil value to the datacentername could return the first datacenter found. see commit.

@glennsarti glennsarti force-pushed the pooler-83-specify-datacenter branch from 0a775f0 to e580faf Compare June 20, 2017 16:21
@shrug
Copy link

shrug commented Jun 20, 2017

Looks like this needs a rebase

@glennsarti
Copy link
Contributor Author

There's always something :-)

@glennsarti glennsarti force-pushed the pooler-83-specify-datacenter branch from e580faf to 42b8bbc Compare June 20, 2017 22:45
glennsarti and others added 2 commits June 20, 2017 15:48
Previously the vsphere provider assumed that there was one and only one
datacenter (DC) in the vsphere instance.  However this is simply not true for
many vSphere installations.  This commit:
- Adds the ability to define a vSphere datacenter at the Pool or Provider level
  whereby the Pool setting takes precedence
- If no datacenter is specified the default behaviour of picking the first DC
  in the vSphere instance
- Updated all tests for the new setting
- Update the vmpooler configuration file example with relevant setting name
  and expected behaviour
- Fixed a bug in the rvmomi_helper whereby if no DC was found it would return
  all DCs.  This is opposite behaviour of the real RBVMOMI library as it returns
  nil
Specifically that the 3rd argument datacentername supports a 'nil' value, in which case the first datacenter is returned.
@glennsarti glennsarti force-pushed the pooler-83-specify-datacenter branch from 42b8bbc to 5355d1c Compare June 20, 2017 22:48
@glennsarti
Copy link
Contributor Author

Rebased.

@shrug shrug merged commit e5d2844 into puppetlabs:master Jun 27, 2017
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.

3 participants