>>In addition, when migrating instances, we may want to release the IPs, but keep the mac >>addresses, meaning the virtual interfaces should remain in tact in the db.
You have a valid point here. Instead of deleting the virtual interfaces from the release_fixed_ip method you can delete them in the deallocate_for_instance as you did it before. But in this case virtual interfaces shouldn't be referred in the release_fixed_ip method otherwise it gives exception since this release_fixed_ip method is invoked by the nova-dhcpbridge script by the dnsmasq process way after deallocated_for_instance is called.
I see following exception :-
2011-06-16 13:33:11,581 DEBUG nova.network.manager [ZM-0QM-G3YLRIKNGSBR6 None None] Releasing IP 10.0.1.3 from (pid=13453) release_fixed_ip /home/tpatil/nova/nova/network/manager.py:518
2011-06-16 13:33:11,598 ERROR nova [-] Exception during message handling
(nova): TRACE: Traceback (most recent call last):
(nova): TRACE: File "/home/tpatil/nova/nova/rpc.py", line 232, in _process_data
(nova): TRACE: rval = node_func(context=ctxt, **node_args)
(nova): TRACE: File "/home/tpatil/nova/nova/network/manager.py", line 524, in release_fixed_ip
(nova): TRACE: mac_address = fixed_ip['virtual_interface']['address']
(nova): TRACE: TypeError: 'NoneType' object is unsubscriptable
(nova): TRACE:
Secondly, you will need to set virtual_interface_id to None for the fixed ip address either in the deallocate_fixed_ip method or somewhere else otherwise it gives exception in the linux_net.py->_host_dhcp method whenever the dhcp host file is updated.
I see following exception:
2011-06-16 14:01:56,343 DEBUG nova.utils [-] Attempting to grab semaphore "dnsmasq_start" for method "update_dhcp"... from (pid=14549) inner /home/tpatil/nova/nova/utils.py:570
2011-06-16 14:01:56,358 ERROR nova [-] Exception during message handling
(nova): TRACE: Traceback (most recent call last):
(nova): TRACE: File "/home/tpatil/nova/nova/rpc.py", line 232, in _process_data
(nova): TRACE: rval = node_func(context=ctxt, **node_args)
(nova): TRACE: File "/home/tpatil/nova/nova/network/manager.py", line 185, in allocate_for_instance
(nova): TRACE: ips = super(FloatingIP, self).allocate_for_instance(context, **kwargs)
(nova): TRACE: File "/home/tpatil/nova/nova/network/manager.py", line 362, in allocate_for_instance
(nova): TRACE: self._allocate_fixed_ips(admin_context, instance_id, networks)
(nova): TRACE: File "/home/tpatil/nova/nova/network/manager.py", line 142, in _allocate_fixed_ips
(nova): TRACE: self.allocate_fixed_ip(context, instance_id, network)
(nova): TRACE: File "/home/tpatil/nova/nova/network/manager.py", line 806, in allocate_fixed_ip
(nova): TRACE: self.driver.update_dhcp(context, network['id'])
(nova): TRACE: File "/home/tpatil/nova/nova/utils.py", line 583, in inner
(nova): TRACE: retval = f(*args, **kwargs)
(nova): TRACE: File "/home/tpatil/nova/nova/network/linux_net.py", line 580, in update_dhcp
(nova): TRACE: f.write(get_dhcp_hosts(context, network_id))
(nova): TRACE: File "/home/tpatil/nova/nova/network/linux_net.py", line 561, in get_dhcp_hosts
(nova): TRACE: hosts.append(_host_dhcp(fixed_ip_ref))
(nova): TRACE: File "/home/tpatil/nova/nova/network/linux_net.py", line 670, in _host_dhcp
(nova): TRACE: return '%s,%s.%s,%s' % (fixed_ip_ref['virtual_interface']['address'],
(nova): TRACE: TypeError: 'NoneType' object is unsubscriptable
(nova): TRACE:
>>In addition, when migrating instances, we may want to release the IPs, but keep the mac >>addresses, meaning the virtual interfaces should remain in tact in the db. for_instance as you did it before. But in this case virtual interfaces shouldn't be referred in the release_fixed_ip method otherwise it gives exception since this release_fixed_ip method is invoked by the nova-dhcpbridge script by the dnsmasq process way after deallocated_ for_instance is called.
You have a valid point here. Instead of deleting the virtual interfaces from the release_fixed_ip method you can delete them in the deallocate_
I see following exception :-
2011-06-16 13:33:11,581 DEBUG nova.network. manager [ZM-0QM- G3YLRIKNGSBR6 None None] Releasing IP 10.0.1.3 from (pid=13453) release_fixed_ip /home/tpatil/ nova/nova/ network/ manager. py:518 tpatil/ nova/nova/ rpc.py" , line 232, in _process_data context= ctxt, **node_args) tpatil/ nova/nova/ network/ manager. py", line 524, in release_fixed_ip 'virtual_ interface' ]['address' ]
2011-06-16 13:33:11,598 ERROR nova [-] Exception during message handling
(nova): TRACE: Traceback (most recent call last):
(nova): TRACE: File "/home/
(nova): TRACE: rval = node_func(
(nova): TRACE: File "/home/
(nova): TRACE: mac_address = fixed_ip[
(nova): TRACE: TypeError: 'NoneType' object is unsubscriptable
(nova): TRACE:
Secondly, you will need to set virtual_ interface_ id to None for the fixed ip address either in the deallocate_fixed_ip method or somewhere else otherwise it gives exception in the linux_net. py->_host_ dhcp method whenever the dhcp host file is updated.
I see following exception: nova/nova/ utils.py: 570 tpatil/ nova/nova/ rpc.py" , line 232, in _process_data context= ctxt, **node_args) tpatil/ nova/nova/ network/ manager. py", line 185, in allocate_ for_instance for_instance( context, **kwargs) tpatil/ nova/nova/ network/ manager. py", line 362, in allocate_ for_instance fixed_ips( admin_context, instance_id, networks) tpatil/ nova/nova/ network/ manager. py", line 142, in _allocate_fixed_ips fixed_ip( context, instance_id, network) tpatil/ nova/nova/ network/ manager. py", line 806, in allocate_fixed_ip update_ dhcp(context, network['id']) tpatil/ nova/nova/ utils.py" , line 583, in inner tpatil/ nova/nova/ network/ linux_net. py", line 580, in update_dhcp get_dhcp_ hosts(context, network_id)) tpatil/ nova/nova/ network/ linux_net. py", line 561, in get_dhcp_hosts _host_dhcp( fixed_ip_ ref)) tpatil/ nova/nova/ network/ linux_net. py", line 670, in _host_dhcp ip_ref[ 'virtual_ interface' ]['address' ],
2011-06-16 14:01:56,343 DEBUG nova.utils [-] Attempting to grab semaphore "dnsmasq_start" for method "update_dhcp"... from (pid=14549) inner /home/tpatil/
2011-06-16 14:01:56,358 ERROR nova [-] Exception during message handling
(nova): TRACE: Traceback (most recent call last):
(nova): TRACE: File "/home/
(nova): TRACE: rval = node_func(
(nova): TRACE: File "/home/
(nova): TRACE: ips = super(FloatingIP, self).allocate_
(nova): TRACE: File "/home/
(nova): TRACE: self._allocate_
(nova): TRACE: File "/home/
(nova): TRACE: self.allocate_
(nova): TRACE: File "/home/
(nova): TRACE: self.driver.
(nova): TRACE: File "/home/
(nova): TRACE: retval = f(*args, **kwargs)
(nova): TRACE: File "/home/
(nova): TRACE: f.write(
(nova): TRACE: File "/home/
(nova): TRACE: hosts.append(
(nova): TRACE: File "/home/
(nova): TRACE: return '%s,%s.%s,%s' % (fixed_
(nova): TRACE: TypeError: 'NoneType' object is unsubscriptable
(nova): TRACE: