Merge "Fix properties format for volume qos in volume v1"

This commit is contained in:
Jenkins 2017-02-21 19:49:16 +00:00 committed by Gerrit Code Review
commit 62938c02e0
3 changed files with 20 additions and 16 deletions

View File

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

View File

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

View File

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