removed unneded mac parameter to lease and release fixed ip functions

This commit is contained in:
Trey Morris 2011-06-27 17:07:21 -05:00
parent 0a2c2e0975
commit b699b9abd2
3 changed files with 8 additions and 14 deletions

View File

@ -59,14 +59,12 @@ def add_lease(mac, ip_address, _hostname, _interface):
LOG.debug(_("leasing ip"))
network_manager = utils.import_object(FLAGS.network_manager)
network_manager.lease_fixed_ip(context.get_admin_context(),
mac,
ip_address)
else:
rpc.cast(context.get_admin_context(),
"%s.%s" % (FLAGS.network_topic, FLAGS.host),
{"method": "lease_fixed_ip",
"args": {"mac": mac,
"address": ip_address}})
"args": {"address": ip_address}})
def old_lease(mac, ip_address, hostname, interface):
@ -81,14 +79,12 @@ def del_lease(mac, ip_address, _hostname, _interface):
LOG.debug(_("releasing ip"))
network_manager = utils.import_object(FLAGS.network_manager)
network_manager.release_fixed_ip(context.get_admin_context(),
mac,
ip_address)
else:
rpc.cast(context.get_admin_context(),
"%s.%s" % (FLAGS.network_topic, FLAGS.host),
{"method": "release_fixed_ip",
"args": {"mac": mac,
"address": ip_address}})
"args": {"address": ip_address}})
def init_leases(interface):

View File

@ -503,10 +503,9 @@ class NetworkManager(manager.SchedulerDependentManager):
{'allocated': False,
'virtual_interface_id': None})
def lease_fixed_ip(self, context, mac, address):
def lease_fixed_ip(self, context, address):
"""Called by dhcp-bridge when ip is leased."""
LOG.debug(_('Leased IP |%(address)s| to mac |%(mac)s|'), locals(),
context=context)
LOG.debug(_('Leased IP |%(address)s|'), locals(), context=context)
fixed_ip = self.db.fixed_ip_get_by_address(context, address)
instance = fixed_ip['instance']
if not instance:
@ -521,10 +520,9 @@ class NetworkManager(manager.SchedulerDependentManager):
LOG.warn(_('IP |%s| leased that isn\'t allocated'), address,
context=context)
def release_fixed_ip(self, context, mac, address):
def release_fixed_ip(self, context, address):
"""Called by dhcp-bridge when ip is released."""
LOG.debug(_('Released IP |%(address)s| from mac |%(mac)s|'), locals(),
context=context)
LOG.debug(_('Released IP |%(address)s|'), locals(), context=context)
fixed_ip = self.db.fixed_ip_get_by_address(context, address)
instance = fixed_ip['instance']
if not instance:

View File

@ -135,10 +135,10 @@ class TestFuncs(object):
db.fixed_ip_update(self.context, address,
{'virtual_interface_id': vif['id']})
self.network.lease_fixed_ip(self.context, vif['address'], address)
self.network.lease_fixed_ip(self.context, address)
ip = db.fixed_ip_get_by_address(self.context, address)
self.assertTrue(ip['leased'])
self.network.release_fixed_ip(self.context, vif['address'], address)
self.network.release_fixed_ip(self.context, address)
ip = db.fixed_ip_get_by_address(self.context, address)
self.assertFalse(ip['leased'])