- super().__init__(config, vim_account_id)
- self.auth_manager = AuthManager(config)
- self.keystone_client = self._build_keystone_client(vim_account_id)
-
- def is_vim_ok(self) -> bool:
- try:
- self.keystone_client.projects.list()
- return True
- except Exception:
- log.exception("VIM status is not OK!")
- return False
-
- def _build_keystone_client(self, vim_account_id):
- creds = self.auth_manager.get_credentials(vim_account_id)
- verify_ssl = self.auth_manager.is_verify_ssl(vim_account_id)
- auth = v3.Password(auth_url=creds.url,
- username=creds.user,
- password=creds.password,
- project_name=creds.tenant_name,
- project_domain_id='default',
- user_domain_id='default')
- sess = session.Session(auth=auth, verify=verify_ssl)
- return client.Client(session=sess)