Remove unused attribute when updating quota_class

When updating quota class, attribute 'class_name' is
neither used in the request nor the response [1].

[1]:
https://github.com/openstack/cinder/blob/master/cinder/api/contrib/quota_classes.py#L56

Change-Id: Ic1a743ce36a087f369703f10313d51b79b5cab9c
This commit is contained in:
TommyLike
2017-08-18 15:12:23 +08:00
parent b7d3468460
commit 2c05b83a8c
3 changed files with 6 additions and 8 deletions

View File

@@ -677,10 +677,8 @@ class FakeHTTPClient(base_client.HTTPClient):
def put_os_quota_class_sets_test(self, body, **kw): def put_os_quota_class_sets_test(self, body, **kw):
assert list(body) == ['quota_class_set'] assert list(body) == ['quota_class_set']
fakes.assert_has_keys(body['quota_class_set'], fakes.assert_has_keys(body['quota_class_set'])
required=['class_name'])
return (200, {}, {'quota_class_set': { return (200, {}, {'quota_class_set': {
'class_name': 'test',
'volumes': 2, 'volumes': 2,
'snapshots': 2, 'snapshots': 2,
'gigabytes': 1, 'gigabytes': 1,

View File

@@ -1392,8 +1392,7 @@ class ShellTest(utils.TestCase):
self.assert_called('GET', '/os-quota-class-sets/test') self.assert_called('GET', '/os-quota-class-sets/test')
def test_quota_class_update(self): def test_quota_class_update(self):
expected = {'quota_class_set': {'class_name': 'test', expected = {'quota_class_set': {'volumes': 2,
'volumes': 2,
'snapshots': 2, 'snapshots': 2,
'gigabytes': 1, 'gigabytes': 1,
'backups': 1, 'backups': 1,

View File

@@ -35,12 +35,13 @@ class QuotaClassSetManager(base.Manager):
"quota_class_set") "quota_class_set")
def update(self, class_name, **updates): def update(self, class_name, **updates):
body = {'quota_class_set': {'class_name': class_name}} quota_class_set = {}
for update in updates: for update in updates:
body['quota_class_set'][update] = updates[update] quota_class_set[update] = updates[update]
result = self._update('/os-quota-class-sets/%s' % (class_name), body) result = self._update('/os-quota-class-sets/%s' % (class_name),
{'quota_class_set': quota_class_set})
return self.resource_class(self, return self.resource_class(self,
result['quota_class_set'], loaded=True, result['quota_class_set'], loaded=True,
resp=result.request_ids) resp=result.request_ids)