Fix properties format for volume qos in volume v1

Notice that patch [1] fixed the error of properties
format for volume qos in volume v2, but there is the
same bug in volume v1, and the patch missed that, so
fix the problem in v1 as well

[1] https://review.openstack.org/#/c/421065/

Partial-Bug: #1656767
Change-Id: I156bf13d164dbd0d0a7ce394964176718c4ff0e5
This commit is contained in:
Huanxuan Ao 2017-02-03 15:13:52 +08:00
parent bc4a3f467f
commit 1be6c2d92f
3 changed files with 20 additions and 16 deletions

View File

@ -94,7 +94,7 @@ class QosTests(common.BaseVolumeTests):
)
self.assertEqual(
"Alpha='c', Beta='b'",
cmd_output['specs']
cmd_output['properties']
)
# Test volume qos unset
@ -115,7 +115,7 @@ class QosTests(common.BaseVolumeTests):
)
self.assertEqual(
"Beta='b'",
cmd_output['specs']
cmd_output['properties']
)
# TODO(qiangjiahui): Add tests for associate and disassociate volume type

View File

@ -70,23 +70,22 @@ class TestQosAssociate(TestQos):
class TestQosCreate(TestQos):
new_qos_spec = volume_fakes.FakeQos.create_one_qos()
columns = (
'consumer',
'id',
'name',
'specs'
)
datalist = (
new_qos_spec.consumer,
new_qos_spec.id,
new_qos_spec.name,
new_qos_spec.specs
'properties'
)
def setUp(self):
super(TestQosCreate, self).setUp()
self.new_qos_spec = volume_fakes.FakeQos.create_one_qos()
self.datalist = (
self.new_qos_spec.consumer,
self.new_qos_spec.id,
self.new_qos_spec.name,
utils.format_dict(self.new_qos_spec.specs)
)
self.qos_mock.create.return_value = self.new_qos_spec
# Get the command object to test
self.cmd = qos_specs.CreateQos(self.app, None)
@ -336,7 +335,7 @@ class TestQosList(TestQos):
'Name',
'Consumer',
'Associations',
'Specs',
'Properties',
)
self.assertEqual(collist, columns)
datalist = ((
@ -413,7 +412,7 @@ class TestQosShow(TestQos):
'consumer',
'id',
'name',
'specs'
'properties'
)
self.assertEqual(collist, columns)
datalist = (

View File

@ -94,7 +94,9 @@ class CreateQos(command.ShowOne):
specs.update(parsed_args.property)
qos_spec = volume_client.qos_specs.create(parsed_args.name, specs)
qos_spec._info.update(
{'properties': utils.format_dict(qos_spec._info.pop('specs'))}
)
return zip(*sorted(six.iteritems(qos_spec._info)))
@ -190,8 +192,10 @@ class ListQos(command.Lister):
for association in qos_associations]
qos._info.update({'associations': associations})
display_columns = (
'ID', 'Name', 'Consumer', 'Associations', 'Properties')
columns = ('ID', 'Name', 'Consumer', 'Associations', 'Specs')
return (columns,
return (display_columns,
(utils.get_dict_properties(
s._info, columns,
formatters={
@ -254,7 +258,8 @@ class ShowQos(command.ShowOne):
qos_spec._info.update({
'associations': utils.format_list(associations)
})
qos_spec._info.update({'specs': utils.format_dict(qos_spec.specs)})
qos_spec._info.update(
{'properties': utils.format_dict(qos_spec._info.pop('specs'))})
return zip(*sorted(six.iteritems(qos_spec._info)))