Add "consistency group show" command
Add "consistency group show" command in volume v2 (v2 only). Change-Id: If496eba2955c0aacd52600bb6fba39690ddd90cb Implements: bp cinder-command-support Partial-Bug: #1613964
This commit is contained in:
parent
094e5189b7
commit
1907220113
@ -81,3 +81,20 @@ List consistency groups.
|
||||
.. option:: --long
|
||||
|
||||
List additional fields in output
|
||||
|
||||
consistency group show
|
||||
----------------------
|
||||
|
||||
Display consistency group details.
|
||||
|
||||
.. program:: consistency group show
|
||||
.. code:: bash
|
||||
|
||||
os consistency group show
|
||||
<consistency-group>
|
||||
|
||||
.. _consistency_group_show-consistency-group:
|
||||
.. describe:: <consistency-group>
|
||||
|
||||
Consistency group to display (name or ID)
|
||||
|
||||
|
@ -353,3 +353,46 @@ class TestConsistencyGroupList(TestConsistencyGroup):
|
||||
detailed=True, search_opts={'all_tenants': False})
|
||||
self.assertEqual(self.columns_long, columns)
|
||||
self.assertEqual(self.data_long, list(data))
|
||||
|
||||
|
||||
class TestConsistencyGroupShow(TestConsistencyGroup):
|
||||
columns = (
|
||||
'availability_zone',
|
||||
'created_at',
|
||||
'description',
|
||||
'id',
|
||||
'name',
|
||||
'status',
|
||||
'volume_types',
|
||||
)
|
||||
|
||||
def setUp(self):
|
||||
super(TestConsistencyGroupShow, self).setUp()
|
||||
|
||||
self.consistency_group = (
|
||||
volume_fakes.FakeConsistencyGroup.create_one_consistency_group())
|
||||
self.data = (
|
||||
self.consistency_group.availability_zone,
|
||||
self.consistency_group.created_at,
|
||||
self.consistency_group.description,
|
||||
self.consistency_group.id,
|
||||
self.consistency_group.name,
|
||||
self.consistency_group.status,
|
||||
self.consistency_group.volume_types,
|
||||
)
|
||||
self.consistencygroups_mock.get.return_value = self.consistency_group
|
||||
self.cmd = consistency_group.ShowConsistencyGroup(self.app, None)
|
||||
|
||||
def test_consistency_group_show(self):
|
||||
arglist = [
|
||||
self.consistency_group.id
|
||||
]
|
||||
verifylist = [
|
||||
("consistency_group", self.consistency_group.id)
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
self.consistencygroups_mock.get.assert_called_once_with(
|
||||
self.consistency_group.id)
|
||||
self.assertEqual(self.columns, columns)
|
||||
self.assertEqual(self.data, data)
|
||||
|
@ -23,6 +23,7 @@ import six
|
||||
|
||||
from openstackclient.i18n import _
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -177,3 +178,23 @@ class ListConsistencyGroup(command.Lister):
|
||||
s, columns,
|
||||
formatters={'Volume Types': utils.format_list})
|
||||
for s in consistency_groups))
|
||||
|
||||
|
||||
class ShowConsistencyGroup(command.ShowOne):
|
||||
_description = _("Display consistency group details.")
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(ShowConsistencyGroup, self).get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
"consistency_group",
|
||||
metavar="<consistency-group>",
|
||||
help=_("Consistency group to display (name or ID)")
|
||||
)
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
volume_client = self.app.client_manager.volume
|
||||
consistency_group = utils.find_resource(
|
||||
volume_client.consistencygroups,
|
||||
parsed_args.consistency_group)
|
||||
return zip(*sorted(six.iteritems(consistency_group._info)))
|
||||
|
@ -4,3 +4,5 @@ features:
|
||||
[Bug `1613964 <https://bugs.launchpad.net/python-openstackclient/+bug/1613964>`_]
|
||||
- Add ``consistency group delete`` command in volume v2.
|
||||
[Bug `1613964 <https://bugs.launchpad.net/python-openstackclient/+bug/1613964>`_]
|
||||
- Add ``consistency group show`` command in volume v2.
|
||||
[Bug `1613964 <https://bugs.launchpad.net/python-openstackclient/+bug/1613964>`_]
|
||||
|
@ -511,6 +511,7 @@ openstack.volume.v2 =
|
||||
consistency_group_create = openstackclient.volume.v2.consistency_group:CreateConsistencyGroup
|
||||
consistency_group_delete = openstackclient.volume.v2.consistency_group:DeleteConsistencyGroup
|
||||
consistency_group_list = openstackclient.volume.v2.consistency_group:ListConsistencyGroup
|
||||
consistency_group_show = openstackclient.volume.v2.consistency_group:ShowConsistencyGroup
|
||||
|
||||
consistency_group_snapshot_create = openstackclient.volume.v2.consistency_group_snapshot:CreateConsistencyGroupSnapshot
|
||||
consistency_group_snapshot_delete = openstackclient.volume.v2.consistency_group_snapshot:DeleteConsistencyGroupSnapshot
|
||||
|
Loading…
Reference in New Issue
Block a user