Merge lp:~rackspace-titan/nova/dhcpbridge_fix_hostname into lp:~hudson-openstack/nova/trunk

Proposed by Dan Prince
Status: Merged
Approved by: Brian Waldon
Approved revision: 1372
Merged at revision: 1424
Proposed branch: lp:~rackspace-titan/nova/dhcpbridge_fix_hostname
Merge into: lp:~hudson-openstack/nova/trunk
Diff against target: 46 lines (+10/-11)
1 file modified
bin/nova-dhcpbridge (+10/-11)
To merge this branch: bzr merge lp:~rackspace-titan/nova/dhcpbridge_fix_hostname
Reviewer Review Type Date Requested Status
Brian Waldon (community) Approve
Vish Ishaya (community) Approve
Review via email: mp+70492@code.launchpad.net

Description of the change

Nuke hostname from nova-dhcpbridge. We don't use it.

To post a comment you must log in.
Revision history for this message
Vish Ishaya (vishvananda) wrote :

I'm a bit confused about this one. We set hostname in _host_lease and _host_dhcp in linux_net. It looks like hostname is getting set from display_name. So perhaps display_name is being set to an empty string sometimes and causing this error? That is the only way that i can see this issue suddenly cropping up.

review: Needs Fixing
Revision history for this message
Vish Ishaya (vishvananda) wrote :

if the above is the issue, perhaps:

display_name = instance['display_name']
if display_name is None:
    return 'server_%d' % (instance['id'],)

should be:

if not display_name

?

Revision history for this message
Dan Prince (dan-prince) wrote :

Hmmm. I guess what I'm trying to understand is how nova-dhcpbridge actually made use of the hostname arg. Ultimately it doesn't seem to go anywhere.

Revision history for this message
Vish Ishaya (vishvananda) wrote :

Good point. I guess the only place it shows up is in logging, so we can kill it. That said, I think it is an issue if hostname is not set, so it would be good to track down why that is happening.

review: Approve
Revision history for this message
Brian Waldon (bcwaldon) wrote :

Looks good to me, Dan.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/nova-dhcpbridge'
2--- bin/nova-dhcpbridge 2011-07-18 23:58:23 +0000
3+++ bin/nova-dhcpbridge 2011-08-04 20:26:05 +0000
4@@ -53,7 +53,7 @@
5 LOG = logging.getLogger('nova.dhcpbridge')
6
7
8-def add_lease(mac, ip_address, _hostname, _interface):
9+def add_lease(mac, ip_address, _interface):
10 """Set the IP that was assigned by the DHCP server."""
11 if FLAGS.fake_rabbit:
12 LOG.debug(_("leasing ip"))
13@@ -67,13 +67,13 @@
14 "args": {"address": ip_address}})
15
16
17-def old_lease(mac, ip_address, hostname, interface):
18+def old_lease(mac, ip_address, interface):
19 """Update just as add lease."""
20- LOG.debug(_("Adopted old lease or got a change of mac/hostname"))
21- add_lease(mac, ip_address, hostname, interface)
22-
23-
24-def del_lease(mac, ip_address, _hostname, _interface):
25+ LOG.debug(_("Adopted old lease or got a change of mac"))
26+ add_lease(mac, ip_address, interface)
27+
28+
29+def del_lease(mac, ip_address, _interface):
30 """Called when a lease expires."""
31 if FLAGS.fake_rabbit:
32 LOG.debug(_("releasing ip"))
33@@ -115,11 +115,10 @@
34 if action in ['add', 'del', 'old']:
35 mac = argv[2]
36 ip = argv[3]
37- hostname = argv[4]
38- msg = _("Called %(action)s for mac %(mac)s with ip %(ip)s and"
39- " hostname %(hostname)s on interface %(interface)s") % locals()
40+ msg = _("Called %(action)s for mac %(mac)s with ip %(ip)s"
41+ " on interface %(interface)s") % locals()
42 LOG.debug(msg)
43- globals()[action + '_lease'](mac, ip, hostname, interface)
44+ globals()[action + '_lease'](mac, ip, interface)
45 else:
46 print init_leases(interface)
47