From cefb87511c4eae22c46f25da7335b4beb4631c4a Mon Sep 17 00:00:00 2001 From: mathrock Date: Sat, 28 Jul 2012 14:38:43 -0400 Subject: Support external gateways in VLAN mode. Add network label when starting dnsmasq. Fixes bug 1012443. To allow for per-network dnsmasq customization we can use the network label from the database as the dnsmasq network tag. A user can then specify a custom dnsmasq config file using the 'dnsmasq_config_file' configuration flag. An example dnsmasq config file showing how to set a custom external gateway or ntp server for particular networks based on their tag/label follows: dhcp-option=tag:'private',option:router,10.0.0.254 dhcp-option=tag:'private',option:ntp-server,10.0.0.253 dhcp-option=tag:'private',option:dns-server,8.8.8.8 dhcp-option=tag:'blue',option:router,10.10.0.254 dhcp-option=tag:'blue',option:ntp-server,10.10.0.253 dhcp-option=tag:'blue',option:dns-server,8.8.4.4 Change-Id: I56cb175a968e33b803dfcb965f90f3a5ca4983ca --- nova/network/linux_net.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nova/network/linux_net.py b/nova/network/linux_net.py index d5c6bb459..7799052fe 100644 --- a/nova/network/linux_net.py +++ b/nova/network/linux_net.py @@ -724,8 +724,10 @@ def restart_dhcp(context, dev, network_ref): '--pid-file=%s' % _dhcp_file(dev, 'pid'), '--listen-address=%s' % network_ref['dhcp_server'], '--except-interface=lo', - '--dhcp-range=%s,static,%ss' % (network_ref['dhcp_start'], - FLAGS.dhcp_lease_time), + '--dhcp-range=set:\'%s\',%s,static,%ss' % + (network_ref['label'], + network_ref['dhcp_start'], + FLAGS.dhcp_lease_time), '--dhcp-lease-max=%s' % len(netaddr.IPNetwork(network_ref['cidr'])), '--dhcp-hostsfile=%s' % _dhcp_file(dev, 'conf'), '--dhcp-script=%s' % FLAGS.dhcpbridge, -- cgit