Comment 2 for bug 997763

Piotr Siwczak (psiwczak) wrote :

I already have a "dirty" fix for this in compute/api.py

It probably deserves to be put into separate function in compute/api.py (the one that dissasociates all the floating ips from instance and takes just instance_id as a parameter.

in _delete function:

    def _delete(self, context, instance):
        host = instance['host']

        nw_info = self.network_api.get_instance_nw_info(context.elevated(),
                                                        instance)
        for i in nw_info:
            for j in i['network']['subnets']:
                for k in j['ips']:
                    for l in k['floating_ips']:
                        fip=l['address']
                        LOG.debug(_("Dissasociating floating ip %s from instance") % fip)
                        self.network_api.disassociate_floating_ip(context.elevated(), fip)