Add NTP to dnsmasq DHCP; move mkdir of dnsmasq_hostsdir to init
This commit is contained in:
parent
94398a7847
commit
7d9426dd65
|
@ -59,6 +59,13 @@ class VXNetworkInstance(object):
|
||||||
self.dnsmasq_hostsdir = '{}/{}'.format(config['dnsmasq_dynamic_directory'], self.vni)
|
self.dnsmasq_hostsdir = '{}/{}'.format(config['dnsmasq_dynamic_directory'], self.vni)
|
||||||
self.dhcp_reservations = []
|
self.dhcp_reservations = []
|
||||||
|
|
||||||
|
# Create the network hostsdir
|
||||||
|
common.run_os_command(
|
||||||
|
'/bin/mkdir --parents {}'.format(
|
||||||
|
self.dnsmasq_hostsdir
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
self.firewall_rules_base = """# Rules for network {vxlannic}
|
self.firewall_rules_base = """# Rules for network {vxlannic}
|
||||||
add chain inet filter {vxlannic}-in
|
add chain inet filter {vxlannic}-in
|
||||||
add chain inet filter {vxlannic}-out
|
add chain inet filter {vxlannic}-out
|
||||||
|
@ -223,9 +230,9 @@ add rule inet filter input meta iifname {bridgenic} counter drop
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
entry = '{},{}'.format(reservation, ipaddr)
|
entry = '{},{}'.format(reservation, ipaddr)
|
||||||
outfile = open(filename, 'w')
|
# Write the entry
|
||||||
outfile.write(entry)
|
with open(filename, 'w') as outfile:
|
||||||
outfile.close()
|
outfile.write(entry)
|
||||||
|
|
||||||
for reservation in old_reservations_list:
|
for reservation in old_reservations_list:
|
||||||
if reservation not in new_reservations_list:
|
if reservation not in new_reservations_list:
|
||||||
|
@ -354,12 +361,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'
|
||||||
)
|
)
|
||||||
# Create the network hostsdir
|
|
||||||
common.run_os_command(
|
|
||||||
'/bin/mkdir --parents {}'.format(
|
|
||||||
self.dnsmasq_hostsdir
|
|
||||||
)
|
|
||||||
)
|
|
||||||
# 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 = {
|
||||||
|
@ -386,6 +387,7 @@ add rule inet filter input meta iifname {bridgenic} counter drop
|
||||||
'--dhcp-script={}/pvcd/dnsmasq-zookeeper-leases.py'.format(os.getcwd()),
|
'--dhcp-script={}/pvcd/dnsmasq-zookeeper-leases.py'.format(os.getcwd()),
|
||||||
'--dhcp-range={},{},48h'.format(self.dhcp_start, self.dhcp_end),
|
'--dhcp-range={},{},48h'.format(self.dhcp_start, self.dhcp_end),
|
||||||
'--dhcp-hostsdir={}'.format(self.dnsmasq_hostsdir),
|
'--dhcp-hostsdir={}'.format(self.dnsmasq_hostsdir),
|
||||||
|
'--dhcp-option=option:ntp-server,224.0.0.1',
|
||||||
'--log-facility=-',
|
'--log-facility=-',
|
||||||
'--keep-in-foreground'
|
'--keep-in-foreground'
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in New Issue