Ask Your Question

Filtering nova instance list based on network/subnet

asked 2014-09-15 20:33:24 -0500

magesh-gv gravatar image

updated 2014-09-16 17:26:42 -0500

mpetason gravatar image

I am able to filter nova instance list based on IP Address.

nova list --ip=xxxx

However, I am unable to filter based on either network or subnet.

Tried all possible keys. Is filtering based on network or a subnet even supported in nova ?

I am not using nova networking if it matters.

Solution with direct api call using curl is also fine

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2014-09-16 20:25:15 -0500

larsks gravatar image

I don't believe the Nova API supports this sort of filtering on the server side, although you are welcome to check through the documentation to see if I missed anything.

This sort of filtering would be reasonably easy to implement on the client side; getting a list of servers and metadata is as simple as:


import os
import sys
import argparse

from novaclient.v1_1 import client as novaclient

def get_nova_client():
    return novaclient.Client(

def main():
    nc = get_nova_client()
    # Print a list of running servers.
    for server in nc.servers.list():
        for network_name, network in server.networks.items():
            print '    ', network_name, ', '.join(network)

if __name__ == '__main__':

You could put any logic you want inside the for loop to filter out which servers to display.

edit flag offensive delete link more


Thanks Larsks.

I was hoping to avoid fetching a long list of instances with full details.

This looks like a minor limitation in Nova. Is this not supported because when Neutron is used for networking they do not have the network association information in nova db on which the filters are applied

magesh-gv gravatar imagemagesh-gv ( 2014-09-17 11:56:16 -0500 )edit

I haven't looked at how filters are implemented so I'm not sure.

larsks gravatar imagelarsks ( 2014-09-17 12:54:01 -0500 )edit

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2014-09-15 20:33:24 -0500

Seen: 979 times

Last updated: Sep 16 '14