Make interface configurable

This commit is contained in:
Dmitry Tantsur 2014-10-08 11:31:06 +02:00
parent 872d7e782f
commit 9237f1b906
2 changed files with 7 additions and 2 deletions

View File

@ -10,6 +10,9 @@
; Tenant name for accessing Ironic API.
;os_tenant_name =
; Interface on which dnsmasq listens, the default is for VM's.
;dnsmasq_interface = br-ctlplane
; IP to listen on.
;listen_address = 0.0.0.0
; Port to listen on.

View File

@ -11,7 +11,8 @@ ALLOW_SEARCH_BY_MAC = True
CONF = ConfigParser.ConfigParser(
defaults={'debug': 'false',
'listen_address': '0.0.0.0',
'listen_port': '5050'})
'listen_port': '5050',
'dnsmasq_interface': 'br-ctlplane'})
OS_ARGS = ('os_password', 'os_username', 'os_auth_url', 'os_tenant_name')
@ -134,7 +135,7 @@ class Firewall(object):
MACS_DISCOVERY = set()
NEW_CHAIN = 'discovery_temp'
CHAIN = 'discovery'
INTERFACE = 'br-ctlplane'
INTERFACE = None
@staticmethod
def _iptables(*args, **kwargs):
@ -155,6 +156,7 @@ class Firewall(object):
@classmethod
def init(cls):
cls.INTERFACE = CONF.get('discoverd', 'dnsmasq_interface')
cls._iptables('-F', cls.NEW_CHAIN, ignore=True)
cls._iptables('-X', cls.NEW_CHAIN, ignore=True)
cls._iptables('-D', 'INPUT', '-i', cls.INTERFACE, '-p', 'udp',