def push_floating_ip_to_instance(self, server, instance, nova):
        if not instance.external_ips or not instance.internal_ips:
            return

        logger.debug('About to add external ip %s to instance %s',
                     instance.external_ips, instance.uuid)

        membership = instance.cloud_project_membership
        try:
            floating_ip = membership.floating_ips.get(
                status__in=('BOOKED', 'DOWN'),
                address=instance.external_ips,
                backend_network_id=membership.external_network_id
            )
            server.add_floating_ip(address=instance.external_ips, fixed_address=instance.internal_ips)
        except (
                nova_exceptions.ClientException,
                ObjectDoesNotExist,
                MultipleObjectsReturned,
                KeyError,
                __HOLE__,
        ):
            logger.exception('Failed to add external ip %s to instance %s',
                             instance.external_ips, instance.uuid)
            instance.set_erred()
            instance.save()
        else:
            floating_ip.status = 'ACTIVE'
            floating_ip.save()
            logger.info('Successfully added external ip %s to instance %s',
                        instance.external_ips, instance.uuid)
dataset/ETHPy150Open opennode/nodeconductor/nodeconductor/iaas/backend.py/OpenStackBackend.push_floating_ip_to_instance