3) Virtual interfaces db records should be deleted in the release_fixed_ip method instead of deallocate_for_instance method in the class NetworkManager. Also while updating dhcp information for a particular network filter associated fixed IPs whose virtual interfaces are set to NULL.
# deallocate fixed ips
for fixed_ip in fixed_ips:
@@ -534,11 +532,16 @@
if not fixed_ip['leased']: LOG.warn(_('IP %s released that was not leased'), address, context=context)
+ self.db.fixed_ip_update(context, fixed_ip['address'], {'leased': False})
if not fixed_ip['allocated']: self.db.fixed_ip_disassociate(context, address)
+
+ # deallocate mac addresses
+ self.db.virtual_interface_delete(context, fixed_ip['virtual_interface']['id'])
+
# NOTE(vish): dhcp server isn't updated until next setup, this
# means there will stale entries in the conf file
# the code below will update the file if necessary
Thanks Trey. Couple of the my concerns are addressed by you.
Pending and new problems I found out in rev. 838 are listed below:-
1) Typo problem manager. py' manager. py 2011-06-21 16:59:22 +0000 manager. py 2011-06-21 18:09:06 +0000
self. _update_ state(context, instance_id, power_state. BUILDING)
patch:-
=== modified file 'nova/compute/
--- nova/compute/
+++ nova/compute/
@@ -301,7 +301,7 @@
try: spawn(instance_ ref, network_info, block_device_ mapping) spawn(instance, network_info, block_device_ mapping)
"virtualization enabled in the BIOS? Details: "
- self.driver.
+ self.driver.
except Exception as ex: # pylint: disable=W0702
msg = _("Instance '%(instance_id)s' failed to spawn. Is "
2) Floating IP addresses are not disassociated when you terminate an instance.
Patch:- sqlalchemy/ api.py' sqlalchemy/ api.py 2011-06-21 16:59:22 +0000 sqlalchemy/ api.py 2011-06-21 19:38:45 +0000 get_by_ instance( context, instance_id): query(models. FixedIp) .\ joinedload( 'floating_ ips')). \
filter_ by(instance_ id=instance_ id).\
filter_ by(deleted= False). \
all( )
=== modified file 'nova/db/
--- nova/db/
+++ nova/db/
@@ -754,6 +754,7 @@
def fixed_ip_
session = get_session()
rv = session.
+ options(
=== modified file 'nova/network/ api.py' ip.get( 'fixed_ ip'): ApiError( 'Address is not associated.') ip['fixed_ ip']['network' ]['host' ]
rpc.call( context,
self. db.queue_ get_for( context, FLAGS.network_ topic, host),
{'method' : 'disassociate_ floating_ ip',
--- nova/network/api.py 2011-06-17 18:47:28 +0000
+++ nova/network/api.py 2011-06-21 19:31:35 +0000
@@ -107,7 +107,7 @@
return
if not floating_
raise exception.
- host = floating_ip['host']
+ host = floating_
3) Virtual interfaces db records should be deleted in the release_fixed_ip method instead of deallocate_ for_instance method in the class NetworkManager. Also while updating dhcp information for a particular network filter associated fixed IPs whose virtual interfaces are set to NULL.
Patch:- sqlalchemy/ api.py' sqlalchemy/ api.py 2011-06-21 16:59:22 +0000 sqlalchemy/ api.py 2011-06-21 19:38:45 +0000
options( joinedload_ all('instance' )).\
filter_ by(network_ id=network_ id).\
filter( models. FixedIp. instance_ id != None).\ models. FixedIp. virtual_ interface_ id != None).\
filter_ by(deleted= False). \
all( )
=== modified file 'nova/db/
--- nova/db/
+++ nova/db/
@@ -1566,6 +1567,7 @@
+ filter(
=== modified file 'nova/network/ manager. py' manager. py 2011-06-21 16:51:08 +0000 manager. py 2011-06-21 19:21:15 +0000
self. db.fixed_ ip_get_ by_instance( context, instance_id)
LOG.debug( _("network deallocation for instance |%s|"), instance_id,
context= context) virtual_ interface_ delete_ by_instance( context, instance_id)
--- nova/network/
+++ nova/network/
@@ -379,8 +379,6 @@
- # deallocate mac addresses
- self.db.
# deallocate fixed ips
LOG. warn(_( 'IP %s released that was not leased'), address,
context= context)
self. db.fixed_ ip_update( context,
fixed_ ip['address' ],
{' leased' : False}) 'allocated' ]:
self. db.fixed_ ip_disassociate (context, address) virtual_ interface_ delete( context, fixed_ip[ 'virtual_ interface' ]['id'] )
for fixed_ip in fixed_ips:
@@ -534,11 +532,16 @@
if not fixed_ip['leased']:
+
if not fixed_ip[
+
+ # deallocate mac addresses
+ self.db.
+
# NOTE(vish): dhcp server isn't updated until next setup, this
# means there will stale entries in the conf file
# the code below will update the file if necessary