Fix check cinder quotas

This patch adds check that cinder endpoint exists in catalog when
checking cinder quotas.

Change-Id: I2faa39b2fa1e5648a9924980ca0b0384b14b4540
Closes-bug: #1636496
This commit is contained in:
Sergey Reshetnyak 2016-10-25 16:13:29 +03:00
parent ce29d9b8ba
commit f7745ff996
2 changed files with 5 additions and 2 deletions

View File

@ -126,7 +126,8 @@ def _get_avail_limits():
limits = _get_zero_limits()
limits.update(_get_nova_limits())
limits.update(_get_neutron_limits())
limits.update(_get_cinder_limits())
if cinder_client.check_cinder_exists():
limits.update(_get_cinder_limits())
return limits

View File

@ -246,13 +246,15 @@ class TestQuotas(base.SaharaTestCase):
'security_groups': 1516},
quotas._get_neutron_limits())
@mock.patch("sahara.utils.openstack.cinder.check_cinder_exists",
return_value=True)
@mock.patch('sahara.utils.openstack.nova.client',
return_value=FakeNovaClient(nova_limits))
@mock.patch('sahara.utils.openstack.cinder.client',
return_value=FakeCinderClient(cinder_limits))
@mock.patch('sahara.utils.openstack.neutron.client',
return_value=FakeNeutronClient(neutron_limits))
def test_limits_for_cluster(self, p1, p2, p3):
def test_limits_for_cluster(self, p1, p2, p3, p4):
ng = [FakeNodeGroup(1, False, 0, 0, None, 'id1', [1, 2, 3])]
quotas.check_cluster(FakeCluster(ng))