'Performs db and driver calls to associate floating IP & fixed IP.'

def _associate_floating_ip(self, context, floating_address, fixed_address, interface, instance_uuid):

    interface = (CONF.public_interface or interface)
    @utils.synchronized(six.text_type(floating_address))
    def do_associate():
        floating = objects.FloatingIP.associate(context, floating_address, fixed_address, self.host)
        fixed = floating.fixed_ip
        if (not fixed):
            return
        try:
            self.l3driver.add_floating_ip(floating_address, fixed_address, interface, fixed['network'])
        except processutils.ProcessExecutionError as e:
            with excutils.save_and_reraise_exception():
                try:
                    objects.FloatingIP.disassociate(context, floating_address)
                except Exception:
                    LOG.warning(_LW('Failed    to    disassociated    floating    address:    %s'), floating_address)
                    pass
                if ('Cannot    find    device' in six.text_type(e)):
                    try:
                        LOG.error(_LE('Interface    %s    not    found'), interface)
                    except Exception:
                        pass
                    raise exception.NoFloatingIpInterface(interface=interface)
        payload = dict(project_id=context.project_id, instance_id=instance_uuid, floating_ip=floating_address)
        self.notifier.info(context, 'network.floating_ip.associate', payload)
    do_associate()
