diff options
| author | Christian Berendt <berendt@b1-systems.de> | 2011-02-17 17:59:51 +0000 |
|---|---|---|
| committer | Tarmac <> | 2011-02-17 17:59:51 +0000 |
| commit | 35e2d24e4bdaf2d72155114b7e97821c8a4696d1 (patch) | |
| tree | 70e81ce941cb05041db623e69c6823dc26e23d00 /nova | |
| parent | 7798a551e39cf39a26e966f7ef7ecea52b3f77c3 (diff) | |
| parent | 5b97ee78b1bc2073bca0204caf92ae4560ec1e8e (diff) | |
| download | nova-35e2d24e4bdaf2d72155114b7e97821c8a4696d1.tar.gz nova-35e2d24e4bdaf2d72155114b7e97821c8a4696d1.tar.xz nova-35e2d24e4bdaf2d72155114b7e97821c8a4696d1.zip | |
example:
# nova-manage network list
CIDR netmask dhcp_start DNS
xx.xx.35.0/25 255.255.255.128 xx.xx.35.2 None
xx.xx.36.0/25 255.255.255.128 xx.xx.36.2 None
(DNS set to None because networks not yet used..)
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..65436ab0f 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 |
