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

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
This commit is contained in:
Glenn Sarti 2017-06-14 17:39:14 -07:00
parent 58b580d3eb
commit 7077eadc65
4 changed files with 483 additions and 175 deletions

View file

@ -6,6 +6,27 @@
# The currently supported backing services are:
# - vsphere
# - dummy
#
# - provider_class
# For multiple providers, specify one of the supported backing services (vsphere or dummy)
# (optional: will default to it's parent :key: name eg. 'vsphere')
#
# If you want to support more than one provider with different parameters (server, username or passwords) you have to specify the
# backing service in the provider_class configuration parameter for example 'vsphere' or 'dummy'. Each pool can specify
# the provider to use.
#
# Multiple providers example:
:vsphere-pdx:
server: 'vsphere.pdx.company.com'
username: 'vmpooler-pdx'
password: 'swimsw1msw!m'
provider_class: 'vsphere'
:vsphere-bfs:
server: 'vsphere.bfs.company.com'
username: 'vmpooler-bfs'
password: 'swimsw1msw!m'
provider_class: 'vsphere'
# :vsphere:
#
@ -33,9 +54,9 @@
# Whether to ignore any HTTPS negotiation errors (e.g. untrusted self-signed certificates)
# (optional: default true)
#
# - provider_class
# For multiple providers, specify one of the supported backing services (vsphere or dummy)
# (optional: will default to it's parent :key: name eg. 'vsphere')
# - datacenter
# The datacenter within vCenter to manage VMs. This can be overridden in the pool configuration
# (optional: default is the first datacenter in vSphere)
#
# Example:
@ -44,23 +65,6 @@
username: 'vmpooler'
password: 'swimsw1msw!m'
# If you want to support more than one provider with different parameters (server, username or passwords) you have to specify the
# backing service in the provider_class configuration parameter for example 'vsphere' or 'dummy'. Each pool can specify
# the provider to use.
#
# Multiple providers example:
:vsphere-pdx:
server: 'vsphere.pdx.company.com'
username: 'vmpooler-pdx'
password: 'swimsw1msw!m'
provider_class: 'vsphere'
:vsphere-bfs:
server: 'vsphere.bfs.company.com'
username: 'vmpooler-bfs'
password: 'swimsw1msw!m'
provider_class: 'vsphere'
# :dummy:
#
# The dummy backing service is a simple text file service that can be used
@ -465,6 +469,10 @@
# The vSphere 'datastore' destination for spawned clones.
# (required)
#
# - datacenter
# The datacenter within vCenter to manage VMs.
# (optional: default is the first datacenter in vSphere)
#
# Example:
:pools: