[vmware] Add support for multiple VMware vCenetr clusters

Previously packstack didn't support multiple vCenter clusters. The
option CONFIG_VCENTER_CLUSTER_NAMES now ensures that if one cluster
is specified it gets mapped to all computes and if multiple clusters
are specified it'll map one cluster to one compute. This means that if
multiple clusters are specified it is required to have same number of
nova computes.

Change-Id: Ide73f21fca5e6f51bd43aafe4a2b8554b92b1a87
Resolves: rhbz#1110891
(cherry picked from commit 3e587856dd)
This commit is contained in:
Lukas Bezdicka 2015-11-09 14:53:51 +01:00 committed by Martin Mágr
parent b9e1360bb0
commit 916ff932d0
4 changed files with 39 additions and 9 deletions

View File

@ -110,8 +110,9 @@ vCenter Config Parameters
**CONFIG_VCENTER_PASSWORD**
The password to authenticate to VMware vCenter server
**CONFIG_VCENTER_CLUSTER_NAME**
The name of the vCenter cluster
**CONFIG_VCENTER_CLUSTER_NAMES**
Comma separated list of names of the VMware vCenter clusters.
Note: if multiple clusters are specified each one is mapped to one compute, otherwise all computes are mapped to same cluster.
Global unsupported options
--------------------------

View File

@ -518,6 +518,25 @@ def create_compute_manifest(config, messages):
config['SSH_KEYS'] = ssh_keys_details
ssh_hostkeys += getManifestTemplate("sshkey")
if config['CONFIG_VMWARE_BACKEND'] == 'y':
vcenters = [i.strip() for i in
config['CONFIG_VCENTER_CLUSTER_NAMES'].split(',')
if i.strip()]
if not vcenters:
raise exceptions.ParamValidationError(
"Please specify at least one VMware vCenter cluster in"
" CONFIG_VCENTER_CLUSTER_NAMES"
)
if len(vcenters) != len(compute_hosts):
if len(vcenters) > 1:
raise exceptions.ParamValidationError(
"Number of vmware clusters %s is not same"
" as number of nova computes %s", (vcenters, compute_hosts)
)
else:
vcenters = len(compute_hosts) * [vcenters[0]]
vmware_clusters = dict(zip(compute_hosts, vcenters))
for host in compute_hosts:
if config['CONFIG_IRONIC_INSTALL'] == 'y':
cm = 'ironic.nova.compute.manager.ClusteredComputeManager'
@ -540,6 +559,8 @@ def create_compute_manifest(config, messages):
manifestdata += createFirewallResources(cf_fw_qemu_mig_key)
if config['CONFIG_VMWARE_BACKEND'] == 'y':
manifestdata += ("\n$nova_vcenter_cluster_name = '%s'\n" %
vmware_clusters[host])
manifestdata += getManifestTemplate("nova_compute_vmware.pp")
elif config['CONFIG_IRONIC_INSTALL'] == 'y':
manifestdata += getManifestTemplate("nova_compute_ironic.pp")

View File

@ -568,16 +568,23 @@ def initConfig(controller):
"NEED_CONFIRM": False,
"CONDITION": False},
{"CMD_OPTION": "vcenter-cluster",
"USAGE": "The name of the vCenter cluster",
"PROMPT": "Enter the name of the vCenter datastore",
{"CMD_OPTION": "vcenter-clusters",
"USAGE": ("Comma separated list of names of the VMware vCenter "
"clusters. Note: if multiple clusters are specified "
"each one is mapped to one compute, otherwise all "
"computes are mapped to same cluster."),
"PROMPT": "Enter a comma separated list of vCenter datastores",
"DEFAULT_VALUE": "",
"OPTION_LIST": [],
"VALIDATORS": [],
"MASK_INPUT": False,
"LOOSE_VALIDATION": True,
"CONF_NAME": "CONFIG_VCENTER_CLUSTER_NAME",
"CONF_NAME": "CONFIG_VCENTER_CLUSTER_NAMES",
"USE_DEFAULT": False,
"NEED_CONFIRM": False,
"CONDITION": False},
"CONDITION": False,
"DEPRECATES": ['CONFIG_VCENTER_CLUSTER_NAME']},
],
"UNSUPPORTED": [

View File

@ -1,6 +1,7 @@
class { 'nova::compute::vmware':
class { '::nova::compute::vmware':
host_ip => hiera('CONFIG_VCENTER_HOST'),
host_username => hiera('CONFIG_VCENTER_USER'),
host_password => hiera('CONFIG_VCENTER_PASSWORD'),
cluster_name => hiera('CONFIG_VCENTER_CLUSTER_NAME'),
cluster_name => $nova_vcenter_cluster_name,
}