Skip to content
This repository was archived by the owner on Nov 29, 2023. It is now read-only.

Commit 2e6be69

Browse files
committed
Show volume and snapshot data on create
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
1 parent 45bcdca commit 2e6be69

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

cinderclient/v1/shell.py

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ def _find_volume_snapshot(cs, snapshot):
6565
return utils.find_resource(cs.volume_snapshots, snapshot)
6666

6767

68-
def _print_volume(cs, volume):
68+
def _print_volume(volume):
6969
utils.print_dict(volume._info)
7070

7171

72-
def _print_volume_snapshot(cs, snapshot):
72+
def _print_volume_snapshot(snapshot):
7373
utils.print_dict(snapshot._info)
7474

7575

@@ -152,7 +152,7 @@ def do_list(cs, args):
152152
def do_show(cs, args):
153153
"""Show details about a volume."""
154154
volume = _find_volume(cs, args.volume)
155-
_print_volume(cs, volume)
155+
_print_volume(volume)
156156

157157

158158
@utils.arg('size',
@@ -221,14 +221,15 @@ def do_create(cs, args):
221221
if args.metadata is not None:
222222
volume_metadata = _extract_metadata(args.metadata)
223223

224-
cs.volumes.create(args.size,
225-
args.snapshot_id,
226-
args.display_name,
227-
args.display_description,
228-
args.volume_type,
229-
availability_zone=args.availability_zone,
230-
imageRef=args.image_id,
231-
metadata=volume_metadata)
224+
volume = cs.volumes.create(args.size,
225+
args.snapshot_id,
226+
args.display_name,
227+
args.display_description,
228+
args.volume_type,
229+
availability_zone=args.availability_zone,
230+
imageRef=args.image_id,
231+
metadata=volume_metadata)
232+
_print_volume(volume)
232233

233234

234235
@utils.arg('volume', metavar='<volume>', help='ID of the volume to delete.')
@@ -291,7 +292,7 @@ def do_snapshot_list(cs, args):
291292
def do_snapshot_show(cs, args):
292293
"""Show details about a snapshot."""
293294
snapshot = _find_volume_snapshot(cs, args.snapshot)
294-
_print_volume_snapshot(cs, snapshot)
295+
_print_volume_snapshot(snapshot)
295296

296297

297298
@utils.arg('volume_id',
@@ -322,10 +323,11 @@ def do_snapshot_show(cs, args):
322323
@utils.service_type('volume')
323324
def do_snapshot_create(cs, args):
324325
"""Add a new snapshot."""
325-
cs.volume_snapshots.create(args.volume_id,
326-
args.force,
327-
args.display_name,
328-
args.display_description)
326+
snapshot = cs.volume_snapshots.create(args.volume_id,
327+
args.force,
328+
args.display_name,
329+
args.display_description)
330+
_print_volume_snapshot(snapshot)
329331

330332

331333
@utils.arg('snapshot_id',

0 commit comments

Comments
 (0)