Get rid of normalization in compute CL
Stop using normalization in the compute cloud layer. Change-Id: I987161bfdedf837298dfa56173bfdd07d066cbbf
This commit is contained in:
@@ -163,7 +163,7 @@ class ComputeCloudMixin(_normalize.Normalizer):
|
||||
def list_server_security_groups(self, server):
|
||||
"""List all security groups associated with the given server.
|
||||
|
||||
:returns: A list of security group ``munch.Munch``.
|
||||
:returns: A list of security group dictionary objects.
|
||||
"""
|
||||
|
||||
# Don't even try if we're a cloud that doesn't have them
|
||||
@@ -174,7 +174,7 @@ class ComputeCloudMixin(_normalize.Normalizer):
|
||||
|
||||
server.fetch_security_groups(self.compute)
|
||||
|
||||
return self._normalize_secgroups(server.security_groups)
|
||||
return server.security_groups
|
||||
|
||||
def _get_server_security_groups(self, server, security_groups):
|
||||
if not self._has_secgroups():
|
||||
@@ -319,17 +319,11 @@ class ComputeCloudMixin(_normalize.Normalizer):
|
||||
def _list_servers(self, detailed=False, all_projects=False, bare=False,
|
||||
filters=None):
|
||||
filters = filters or {}
|
||||
servers = [
|
||||
# TODO(mordred) Add original_names=False here and update the
|
||||
# normalize file for server. Then, just remove the normalize call
|
||||
# and the to_munch call.
|
||||
self._normalize_server(server._to_munch())
|
||||
for server in self.compute.servers(
|
||||
all_projects=all_projects, allow_unknown_params=True,
|
||||
**filters)]
|
||||
return [
|
||||
self._expand_server(server, detailed, bare)
|
||||
for server in servers
|
||||
for server in self.compute.servers(
|
||||
all_projects=all_projects, allow_unknown_params=True,
|
||||
**filters)
|
||||
]
|
||||
|
||||
def list_server_groups(self):
|
||||
@@ -347,7 +341,7 @@ class ComputeCloudMixin(_normalize.Normalizer):
|
||||
if different from the current project
|
||||
:raises: OpenStackCloudException if it's not a valid project
|
||||
|
||||
:returns: Munch object with the limits
|
||||
:returns: :class:`~openstack.compute.v2.limits.Limits` object.
|
||||
"""
|
||||
params = {}
|
||||
project_id = None
|
||||
@@ -358,8 +352,7 @@ class ComputeCloudMixin(_normalize.Normalizer):
|
||||
raise exc.OpenStackCloudException("project does not exist")
|
||||
project_id = proj.id
|
||||
params['tenant_id'] = project_id
|
||||
limits = self.compute.get_limits(**params)
|
||||
return self._normalize_compute_limits(limits, project_id=project_id)
|
||||
return self.compute.get_limits(**params)
|
||||
|
||||
def get_keypair(self, name_or_id, filters=None):
|
||||
"""Get a keypair by name or ID.
|
||||
@@ -1421,8 +1414,7 @@ class ComputeCloudMixin(_normalize.Normalizer):
|
||||
|
||||
:raises: OpenStackCloudException on operation error.
|
||||
"""
|
||||
access = self.compute.get_flavor_access(flavor_id)
|
||||
return _utils.normalize_flavor_accesses(access)
|
||||
return self.compute.get_flavor_access(flavor_id)
|
||||
|
||||
def list_hypervisors(self, filters={}):
|
||||
"""List all hypervisors
|
||||
|
||||
@@ -129,7 +129,7 @@ class TestFlavor(base.BaseFunctionalTest):
|
||||
# the demo_cloud access.
|
||||
acls = self.operator_cloud.list_flavor_access(new_flavor['id'])
|
||||
self.assertEqual(1, len(acls))
|
||||
self.assertEqual(project['id'], acls[0]['project_id'])
|
||||
self.assertEqual(project['id'], acls[0]['tenant_id'])
|
||||
|
||||
# Now revoke the access and make sure we can't find it
|
||||
self.operator_cloud.remove_flavor_access(new_flavor['id'],
|
||||
|
||||
@@ -47,10 +47,7 @@ class TestInventory(base.BaseFunctionalTest):
|
||||
|
||||
def _test_host_content(self, host):
|
||||
self.assertEqual(host['image']['id'], self.image.id)
|
||||
self.assertNotIn('links', host['image'])
|
||||
self.assertNotIn('id', host['flavor'])
|
||||
self.assertNotIn('links', host['flavor'])
|
||||
self.assertNotIn('links', host)
|
||||
self.assertIsInstance(host['volumes'], list)
|
||||
self.assertIsInstance(host['metadata'], dict)
|
||||
self.assertIn('interface_ip', host)
|
||||
|
||||
@@ -16,6 +16,7 @@ test_limits
|
||||
|
||||
Functional tests for `shade` limits method
|
||||
"""
|
||||
from openstack.compute.v2 import limits as _limits
|
||||
from openstack.tests.functional import base
|
||||
|
||||
|
||||
@@ -25,27 +26,27 @@ class TestUsage(base.BaseFunctionalTest):
|
||||
'''Test quotas functionality'''
|
||||
limits = self.user_cloud.get_compute_limits()
|
||||
self.assertIsNotNone(limits)
|
||||
self.assertTrue(hasattr(limits, 'max_server_meta'))
|
||||
|
||||
# Test normalize limits
|
||||
self.assertFalse(hasattr(limits, 'maxImageMeta'))
|
||||
self.assertIsInstance(limits, _limits.Limits)
|
||||
self.assertIsNotNone(limits.absolute.server_meta)
|
||||
self.assertIsNotNone(limits.absolute.image_meta)
|
||||
|
||||
def test_get_other_compute_limits(self):
|
||||
'''Test quotas functionality'''
|
||||
limits = self.operator_cloud.get_compute_limits('demo')
|
||||
self.assertIsNotNone(limits)
|
||||
self.assertTrue(hasattr(limits, 'max_server_meta'))
|
||||
self.assertTrue(hasattr(limits.absolute, 'server_meta'))
|
||||
|
||||
# Test normalize limits
|
||||
self.assertFalse(hasattr(limits, 'maxImageMeta'))
|
||||
self.assertFalse(hasattr(limits.absolute, 'maxImageMeta'))
|
||||
|
||||
def test_get_our_volume_limits(self):
|
||||
'''Test quotas functionality'''
|
||||
limits = self.user_cloud.get_volume_limits()
|
||||
self.assertIsNotNone(limits)
|
||||
self.assertFalse(hasattr(limits, 'maxTotalVolumes'))
|
||||
self.assertFalse(hasattr(limits.absolute, 'maxTotalVolumes'))
|
||||
|
||||
def test_get_other_volume_limits(self):
|
||||
'''Test quotas functionality'''
|
||||
limits = self.operator_cloud.get_volume_limits('demo')
|
||||
self.assertFalse(hasattr(limits, 'maxTotalVolumes'))
|
||||
self.assertFalse(hasattr(limits.absolute, 'maxTotalVolumes'))
|
||||
|
||||
@@ -623,9 +623,8 @@ class TestSecurityGroups(base.TestCase):
|
||||
json={'security_groups': [nova_grp_dict]}),
|
||||
])
|
||||
groups = self.cloud.list_server_security_groups(server)
|
||||
self.assertIn('location', groups[0])
|
||||
self.assertEqual(
|
||||
groups[0]['security_group_rules'][0]['remote_ip_prefix'],
|
||||
groups[0]['rules'][0]['ip_range']['cidr'],
|
||||
nova_grp_dict['rules'][0]['ip_range']['cidr'])
|
||||
|
||||
self.assert_calls()
|
||||
|
||||
Reference in New Issue
Block a user