projects
/
osm
/
MON.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix for Bug 1433 Exception handling in aioread method
[osm/MON.git]
/
osm_mon
/
collector
/
infra_collectors
/
base_osinfra.py
diff --git
a/osm_mon/collector/infra_collectors/base_osinfra.py
b/osm_mon/collector/infra_collectors/base_osinfra.py
index
9c8447c
..
1c1999c
100644
(file)
--- a/
osm_mon/collector/infra_collectors/base_osinfra.py
+++ b/
osm_mon/collector/infra_collectors/base_osinfra.py
@@
-46,7
+46,10
@@
class BaseOpenStackInfraCollector(BaseVimInfraCollector):
def collect(self) -> List[Metric]:
metrics = []
vim_status = self.is_vim_ok()
def collect(self) -> List[Metric]:
metrics = []
vim_status = self.is_vim_ok()
- vim_project_id = self.vim_account['_admin']['projects_read'][0]
+ if self.vim_account['_admin']['projects_read']:
+ vim_project_id = self.vim_account['_admin']['projects_read'][0]
+ else:
+ vim_project_id = ''
vim_tags = {
'vim_account_id': self.vim_account['_id'],
'project_id': vim_project_id
vim_tags = {
'vim_account_id': self.vim_account['_id'],
'project_id': vim_project_id
@@
-58,7
+61,10
@@
class BaseOpenStackInfraCollector(BaseVimInfraCollector):
nsr_id = vnfr['nsr-id-ref']
ns_name = self.common_db.get_nsr(nsr_id)['name']
vnf_member_index = vnfr['member-vnf-index-ref']
nsr_id = vnfr['nsr-id-ref']
ns_name = self.common_db.get_nsr(nsr_id)['name']
vnf_member_index = vnfr['member-vnf-index-ref']
- vnfr_project_id = vnfr['_admin']['projects_read'][0]
+ if vnfr['_admin']['projects_read']:
+ vnfr_project_id = vnfr['_admin']['projects_read'][0]
+ else:
+ vnfr_project_id = ''
for vdur in vnfr['vdur']:
if 'vim-id' not in vdur:
log.debug("Field vim-id is not present in vdur")
for vdur in vnfr['vdur']:
if 'vim-id' not in vdur:
log.debug("Field vim-id is not present in vdur")
@@
-70,7
+76,7
@@
class BaseOpenStackInfraCollector(BaseVimInfraCollector):
'nsr_id': nsr_id,
'ns_name': ns_name,
'vnf_member_index': vnf_member_index,
'nsr_id': nsr_id,
'ns_name': ns_name,
'vnf_member_index': vnf_member_index,
- 'vdur_name': vdur
['name']
,
+ 'vdur_name': vdur
.get("name", "")
,
'project_id': vnfr_project_id
}
try:
'project_id': vnfr_project_id
}
try:
@@
-94,8
+100,8
@@
class BaseOpenStackInfraCollector(BaseVimInfraCollector):
def _build_keystone_client(self, vim_account: dict) -> keystone_client.Client:
sess = OpenstackUtils.get_session(vim_account)
def _build_keystone_client(self, vim_account: dict) -> keystone_client.Client:
sess = OpenstackUtils.get_session(vim_account)
- return keystone_client.Client(session=sess)
+ return keystone_client.Client(session=sess
, timeout=10
)
def _build_nova_client(self, vim_account: dict) -> nova_client.Client:
sess = OpenstackUtils.get_session(vim_account)
def _build_nova_client(self, vim_account: dict) -> nova_client.Client:
sess = OpenstackUtils.get_session(vim_account)
- return nova_client.Client("2", session=sess)
+ return nova_client.Client("2", session=sess
, timeout=10
)