From 7b78a0d13da6ab1c2c81383d5af4d37408eb4ab0 Mon Sep 17 00:00:00 2001 From: Alessio Ababilov Date: Mon, 16 Jul 2012 14:07:29 +0300 Subject: [PATCH] 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/tests/fake_flags.py | 1 + 2 files changed, 16 insertions(+), 81 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='