Skip to content

Commit

Permalink
Show volume and snapshot data on create
Browse files Browse the repository at this point in the history
cinder create and cinder snapshot-create do not display the data
returned from the api. This makes it difficult to find the id of
of the newly created object.

Fixes bug 1053432

Change-Id: I1defafff3fd08f9b3510f70a455d49d470322d82
  • Loading branch information
vishvananda committed Sep 20, 2012
1 parent 45bcdca commit 2e6be69
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions cinderclient/v1/shell.py
Expand Up @@ -65,11 +65,11 @@ def _find_volume_snapshot(cs, snapshot):
return utils.find_resource(cs.volume_snapshots, snapshot)


def _print_volume(cs, volume):
def _print_volume(volume):
utils.print_dict(volume._info)


def _print_volume_snapshot(cs, snapshot):
def _print_volume_snapshot(snapshot):
utils.print_dict(snapshot._info)


Expand Down Expand Up @@ -152,7 +152,7 @@ def do_list(cs, args):
def do_show(cs, args):
"""Show details about a volume."""
volume = _find_volume(cs, args.volume)
_print_volume(cs, volume)
_print_volume(volume)


@utils.arg('size',
Expand Down Expand Up @@ -221,14 +221,15 @@ def do_create(cs, args):
if args.metadata is not None:
volume_metadata = _extract_metadata(args.metadata)

cs.volumes.create(args.size,
args.snapshot_id,
args.display_name,
args.display_description,
args.volume_type,
availability_zone=args.availability_zone,
imageRef=args.image_id,
metadata=volume_metadata)
volume = cs.volumes.create(args.size,
args.snapshot_id,
args.display_name,
args.display_description,
args.volume_type,
availability_zone=args.availability_zone,
imageRef=args.image_id,
metadata=volume_metadata)
_print_volume(volume)


@utils.arg('volume', metavar='<volume>', help='ID of the volume to delete.')
Expand Down Expand Up @@ -291,7 +292,7 @@ def do_snapshot_list(cs, args):
def do_snapshot_show(cs, args):
"""Show details about a snapshot."""
snapshot = _find_volume_snapshot(cs, args.snapshot)
_print_volume_snapshot(cs, snapshot)
_print_volume_snapshot(snapshot)


@utils.arg('volume_id',
Expand Down Expand Up @@ -322,10 +323,11 @@ def do_snapshot_show(cs, args):
@utils.service_type('volume')
def do_snapshot_create(cs, args):
"""Add a new snapshot."""
cs.volume_snapshots.create(args.volume_id,
args.force,
args.display_name,
args.display_description)
snapshot = cs.volume_snapshots.create(args.volume_id,
args.force,
args.display_name,
args.display_description)
_print_volume_snapshot(snapshot)


@utils.arg('snapshot_id',
Expand Down

0 comments on commit 2e6be69

Please sign in to comment.