fix dhcpbridge issues
This commit is contained in:
parent
24f8cb89f8
commit
6664c960e0
@ -69,7 +69,7 @@ def init_leases(interface):
|
||||
"""Get the list of hosts for an interface."""
|
||||
net = model.get_network_by_interface(interface)
|
||||
res = ""
|
||||
for address in net.address_objs:
|
||||
for address in net.assigned_objs:
|
||||
res += "%s\n" % linux_net.host_dhcp(address)
|
||||
return res
|
||||
|
||||
|
@ -116,7 +116,7 @@ def _dnsmasq_cmd(net):
|
||||
' --pid-file=%s' % dhcp_file(net['vlan'], 'pid'),
|
||||
' --listen-address=%s' % net.dhcp_listen_address,
|
||||
' --except-interface=lo',
|
||||
' --dhcp-range=%s,static,600s' % net.dhcp_range_start,
|
||||
' --dhcp-range=%s,static,120s' % net.dhcp_range_start,
|
||||
' --dhcp-hostsfile=%s' % dhcp_file(net['vlan'], 'conf'),
|
||||
' --dhcp-script=%s' % bin_file('nova-dhcpbridge'),
|
||||
' --leasefile-ro']
|
||||
@ -153,14 +153,10 @@ def start_dnsmasq(network):
|
||||
# correct dnsmasq process
|
||||
try:
|
||||
os.kill(pid, signal.SIGHUP)
|
||||
return
|
||||
except Exception as exc: # pylint: disable=W0703
|
||||
logging.debug("Hupping dnsmasq threw %s", exc)
|
||||
|
||||
# otherwise delete the existing leases file and start dnsmasq
|
||||
lease_file = dhcp_file(network['vlan'], 'leases')
|
||||
if os.path.exists(lease_file):
|
||||
os.unlink(lease_file)
|
||||
|
||||
# FLAGFILE and DNSMASQ_INTERFACE in env
|
||||
env = {'FLAGFILE': FLAGS.dhcpbridge_flagfile,
|
||||
'DNSMASQ_INTERFACE': network['bridge_name']}
|
||||
|
@ -226,13 +226,13 @@ class VlanNetworkService(BaseNetworkService):
|
||||
"""Returns an ip to the pool"""
|
||||
return model.get_network_by_address(fixed_ip).deallocate_ip(fixed_ip)
|
||||
|
||||
def lease_ip(self, address):
|
||||
def lease_ip(self, fixed_ip):
|
||||
"""Called by bridge when ip is leased"""
|
||||
return model.get_network_by_address(address).lease_ip(address)
|
||||
return model.get_network_by_address(fixed_ip).lease_ip(fixed_ip)
|
||||
|
||||
def release_ip(self, address):
|
||||
def release_ip(self, fixed_ip):
|
||||
"""Called by bridge when ip is released"""
|
||||
return model.get_network_by_address(address).release_ip(address)
|
||||
return model.get_network_by_address(fixed_ip).release_ip(fixed_ip)
|
||||
|
||||
def restart_nets(self):
|
||||
"""Ensure the network for each user is enabled"""
|
||||
|
Loading…
Reference in New Issue
Block a user