

def authorize_console(self, context, token, console_type, host, port, internal_access_path, instance_uuid, access_url=None):
    token_dict = {
        'token': token,
        'instance_uuid': instance_uuid,
        'console_type': console_type,
        'host': host,
        'port': port,
        'internal_access_path': internal_access_path,
        'access_url': access_url,
        'last_activity_at': time.time(),
    }
    data = jsonutils.dumps(token_dict)
    if (not self.mc.set(token.encode('UTF-8'), data)):
        LOG.warning(_LW('Token: %(token)s failed to save into memcached.'), {
            'token': token,
        })
    tokens = self._get_tokens_for_instance(instance_uuid)
    token_values = self.mc.get_multi([tok.encode('UTF-8') for tok in tokens])
    tokens = [name for (name, value) in zip(tokens, token_values) if (value is not None)]
    tokens.append(token)
    if (not self.mc_instance.set(instance_uuid.encode('UTF-8'), jsonutils.dumps(tokens))):
        LOG.warning(_LW('Instance: %(instance_uuid)s failed to save into memcached'), {
            'instance_uuid': instance_uuid,
        })
    LOG.info(_LI('Received Token: %(token)s, %(token_dict)s'), {
        'token': token,
        'token_dict': token_dict,
    })

dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/consoleauth/manager.py ConsoleAuthManager.authorize_console/original