[Openstack-operators] how to get glance images for a specific tenant with the openstack client ?

Steve Martinelli stevemar at ca.ibm.com
Mon Jan 25 16:29:44 UTC 2016


You can also use `openstack image list --long` -- this should include the
owner ID (which is the project ID) and do some grepping and cutting for
that output. Not the cleanest, but it'll work.

$ openstack image list --long --format value | grep $project_id | cut -f 1
-d " "

Adding to Thomas' suggestion, you can use `--format value and -c ID` to
only get the image IDs

$ openstack image list --property owner=1ed19ee75d6840cf94cfb04e4405a25e
--format value -c ID
ab1629bc-692c-4947-b3f1-968cbdfcd55c
8360a76c-ee86-4a52-8735-d9a3b9f5ce3a
c12b0aff-2b88-4060-ae2b-3208e0edbd6c

Of course, if you feel strongly that there should be a `--project
<project_id>` option directly, then please report a bug:
https://bugs.launchpad.net/python-openstackclient/+filebug


Thomas Blank - Hetzner Online AG <thomas.blank at hetzner.de> wrote on
2016/01/25 10:49:34 AM:

> From: Thomas Blank - Hetzner Online AG <thomas.blank at hetzner.de>
> To: openstack-operators at lists.openstack.org
> Date: 2016/01/25 10:52 AM
> Subject: Re: [Openstack-operators] how to get glance images for a
> specific tenant with the openstack client ?
>
> Hey there,
>
> have you tried using the --property option of the openstack-client?
> You could filter images by their owner (openstack_project_id or name).
>
> "openstack image list --property owner=[openstack_project_id]"
>
> see:
>
> http://docs.openstack.org/developer/python-openstackclient/command-
> objects/image.html#cmdoption-image-list--property
>
> thomas blank,
>
>
>
> On 25.01.2016 16:19, Saverio Proto wrote:
> > Hello there,
> >
> > I need to delete some users  and tenants from my public cloud. Before
> > deleting the users and tenants from keystone, I need to delete all the
> > resources in the tenants.
> >
> > I am stucked listing the glance images uploaded in a specific tenant.
> > I cannot find the way, I always get either all the images in the
> > system, or just the ones of the active OS_TENANT_NAME
> >
> > openstack help image list
> > usage: openstack image list [-h] [-f {csv,json,table,value,yaml}]
> [-c COLUMN]
> >                             [--max-width <integer>] [--noindent]
> >                             [--quote {all,minimal,none,nonnumeric}]
> >                             [--public | --private | --shared]
> >                             [--property <key=value>] [--long]
> >                             [--sort <key>[:<direction>]]
> >
> > As a work around I can add a user with member role in the tenant, and
> > list in that way ... but, there is really no way to specifiy
> > --tenant=id in the openstack client ?
> >
> > thank you
> >
> > Saverio
> >
> > _______________________________________________
> > OpenStack-operators mailing list
> > OpenStack-operators at lists.openstack.org
> > http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-operators
> >
>
> _______________________________________________
> OpenStack-operators mailing list
> OpenStack-operators at lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-operators
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-operators/attachments/20160125/e421b3b5/attachment.html>


More information about the OpenStack-operators mailing list