From e00a398f84562f1a0da69c8c0fd33db538365dc3 Mon Sep 17 00:00:00 2001 From: Alessio Ababilov Date: Mon, 16 Jul 2012 14:07:29 +0300 Subject: Implement network creation in compute API Implements blueprint os-api-network-create The ability to create new networks is currently only exposed by the nova-manage CLI. Here we add support for network creation in the os-networks API extension. With the exception of num_networks and network_size, all the parameters supported by 'nova-manage network create' are supported. Only a single network may be created by each API call. To avoid code duplication, the nova-manage code is refactored and moved into NetworkManager so that it can be re-used by the API. DocImpact Change-Id: I682d498ab35ea43b553b64e13e677fe9eeb8e08b --- bin/nova-manage | 96 ++++------------------ nova/api/openstack/compute/contrib/networks.py | 29 ++++++- nova/network/manager.py | 90 +++++++++++++++++++- nova/network/quantum/nova_ipam_lib.py | 2 +- .../api/openstack/compute/contrib/test_networks.py | 62 ++++++++++++++ nova/tests/fake_flags.py | 1 + nova/tests/network/test_linux_net.py | 1 + nova/tests/test_nova_manage.py | 4 +- 8 files changed, 195 insertions(+), 90 deletions(-) diff --git a/bin/nova-manage b/bin/nova-manage index 9a09a8b5a..01b27ef2d 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -83,6 +83,7 @@ from nova import db from nova.db import migration from nova import exception from nova import flags +from nova.api.openstack.compute.contrib import networks from nova.openstack.common import cfg from nova.openstack.common import importutils from nova.openstack.common import log as logging @@ -94,6 +95,8 @@ from nova import utils from nova import version from nova.volume import volume_types +from webob import exc + FLAGS = flags.FLAGS flags.DECLARE('flat_network_bridge', 'nova.network.manager') flags.DECLARE('num_networks', 'nova.network.manager') @@ -434,7 +437,7 @@ class NetworkCommands(object): @args('--label', dest="label", metavar='