'Returns a fixed IP to the pool.'

def deallocate_fixed_ip(self, context, address, host=None, teardown=True, instance=None):

    fixed_ip_ref = objects.FixedIP.get_by_address(context, address, expected_attrs=['network'])
    instance_uuid = fixed_ip_ref.instance_uuid
    vif_id = fixed_ip_ref.virtual_interface_id
    LOG.debug('Deallocate    fixed    IP    %s', address, instance_uuid=instance_uuid)
    if (not instance):
        instance = objects.Instance.get_by_uuid(context.elevated(read_deleted='yes'), instance_uuid)
    self._do_trigger_security_group_members_refresh_for_instance(instance_uuid)
    if self._validate_instance_zone_for_dns_domain(context, instance):
        for n in self.instance_dns_manager.get_entries_by_address(address, self.instance_dns_domain):
            self.instance_dns_manager.delete_entry(n, self.instance_dns_domain)
    fixed_ip_ref.allocated = False
    fixed_ip_ref.save()
    if teardown:
        network = fixed_ip_ref.network
        if CONF.force_dhcp_release:
            dev = self.driver.get_dev(network)
            if (not vif_id):
                LOG.info(_LI("Unable    to    release    %s    because    vif    doesn't    exist"), address)
                return
            vif = objects.VirtualInterface.get_by_id(context, vif_id)
            if (not vif):
                LOG.info(_LI("Unable    to    release    %s    because    vif    object    doesn't    exist"), address)
                return
            self._teardown_network_on_host(context, network)
            try:
                self.network_rpcapi.release_dhcp(context, instance.launched_on, dev, address, vif.address)
            except exception.RPCPinnedToOldVersion:
                self.driver.release_dhcp(dev, address, vif.address)
            except exception.NetworkDhcpReleaseFailed:
                LOG.error(_LE('Error    releasing    DHCP    for    IP    %(address)s    with    MAC    %(mac_address)s'), {'address': address, 'mac_address': vif.address}, instance=instance)
            fixed_ip_ref = objects.FixedIP.get_by_address(context, address)
            if ((instance_uuid == fixed_ip_ref.instance_uuid) and (not fixed_ip_ref.leased)):
                LOG.debug('Explicitly    disassociating    fixed    IP    %s    from    instance.', address, instance_uuid=instance_uuid)
                fixed_ip_ref.disassociate()
        else:
            self._teardown_network_on_host(context, network)
