diff options
| author | Christian Berendt <berendt@b1-systems.de> | 2011-02-16 12:15:48 +0100 |
|---|---|---|
| committer | Christian Berendt <berendt@b1-systems.de> | 2011-02-16 12:15:48 +0100 |
| commit | 7f8595b88df2271c278ae59b6d187b5c3b8dde40 (patch) | |
| tree | 454ab753d1ff3fa8463ff340d3b5cf899e346072 /nova | |
| parent | 56df9b129526aad29ac1a751153d94cfe7656993 (diff) | |
| download | nova-7f8595b88df2271c278ae59b6d187b5c3b8dde40.tar.gz nova-7f8595b88df2271c278ae59b6d187b5c3b8dde40.tar.xz nova-7f8595b88df2271c278ae59b6d187b5c3b8dde40.zip | |
added functionality to nova-manage to list created networks
Diffstat (limited to 'nova')
| -rw-r--r-- | nova/db/api.py | 5 | ||||
| -rw-r--r-- | nova/db/sqlalchemy/api.py | 9 |
2 files changed, 14 insertions, 0 deletions
diff --git a/nova/db/api.py b/nova/db/api.py index 789cb8ebb..d06f3731f 100644 --- a/nova/db/api.py +++ b/nova/db/api.py @@ -500,6 +500,11 @@ def network_get(context, network_id): return IMPL.network_get(context, network_id) +def network_get_all(context): + """Return all defined networks.""" + return IMPL.network_get_all(context) + + # pylint: disable-msg=C0103 def network_get_associated_fixed_ips(context, network_id): """Get all network's ips that have been associated.""" diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py index 02855e7a9..a11572947 100644 --- a/nova/db/sqlalchemy/api.py +++ b/nova/db/sqlalchemy/api.py @@ -1056,6 +1056,15 @@ def network_get(context, network_id, session=None): return result +@require_admin_context +def network_get_all(context): + session = get_session() + result = session.query(models.Network) + if not result: + raise exception.NotFound('No networks defined') + return result + + # NOTE(vish): pylint complains because of the long method name, but # it fits with the names of the rest of the methods # pylint: disable-msg=C0103 |
