Error in the return of command 'volume qos create'
This patch fixed a 'volume qos create' display mistake in argument of 'specs'[1]. For command such as: $ openstack volume qos create hello [1]https://bugs.launchpad.net/python-openstackclient/+bug/1656767 Closes-bug:#1656767 Change-Id: Ia9fce833d318d9b52b97c12cfb89e2d3c5465fbe
This commit is contained in:
		@@ -50,13 +50,13 @@ class QosTests(common.BaseVolumeTests):
 | 
			
		||||
        raw_output = self.openstack(
 | 
			
		||||
            'volume qos set --property a=b --property c=d ' + self.ID)
 | 
			
		||||
        self.assertEqual("", raw_output)
 | 
			
		||||
        opts = self.get_opts(['name', 'specs'])
 | 
			
		||||
        opts = self.get_opts(['name', 'properties'])
 | 
			
		||||
        raw_output = self.openstack('volume qos show ' + self.ID + opts)
 | 
			
		||||
        self.assertEqual(self.NAME + "\na='b', c='d'\n", raw_output)
 | 
			
		||||
 | 
			
		||||
        raw_output = self.openstack(
 | 
			
		||||
            'volume qos unset --property a ' + self.ID)
 | 
			
		||||
        self.assertEqual("", raw_output)
 | 
			
		||||
        opts = self.get_opts(['name', 'specs'])
 | 
			
		||||
        opts = self.get_opts(['name', 'properties'])
 | 
			
		||||
        raw_output = self.openstack('volume qos show ' + self.ID + opts)
 | 
			
		||||
        self.assertEqual(self.NAME + "\nc='d'\n", raw_output)
 | 
			
		||||
 
 | 
			
		||||
@@ -70,24 +70,26 @@ class TestQosAssociate(TestQos):
 | 
			
		||||
 | 
			
		||||
class TestQosCreate(TestQos):
 | 
			
		||||
 | 
			
		||||
    new_qos_spec = volume_fakes.FakeQos.create_one_qos()
 | 
			
		||||
    columns = (
 | 
			
		||||
        'consumer',
 | 
			
		||||
        'id',
 | 
			
		||||
        'name',
 | 
			
		||||
        'specs'
 | 
			
		||||
    )
 | 
			
		||||
    data = (
 | 
			
		||||
        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.qos_mock.create.return_value = self.new_qos_spec
 | 
			
		||||
 | 
			
		||||
        self.data = (
 | 
			
		||||
            self.new_qos_spec.consumer,
 | 
			
		||||
            self.new_qos_spec.id,
 | 
			
		||||
            self.new_qos_spec.name,
 | 
			
		||||
            utils.format_dict(self.new_qos_spec.specs)
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
        # Get the command object to test
 | 
			
		||||
        self.cmd = qos_specs.CreateQos(self.app, None)
 | 
			
		||||
 | 
			
		||||
@@ -147,11 +149,11 @@ class TestQosCreate(TestQos):
 | 
			
		||||
 | 
			
		||||
        columns, data = self.cmd.take_action(parsed_args)
 | 
			
		||||
 | 
			
		||||
        self.new_qos_spec.specs.update(
 | 
			
		||||
            {'consumer': self.new_qos_spec.consumer})
 | 
			
		||||
        self.qos_mock.create.assert_called_with(
 | 
			
		||||
            self.new_qos_spec.name,
 | 
			
		||||
            self.new_qos_spec.specs
 | 
			
		||||
            {'consumer': self.new_qos_spec.consumer,
 | 
			
		||||
             'foo': 'bar',
 | 
			
		||||
             'iops': '9001'}
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
        self.assertEqual(self.columns, columns)
 | 
			
		||||
@@ -307,7 +309,7 @@ class TestQosList(TestQos):
 | 
			
		||||
        'Name',
 | 
			
		||||
        'Consumer',
 | 
			
		||||
        'Associations',
 | 
			
		||||
        'Specs',
 | 
			
		||||
        'Properties',
 | 
			
		||||
    )
 | 
			
		||||
    data = []
 | 
			
		||||
    for q in qos_specs:
 | 
			
		||||
@@ -383,7 +385,7 @@ class TestQosShow(TestQos):
 | 
			
		||||
        'consumer',
 | 
			
		||||
        'id',
 | 
			
		||||
        'name',
 | 
			
		||||
        'specs'
 | 
			
		||||
        'properties'
 | 
			
		||||
    )
 | 
			
		||||
    data = (
 | 
			
		||||
        qos_association.name,
 | 
			
		||||
 
 | 
			
		||||
@@ -95,6 +95,9 @@ class CreateQos(command.ShowOne):
 | 
			
		||||
 | 
			
		||||
        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 +193,11 @@ 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 +260,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)))
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										5
									
								
								releasenotes/notes/bug-1656767-36a3d4b9fac335c9.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								releasenotes/notes/bug-1656767-36a3d4b9fac335c9.yaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
			
		||||
---
 | 
			
		||||
fixes:
 | 
			
		||||
  - |
 | 
			
		||||
    Fixed a ``volume qos create`` display mistake in argument of ``specs``.
 | 
			
		||||
    [Bug `1656767 <https://bugs.launchpad.net/python-openstackclient/+bug/1656767>`_]
 | 
			
		||||
		Reference in New Issue
	
	Block a user