diff --git a/hooks/hooks.py b/hooks/hooks.py index 09bd6622..1e5a0dca 100755 --- a/hooks/hooks.py +++ b/hooks/hooks.py @@ -30,6 +30,7 @@ def config_changed(): render_metadata_agent_conf() render_metadata_api_conf() render_plugin_conf() + render_ext_port_upstart() if PLUGIN == qutils.OVS: qutils.add_bridge(qutils.INT_BRIDGE) qutils.add_bridge(qutils.EXT_BRIDGE) @@ -48,6 +49,19 @@ def upgrade_charm(): config_changed() +def render_ext_port_upstart(): + if utils.config_get('ext-port'): + with open(qutils.EXT_PORT_CONF, "w") as conf: + conf.write(utils.render_template( + os.path.basename(qutils.EXT_PORT_CONF), + {"ext_port": utils.config_get('ext-port')} + ) + ) + else: + if os.path.exists(qutils.EXT_PORT_CONF): + os.remove(qutils.EXT_PORT_CONF) + + def render_l3_agent_conf(): context = get_keystone_conf() if (context and diff --git a/hooks/quantum_utils.py b/hooks/quantum_utils.py index accd8595..df25ca68 100644 --- a/hooks/quantum_utils.py +++ b/hooks/quantum_utils.py @@ -42,6 +42,8 @@ GATEWAY_AGENTS = { ], } +EXT_PORT_CONF = '/etc/init/ext-port.conf' + def get_os_version(package=None): apt.init() diff --git a/templates/ext-port.conf b/templates/ext-port.conf new file mode 100644 index 00000000..6080c30e --- /dev/null +++ b/templates/ext-port.conf @@ -0,0 +1,9 @@ +description "Enabling Quantum external networking port" + +start on runlevel [2345] + +task + +script + ip link set {{ ext_port }} up +end script \ No newline at end of file