Merge "Return complete response from limits,migration client"

This commit is contained in:
Jenkins 2015-08-29 06:05:16 +00:00 committed by Gerrit Code Review
commit 95181b2e2d
10 changed files with 38 additions and 31 deletions

View File

@ -111,7 +111,8 @@ class LiveBlockMigrationTestJSON(base.BaseV2ComputeAdminTest):
self._migrate_server_to(server_id, target_host)
waiters.wait_for_server_status(self.servers_client, server_id, state)
migration_list = self.admin_migration_client.list_migrations()
migration_list = (self.admin_migration_client.list_migrations()
['migrations'])
msg = ("Live Migration failed. Migrations list for Instance "
"%s: [" % server_id)

View File

@ -49,7 +49,7 @@ class MigrationsAdminTest(base.BaseV2ComputeAdminTest):
waiters.wait_for_server_status(self.servers_client,
server_id, 'ACTIVE')
body = self.client.list_migrations()
body = self.client.list_migrations()['migrations']
instance_uuids = [x['instance_uuid'] for x in body]
self.assertIn(server_id, instance_uuids)

View File

@ -116,7 +116,7 @@ class QuotasAdminNegativeTestJSON(base.BaseV2ComputeAdminTest):
default_sg_quota = quota_set['security_groups']
# Set the quota to number of used security groups
sg_quota = self.limits_client.show_limits()['absolute'][
sg_quota = self.limits_client.show_limits()['limits']['absolute'][
'totalSecurityGroupsUsed']
self.adm_client.update_quota_set(self.demo_tenant_id,

View File

@ -27,7 +27,7 @@ class AbsoluteLimitsTestJSON(base.BaseV2ComputeTest):
@test.idempotent_id('b54c66af-6ab6-4cf0-a9e5-a0cb58d75e0b')
def test_absLimits_get(self):
# To check if all limits are present in the response
limits = self.client.show_limits()
limits = self.client.show_limits()['limits']
absolute_limits = limits['absolute']
expected_elements = ['maxImageMeta', 'maxPersonality',
'maxPersonalitySize',

View File

@ -38,7 +38,7 @@ class AbsoluteLimitsNegativeTestJSON(base.BaseV2ComputeTest):
def test_max_image_meta_exceed_limit(self):
# We should not create vm with image meta over maxImageMeta limit
# Get max limit value
limits = self.client.show_limits()
limits = self.client.show_limits()['limits']
max_meta = limits['absolute']['maxImageMeta']
# No point in running this test if there is no limit.

View File

@ -34,7 +34,7 @@ class ServerPersonalityTestJSON(base.BaseV2ComputeTest):
# number of files are injected into the server.
file_contents = 'This is a test file.'
personality = []
limits = self.user_client.show_limits()
limits = self.user_client.show_limits()['limits']
max_file_limit = limits['absolute']['maxPersonality']
if max_file_limit == -1:
raise self.skipException("No limit for personality files")
@ -52,7 +52,7 @@ class ServerPersonalityTestJSON(base.BaseV2ComputeTest):
# Server should be created successfully if maximum allowed number of
# files is injected into the server during creation.
file_contents = 'This is a test file.'
limits = self.user_client.show_limits()
limits = self.user_client.show_limits()['limits']
max_file_limit = limits['absolute']['maxPersonality']
if max_file_limit == -1:
raise self.skipException("No limit for personality files")

View File

@ -372,7 +372,7 @@ class NovaQuotaService(BaseService):
def dry_run(self):
client = self.limits_client
quotas = client.show_limits()
quotas = client.show_limits()['limits']
self.data['compute_quotas'] = quotas['absolute']

View File

@ -25,4 +25,4 @@ class LimitsClient(service_client.ServiceClient):
resp, body = self.get("limits")
body = json.loads(body)
self.validate_response(schema.get_limit, resp, body)
return service_client.ResponseBody(resp, body['limits'])
return service_client.ResponseBody(resp, body)

View File

@ -31,4 +31,4 @@ class MigrationsClient(service_client.ServiceClient):
resp, body = self.get(url)
body = json.loads(body)
self.validate_response(schema.list_migrations, resp, body)
return service_client.ResponseBodyList(resp, body['migrations'])
return service_client.ResponseBody(resp, body)

View File

@ -31,27 +31,33 @@ class TestLimitsClient(base.TestCase):
fake_auth, 'compute', 'regionOne')
def _test_show_limits(self, bytes_body=False):
expected = {"rate": [],
"absolute": {"maxServerMeta": 128,
"maxPersonality": 5,
"totalServerGroupsUsed": 0,
"maxImageMeta": 128,
"maxPersonalitySize": 10240,
"maxServerGroups": 10,
"maxSecurityGroupRules": 20,
"maxTotalKeypairs": 100,
"totalCoresUsed": 0,
"totalRAMUsed": 0,
"totalInstancesUsed": 0,
"maxSecurityGroups": 10,
"totalFloatingIpsUsed": 0,
"maxTotalCores": 20,
"totalSecurityGroupsUsed": 0,
"maxTotalFloatingIps": 10,
"maxTotalInstances": 10,
"maxTotalRAMSize": 51200,
"maxServerGroupMembers": 10}}
serialized_body = json.dumps({"limits": expected})
expected = {
"limits": {
"rate": [],
"absolute": {
"maxServerMeta": 128,
"maxPersonality": 5,
"totalServerGroupsUsed": 0,
"maxImageMeta": 128,
"maxPersonalitySize": 10240,
"maxServerGroups": 10,
"maxSecurityGroupRules": 20,
"maxTotalKeypairs": 100,
"totalCoresUsed": 0,
"totalRAMUsed": 0,
"totalInstancesUsed": 0,
"maxSecurityGroups": 10,
"totalFloatingIpsUsed": 0,
"maxTotalCores": 20,
"totalSecurityGroupsUsed": 0,
"maxTotalFloatingIps": 10,
"maxTotalInstances": 10,
"maxTotalRAMSize": 51200,
"maxServerGroupMembers": 10
}
}
}
serialized_body = json.dumps(expected)
if bytes_body:
serialized_body = serialized_body.encode('utf-8')