Add volume type show for volume v1

volume type show is missing for volume V1 API.

Closes-Bug: #1475879
Change-Id: Ic8a0845ecec04146d536412463175f57ef6511ae
This commit is contained in:
jiaxi 2015-07-19 03:07:02 -04:00 committed by Steve Martinelli
parent fcadb16470
commit e30ebfeb17
2 changed files with 25 additions and 0 deletions

View File

@ -182,3 +182,27 @@ class UnsetVolumeType(command.Command):
else:
self.app.log.error("No changes requested\n")
return
class ShowVolumeType(show.ShowOne):
"""Display volume type details"""
log = logging.getLogger(__name__ + ".ShowVolumeType")
def get_parser(self, prog_name):
parser = super(ShowVolumeType, self).get_parser(prog_name)
parser.add_argument(
"volume_type",
metavar="<volume-type>",
help="Volume type to display (name or ID)"
)
return parser
def take_action(self, parsed_args):
self.log.debug("take_action: (%s)", parsed_args)
volume_client = self.app.client_manager.volume
volume_type = utils.find_resource(
volume_client.volume_types, parsed_args.volume_type)
properties = utils.format_dict(volume_type._info.pop('extra_specs'))
volume_type._info.update({'properties': properties})
return zip(*sorted(six.iteritems(volume_type._info)))

View File

@ -365,6 +365,7 @@ openstack.volume.v1 =
volume_type_list = openstackclient.volume.v1.type:ListVolumeType
volume_type_set = openstackclient.volume.v1.type:SetVolumeType
volume_type_unset = openstackclient.volume.v1.type:UnsetVolumeType
volume_type_show = openstackclient.volume.v1.type:ShowVolumeType
volume_qos_associate = openstackclient.volume.v1.qos_specs:AssociateQos
volume_qos_create = openstackclient.volume.v1.qos_specs:CreateQos