OpenStackProvider: add option to specify region

This change adds "region" to the OpenStack provider options and uses it
when creating nova servers.

Change-Id: Ifc89fe4cf74a729ca59505ea0aacbc8c1e6daf86
This commit is contained in:
Angus Lees 2015-06-20 07:24:26 +10:00
parent d0f5a14006
commit 93874c6ba4
2 changed files with 4 additions and 1 deletions

View File

@ -69,6 +69,7 @@ class OpenStackProvider(provider.ProviderFactory):
"password": {"type": "string"},
"tenant": {"type": "string"},
"auth_url": {"type": "string"},
"region": {"type": "string"},
"flavor_id": {"type": "string"},
"image": {
"type": "object",
@ -105,7 +106,8 @@ class OpenStackProvider(provider.ProviderFactory):
def __init__(self, deployment, config):
super(OpenStackProvider, self).__init__(deployment, config)
user_endpoint = objects.Endpoint(config["auth_url"], config["user"],
config["password"], config["tenant"])
config["password"], config["tenant"],
region_name=config.get("region"))
clients = osclients.Clients(user_endpoint)
self.nova = clients.nova()
try:

View File

@ -5,6 +5,7 @@
"deployment_name": "Rally sample deployment",
"user": "admin",
"tenant": "admin",
"region": "RegionOne",
"flavor_id": "2",
"nics": [{"net-id": "97936015-128a-42f1-a3f2-1868ceeeeb6f"}],
"password": "admin",