Merge "Support single-AZ deployment"

This commit is contained in:
Jenkins 2016-05-12 11:25:30 +00:00 committed by Gerrit Code Review
commit e6df59923f
2 changed files with 5 additions and 2 deletions

View File

@ -752,7 +752,7 @@ class NovaScenario(scenario.OpenStackScenario):
new_host = random.choice(
[key for key, value in six.iteritems(az.hosts)
if key != host and
value["nova-compute"]["available"] is True])
value.get("nova-compute", {}).get("available", False)])
return new_host
except IndexError:
raise exceptions.InvalidHostException(

View File

@ -633,6 +633,8 @@ class NovaScenarioTestCase(test.ScenarioTestCase):
def test__find_host_to_migrate(self):
fake_server = self.server
fake_host = {"nova-compute": {"available": True}}
fake_host_compute_off = {"nova-compute": {"available": False}}
fake_host_no_compute = {"nova-conductor": {"available": True}}
self.admin_clients("nova").servers.get.return_value = fake_server
self.admin_clients("nova").availability_zones.list.return_value = [
mock.MagicMock(zoneName="a",
@ -640,7 +642,8 @@ class NovaScenarioTestCase(test.ScenarioTestCase):
"a3": fake_host}),
mock.MagicMock(zoneName="b",
hosts={"b1": fake_host, "b2": fake_host,
"b3": fake_host}),
"b3": fake_host, "b4": fake_host_compute_off,
"b5": fake_host_no_compute}),
mock.MagicMock(zoneName="c",
hosts={"c1": fake_host,
"c2": fake_host, "c3": fake_host})