Some cleanups and fix bridge interface bug

This commit is contained in:
Joshua Boniface 2018-10-14 18:35:32 -04:00
parent 199b4bd40e
commit 2e2459c63c
3 changed files with 4 additions and 12 deletions

View File

@ -269,7 +269,6 @@ add rule inet filter input meta iifname {bridgenic} counter drop
vxlannic=self.vxlan_nic, vxlannic=self.vxlan_nic,
bridgenic=self.bridge_nic bridgenic=self.bridge_nic
) )
print(nftables_network_rules)
with open(self.nftables_netconf_filename, 'w') as nfbasefile: with open(self.nftables_netconf_filename, 'w') as nfbasefile:
nfbasefile.write(dedent(nftables_network_rules)) nfbasefile.write(dedent(nftables_network_rules))
open(self.nftables_update_filename, 'a').close() open(self.nftables_update_filename, 'a').close()
@ -285,12 +284,6 @@ add rule inet filter input meta iifname {bridgenic} counter drop
prefix='VNI {}'.format(self.vni), prefix='VNI {}'.format(self.vni),
state='o' state='o'
) )
print('ip address add {}/{} dev {}'.format(
self.ip_gateway,
self.ip_cidrnetmask,
self.bridge_nic
))
common.run_os_command( common.run_os_command(
'ip address add {}/{} dev {}'.format( 'ip address add {}/{} dev {}'.format(
self.ip_gateway, self.ip_gateway,
@ -324,7 +317,7 @@ add rule inet filter input meta iifname {bridgenic} counter drop
# Recreate the environment we need for dnsmasq # Recreate the environment we need for dnsmasq
pvcd_config_file = os.environ['PVCD_CONFIG_FILE'] pvcd_config_file = os.environ['PVCD_CONFIG_FILE']
dhcp_environment = { dhcp_environment = {
'DNSMASQ_INTERFACE': self.bridge_nic, 'DNSMASQ_BRIDGE_INTERFACE': self.bridge_nic,
'PVCD_CONFIG_FILE': pvcd_config_file 'PVCD_CONFIG_FILE': pvcd_config_file
} }
# Define the dnsmasq config # Define the dnsmasq config
@ -337,7 +330,7 @@ add rule inet filter input meta iifname {bridgenic} counter drop
'--domain={}'.format(self.domain), '--domain={}'.format(self.domain),
'--local=/{}/'.format(self.domain), '--local=/{}/'.format(self.domain),
'--auth-zone={}'.format(self.domain), '--auth-zone={}'.format(self.domain),
# '--auth-peer=127.0.0.1,{}'.format(self.ip_gateway), '--auth-peer=127.0.0.1,{}'.format(self.ip_gateway),
'--auth-sec-servers=127.0.0.1,[::1],{}'.format(self.ip_gateway), '--auth-sec-servers=127.0.0.1,[::1],{}'.format(self.ip_gateway),
'--listen-address={}'.format(self.ip_gateway), '--listen-address={}'.format(self.ip_gateway),
'--bind-interfaces', '--bind-interfaces',
@ -347,7 +340,7 @@ add rule inet filter input meta iifname {bridgenic} counter drop
'--dhcp-lease-max=99', '--dhcp-lease-max=99',
'--dhcp-hostsdir={}'.format(self.dnsmasq_hostsdir), '--dhcp-hostsdir={}'.format(self.dnsmasq_hostsdir),
'--log-queries=extra', '--log-queries=extra',
'--log-facility=DAEMON', '--log-facility={}/dnsmasq.log'.format(self.config['dnsmasq_log_directory']),
'--keep-in-foreground' '--keep-in-foreground'
] ]
# Start the dnsmasq process in a thread # Start the dnsmasq process in a thread

View File

@ -47,7 +47,6 @@ class OSDaemon(object):
def run_os_daemon(command_string, environment=None): def run_os_daemon(command_string, environment=None):
command = command_string.split() command = command_string.split()
print(' '.join(command))
daemon = OSDaemon(command, environment) daemon = OSDaemon(command, environment)
return daemon return daemon

View File

@ -15,7 +15,7 @@ import re
def get_zookeeper_key(): def get_zookeeper_key():
# Get the interface from environment (passed by dnsmasq) # Get the interface from environment (passed by dnsmasq)
try: try:
interface = os.environ['DNSMASQ_INTERFACE'] interface = os.environ['DNSMASQ_BRIDGE_INTERFACE']
except: except:
exit(1) exit(1)
# Get the ID of the interface (the digits) # Get the ID of the interface (the digits)