[glance] Listing all images with a set of custom properties

Nadathur, Sundar sundar.nadathur at intel.com
Thu Apr 11 17:33:48 UTC 2019


Thanks, Brian. I'll go with that.

Regards,
Sundar

> -----Original Message-----
> From: Brian Rosmaita <rosmaita.fossdev at gmail.com>
> Sent: Thursday, April 11, 2019 6:42 AM
> To: openstack-discuss at lists.openstack.org
> Subject: Re: [glance] Listing all images with a set of custom properties
> 
> On 4/10/19 8:42 PM, Nadathur, Sundar wrote:
> > I am looking for a way to programmatically get all images that have
> > been associated with a set of custom properties. Ideally, I should be
> > able to say 'give me all images that have key1=value1, key2=value2, etc.
> 
> Create a dict of the properties you are interested in, for example,
> 
>   filters = {'key1': 'value1', 'key2': 'value2'}
> 
> and then pass it as the value of the 'filters' argument to the 'list' call:
> 
>   image_list_generator = glance.list(filters=filters)
> 
> You can have both "regular" and custom image properties as keys in the
> filters dict.
> 
> > Failing that, at least get all images that have the named keys key1,
> > key2, etc. irrespective of their values, so I can filter for the
> > values myself.
> 
> I don't think there's a way to do this, actually.  I'm pretty sure it's not
> supported by the Images API.
> 
> > I was looking at [1], specifically [2], and came up short. Any
> > recommendations?
> >
> > [1]
> > https://github.com/openstack/python-glanceclient/tree/master/glancecli
> > ent/v2
> >
> >
> > [2]
> > https://github.com/openstack/python-glanceclient/blob/master/glancecli
> > ent/v2/images.py#L86
> 
> It shows up a bit later:
> https://github.com/openstack/python-
> glanceclient/blob/master/glanceclient/v2/images.py#L136
> 
> > Regards,
> >
> > Sundar
> 
> cheers,
> brian
> 



More information about the openstack-discuss mailing list