Vish, I understan your comment, But Problem isn't fix yet.
Irrespective of force_dhcp_release, when terminate instance, nova don't touch instance value of fixed_ips table.
815 def deallocate_fixed_ip(self, context, address, **kwargs):
816 """Returns a fixed ip to the pool."""
817 self.db.fixed_ip_update(context, address,
818 {'allocated': False,
819 'virtual_interface_id': None})
(only update 'allocated', 'virtual_interface_id')
But, When create instance, instance get a fixed ip from the pool
787 def allocate_fixed_ip(self, context, instance_id, network, **kwargs):
788 """Gets a fixed ip from the pool."""
789 # TODO(vish): when this is called by compute, we can associate compute
790 # with a network, or a cluster of computes with a network
791 # and use that network here with a method like
792 # network_get_by_compute_host
793 address = None
794 if network['cidr']:
795 address = kwargs.get('address', None)
796 if address:
797 address = self.db.fixed_ip_associate(context,
798 address, instance_id,
799 network['id'])
800 else:
801 address = self.db.fixed_ip_associate_pool(context.elevated(),
802 network['id'],
803 instance_id)
Vish, I understan your comment, But Problem isn't fix yet.
Irrespective of force_dhcp_release, when terminate instance, nova don't touch instance value of fixed_ips table.
815 def deallocate_ fixed_ip( self, context, address, **kwargs): fixed_ip_ update( context, address, interface_ id': None})
816 """Returns a fixed ip to the pool."""
817 self.db.
818 {'allocated': False,
819 'virtual_
(only update 'allocated', 'virtual_ interface_ id')
But, When create instance, instance get a fixed ip from the pool fixed_ip( self, context, instance_id, network, **kwargs): get_by_ compute_ host get('address' , None) fixed_ip_ associate( context, fixed_ip_ associate_ pool(context. elevated( ),
787 def allocate_
788 """Gets a fixed ip from the pool."""
789 # TODO(vish): when this is called by compute, we can associate compute
790 # with a network, or a cluster of computes with a network
791 # and use that network here with a method like
792 # network_
793 address = None
794 if network['cidr']:
795 address = kwargs.
796 if address:
797 address = self.db.
798 address, instance_id,
799 network['id'])
800 else:
801 address = self.db.
802 network['id'],
803 instance_id)
db.fixed_ ip_associate_ pool() is associate_ pool(context, network_id, instance_id=None, host=None): FixedIp. network_ id == network_id, FixedIp. network_ id == None) query(models. FixedIp) .\ network_ or_none) .\ by(reserved= False). \ by(deleted= False). \ by(instance= None).\ by(host= None).\ 'update' ).\
741 def fixed_ip_
742 session = get_session()
743 with session.begin():
744 network_or_none = or_(models.
745 models.
746 fixed_ip_ref = session.
747 filter(
748 filter_
749 filter_
750 filter_
751 filter_
752 with_lockmode(
753 first()
method choice fixed_ip what instance==None.
when terminate instance, nova don't update instance value to NULL, So termiated ip address couldn't reuse.