Fixup external port configuration on reboots

This commit is contained in:
James Page 2013-03-20 16:54:49 +00:00
parent f22f272e30
commit 5a0e833efa
3 changed files with 25 additions and 0 deletions

View File

@ -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

View File

@ -42,6 +42,8 @@ GATEWAY_AGENTS = {
],
}
EXT_PORT_CONF = '/etc/init/ext-port.conf'
def get_os_version(package=None):
apt.init()

9
templates/ext-port.conf Normal file
View File

@ -0,0 +1,9 @@
description "Enabling Quantum external networking port"
start on runlevel [2345]
task
script
ip link set {{ ext_port }} up
end script