diff options
| author | Brent Eagles <beagles@redhat.com> | 2013-02-22 17:57:33 -0330 |
|---|---|---|
| committer | Brent Eagles <beagles@redhat.com> | 2013-02-24 23:41:56 -0330 |
| commit | 62b18ebb683ece2e0366f754157a89f67e8532ab (patch) | |
| tree | 72fe3fd305322cf6e48f7927ee063bba73be6605 /nova | |
| parent | 95b7d2c06eaebfd974eae3cd7ddf707bed332f47 (diff) | |
Change nova-dhcpbridge FLAGFILE to a list of files
This patch adds support to linux_net and nova-dhcpbridge for
specifying and conveying multiple dhcpbridge_flagfile values.
The support is implemented as follows:
dhcpbridge_flagfile is now a "MultiStr" configuration file option
allowing the flag files to be defined over multiple configuration files.
The configured files are concatenated into a comma separated string and
assigned to the FLAGFILE environment variable when invoking
nova-dhcpbridge. nova-dhcpbridge splits the value of the environment
variable on the comma an initializes its configuration with the provided
files (the configuration system already supports loading configuration
from multiple files)
Fixes bug 1131932
Change-Id: Ic9cc57b8f7d9356606b9134ef5b63ab07b6099d9
Diffstat (limited to 'nova')
| -rw-r--r-- | nova/network/linux_net.py | 9 | ||||
| -rw-r--r-- | nova/tests/network/test_linux_net.py | 3 |
2 files changed, 7 insertions, 5 deletions
diff --git a/nova/network/linux_net.py b/nova/network/linux_net.py index 29b882a02..5c20f9ce8 100644 --- a/nova/network/linux_net.py +++ b/nova/network/linux_net.py @@ -31,6 +31,7 @@ from nova import db from nova import exception from nova.openstack.common import fileutils from nova.openstack.common import importutils +from nova.openstack.common import jsonutils from nova.openstack.common import lockutils from nova.openstack.common import log as logging from nova.openstack.common import timeutils @@ -41,9 +42,9 @@ LOG = logging.getLogger(__name__) linux_net_opts = [ - cfg.StrOpt('dhcpbridge_flagfile', - default='/etc/nova/nova-dhcpbridge.conf', - help='location of flagfile for dhcpbridge'), + cfg.MultiStrOpt('dhcpbridge_flagfile', + default=['/etc/nova/nova-dhcpbridge.conf'], + help='location of flagfiles for dhcpbridge'), cfg.StrOpt('networks_path', default=paths.state_path_def('networks'), help='Location to keep network config files'), @@ -994,7 +995,7 @@ def restart_dhcp(context, dev, network_ref): LOG.debug(_('Pid %d is stale, relaunching dnsmasq'), pid) cmd = ['env', - 'CONFIG_FILE=%s' % CONF.dhcpbridge_flagfile, + 'CONFIG_FILE=%s' % jsonutils.dumps(CONF.dhcpbridge_flagfile), 'NETWORK_ID=%s' % str(network_ref['id']), 'dnsmasq', '--strict-order', diff --git a/nova/tests/network/test_linux_net.py b/nova/tests/network/test_linux_net.py index cba08d9ce..4eac0c88c 100644 --- a/nova/tests/network/test_linux_net.py +++ b/nova/tests/network/test_linux_net.py @@ -26,6 +26,7 @@ from nova import db from nova.network import driver from nova.network import linux_net from nova.openstack.common import fileutils +from nova.openstack.common import jsonutils from nova.openstack.common import log as logging from nova.openstack.common import timeutils from nova import test @@ -496,7 +497,7 @@ class LinuxNetworkTestCase(test.TestCase): dev = 'br100' linux_net.restart_dhcp(self.context, dev, network_ref) expected = ['env', - 'CONFIG_FILE=%s' % CONF.dhcpbridge_flagfile, + 'CONFIG_FILE=%s' % jsonutils.dumps(CONF.dhcpbridge_flagfile), 'NETWORK_ID=fake', 'dnsmasq', '--strict-order', |
