Esempio n. 1
0
 def _get_account_addr(self):
     try:
         acct_instance = self.cs.next_instance('account')
         acct_addr = acct_instance.get('addr')
     except Exception:
         raise ClientException("No Account service found")
     return acct_addr
Esempio n. 2
0
 def _lookup_rdir_host(self, resp):
     host = None
     for srv in resp.get('srv', {}):
         if srv['type'] == 'rdir':
             host = srv['host']
     if not host:
         raise ClientException("No rdir service found")
     return host
Esempio n. 3
0
 def _get_account_addr(self):
     """Fetch IP and port of an account service from Conscience."""
     try:
         acct_instance = self.cs.next_instance('account')
         acct_addr = acct_instance.get('addr')
     except Exception:
         raise ClientException("No Account service found")
     return acct_addr
Esempio n. 4
0
    def _get_rdir_addr(self, volume_id):
        try:
            resp = self.directory_client.show(acct='_RDIR',
                                              ref=volume_id,
                                              srv_type='rdir')
        except NotFound as e:
            if self.autocreate:
                self.directory_client.link('_RDIR',
                                           volume_id,
                                           'rdir',
                                           autocreate=True)
                resp = self.directory_client.show(acct='_RDIR',
                                                  ref=volume_id,
                                                  srv_type='rdir')
            else:
                raise e

        for srv in resp['srv']:
            if srv['type'] == 'rdir':
                return srv['host']
        raise ClientException("No rdir service found")