'Handles allocating the floating IP resources for an instance.
calls super class allocate_for_instance() as well
rpc.called by network_api'

def allocate_for_instance(self, context, **kwargs):

    instance_uuid = kwargs.get('instance_id')
    if (not uuidutils.is_uuid_like(instance_uuid)):
        instance_uuid = kwargs.get('instance_uuid')
    project_id = kwargs.get('project_id')
    nw_info = super(FloatingIP, self).allocate_for_instance(context, **kwargs)
    if CONF.auto_assign_floating_ip:
        context = context.elevated()
        floating_address = self.allocate_floating_ip(context, project_id, True)
        LOG.debug('floating    IP    allocation    for    instance    |%s|', floating_address, instance_uuid=instance_uuid)
        fixed_ips = nw_info.fixed_ips()
        fixed_address = fixed_ips[0]['address']
        self.associate_floating_ip(context, floating_address, fixed_address, affect_auto_assigned=True)
        nw_info = self.get_instance_nw_info(context, **kwargs)
    return nw_info
