How to filter Servers list by metadata value using python-novaclient?

asked 2014-01-27 05:24:54 -0500

Ahmed Samir gravatar image

I'm trying to filter the servers list by metadata value that is already set to all running instances. this is all servers :

[<server: admin="">, <server: t3="">, <server: t2="">] and all of them have these meta values [{u'dr': u'0'}, {u'dr': u'1'}, {u'dr': u'1'}]

is it possible to filter if 'dr' = 1 only I've tried to send search_opts to list() function like this:

        search_opts = {'dr':'1'}
        new_list = obj.nova.servers.list(search_opts)
        print new_list

but it gives me all servers it should return <server: t3="">, <server: t2=""> only.

python-novaclient list()

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2015-05-15 05:36:12 -0500

Hi Ahmed,

Probably you've already solved the issue by yourself, since the post is quite old, but just in case:

The correct API call would be:

new_list = obj.nova.servers.list(search_opts = search_opts)

Regards Gracia

edit flag offensive delete link more

Get to know Ask OpenStack

Resources for moderators

Question Tools

2 followers

Stats

Asked: 2014-01-27 05:24:54 -0500

Seen: 1,393 times

Last updated: Jan 27 '14