Support optional 4 arg for nova-dhcpbridge

dnsmasq will call the add, old, and del actions with an optional
4 argument of hostname if the hostname is known. Since we populate
the hostname in the DHCP host file its always passed to us.

Add an optional 4 argument for hostname for the add, old, and del
actions.

Change-Id: I1a6c095324be2424d6c1d469877b254f88fba4aa
Fixes: bug #1103783
This commit is contained in:
Chet Burgess 2013-01-24 02:10:18 +00:00
parent f9012e39ee
commit d94e693bc4

View File

@ -96,10 +96,15 @@ def init_leases(network_id):
def add_action_parsers(subparsers):
parser = subparsers.add_parser('init')
# NOTE(cfb): dnsmasq always passes mac, and ip. hostname
# is passed if known. We don't care about
# hostname, but argparse will complain if we
# do not accept it.
for action in ['add', 'del', 'old']:
parser = subparsers.add_parser(action)
parser.add_argument('mac')
parser.add_argument('ip')
parser.add_argument('hostname', nargs='?', default='')
parser.set_defaults(func=globals()[action + '_lease'])