From a317e431693bc0acd448ea1e36d4fb1c186d9ad4 Mon Sep 17 00:00:00 2001 From: James Page Date: Mon, 10 Nov 2014 16:15:04 +0000 Subject: [PATCH] Add option for data port --- config.yaml | 7 +++++++ hooks/fabfile.py | 7 +++++++ hooks/nova_compute_context.py | 2 -- hooks/nova_compute_proxy.py | 5 +++++ 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/config.yaml b/config.yaml index 16d2099..e6b225f 100644 --- a/config.yaml +++ b/config.yaml @@ -53,4 +53,11 @@ options: type: string default: description: Comma separated list of key=value config flags to be set in nova.conf. + data-port: + type: string + default: + description: | + The data port will be added to br-data and will allow usage of flat or VLAN + network types with Neutron. + diff --git a/hooks/fabfile.py b/hooks/fabfile.py index ad3240a..580746d 100644 --- a/hooks/fabfile.py +++ b/hooks/fabfile.py @@ -37,6 +37,13 @@ def add_bridge(bridge_name): sudo('ovs-vsctl -- --may-exist add-br %s' % bridge_name) +def add_bridge_port(bridge_name, port): + sudo('ovs-vsctl -- --may-exist add-port %s %s' % (bridge_name, + port)) + sudo('ip link set %s up' % port) + sudo('ip link set %s promisc on' % port) + + def enable_shell(user): sudo('usermod -s /bin/bash {}'.format(user)) diff --git a/hooks/nova_compute_context.py b/hooks/nova_compute_context.py index 37f40d8..86332c3 100644 --- a/hooks/nova_compute_context.py +++ b/hooks/nova_compute_context.py @@ -1,12 +1,10 @@ from charmhelpers.contrib.openstack import context -from charmhelpers.contrib.openstack.utils import get_host_ip from charmhelpers.core.hookenv import ( config, log, relation_get, relation_ids, related_units, - unit_get, ERROR, ) diff --git a/hooks/nova_compute_proxy.py b/hooks/nova_compute_proxy.py index 7b55f1a..312d55e 100644 --- a/hooks/nova_compute_proxy.py +++ b/hooks/nova_compute_proxy.py @@ -5,6 +5,7 @@ from collections import OrderedDict from charmhelpers.core.hookenv import ( charm_dir, log, + config, ) from charmhelpers.core.host import ( file_hash @@ -113,6 +114,10 @@ class POWERProxy(): def add_bridges(self): execute(add_bridge, 'br-int') execute(add_bridge, 'br-data') + if config('data-port'): + execute(add_bridge_port, 'br-data', + config('data-port')) + def enable_shell(self, user): execute(enable_shell, user)