diff --git a/sahara/service/quotas.py b/sahara/service/quotas.py index 1c6d384c..563cfe45 100644 --- a/sahara/service/quotas.py +++ b/sahara/service/quotas.py @@ -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 diff --git a/sahara/tests/unit/service/test_quotas.py b/sahara/tests/unit/service/test_quotas.py index af8684dd..7f58cbf0 100644 --- a/sahara/tests/unit/service/test_quotas.py +++ b/sahara/tests/unit/service/test_quotas.py @@ -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))