def create_trust_context(self):
        if self.context.trust_id:
            return self.context

        # We need the service admin user ID (not name), as the trustor user
        # can't lookup the ID in keystoneclient unless they're admin
        # workaround this by getting the user_id from admin_client
        trustee_user_id = self.admin_client.auth_ref.user_id
        trustor_user_id = self.client.auth_ref.user_id
        trustor_project_id = self.client.auth_ref.project_id
        roles = cfg.CONF.trusts_delegated_roles
        trust = self.client.trusts.create(trustor_user=trustor_user_id,
                                          trustee_user=trustee_user_id,
                                          project=trustor_project_id,
                                          impersonation=True,
                                          role_names=roles)

        trust_context = context.RequestContext.from_dict(
            self.context.to_dict())
        trust_context.trust_id = trust.id
        return trust_context
Create a trust using the trustor identity in the current context.
dataset/ETHPy150Open openstack/solum/solum/common/solum_keystoneclient.py/KeystoneClientV3.create_trust_context