Show the backend store info

When running "glance -v image-list" there's no store info listed, so
user cannot know the type of the backend. This patch added an new option
"--include-stores" and is to add the store id to the output of "glance
image-list --include-stores".

The final output may like:
+-----+------+-------------+-----+----------+--------+-----+------+
| ID  | Name | Disk_format | ... | Size     | Status |Owner|Stores|
+-----+------+-------------+-----+----------+--------+-----+------+
| xxx | img1 | raw         | ... | 10737418 | active | xxx | ceph |
| xxx | img2 | raw         | ... | 5086345  | active | xxx | file |
+-----+------+-------------+-----+----------+--------+-----+------+

Change-Id: If86ef714c3aa03ce43ef29f26892f431f4766560
Co-authored-by: Jack Ding <jack.ding@windriver.com>
Signed-off-by: Liang Fang <liang.a.fang@intel.com>
This commit is contained in:
Liang Fang
2018-09-25 16:53:40 +08:00
parent a4ea9f0720
commit 5fb14f5ebb
2 changed files with 92 additions and 0 deletions
+10
View File
@@ -348,6 +348,13 @@ def do_image_update(gc, args):
const=True,
nargs='?',
help="Filters results by hidden status. Default=None.")
@utils.arg('--include-stores',
metavar='[True|False]',
default=None,
type=strutils.bool_from_string,
const=True,
nargs='?',
help="Print backend store id.")
def do_image_list(gc, args):
"""List images you can access."""
filter_keys = ['visibility', 'member_status', 'owner', 'checksum', 'tag',
@@ -384,6 +391,9 @@ def do_image_list(gc, args):
columns += ['Disk_format', 'Container_format', 'Size', 'Status',
'Owner']
if args.include_stores:
columns += ['Stores']
images = gc.images.list(**kwargs)
utils.print_list(images, columns)