Update storage CDM collector

Storage CDM can not be build for some environment such as
the one using VMwareVcVmdkDriver, since some attributes of
Storage CDM'S pool element can be 'unknown'.

This patch updates storage CDM collector to raise watcher
specific exception if some attributes of storage CDM'S pool
element is 'unknown'

Change-Id: If75a909025c8d764e4de6e20f058b84e23123c1a
Closes-Bug: #1751206
This commit is contained in:
Hidekazu Nakamura
2018-05-23 10:51:26 +09:00
parent 7556d19638
commit 3c83077724
3 changed files with 66 additions and 0 deletions

View File

@@ -222,8 +222,21 @@ class ModelBuilder(object):
:param pool: A storage pool
:type pool: :py:class:`~cinderlient.v2.capabilities.Capabilities`
:raises: exception.InvalidPoolAttributeValue
"""
# build up the storage pool.
attrs = ["total_volumes", "total_capacity_gb",
"free_capacity_gb", "provisioned_capacity_gb",
"allocated_capacity_gb"]
for attr in attrs:
try:
int(getattr(pool, attr))
except ValueError:
raise exception.InvalidPoolAttributeValue(
name=pool.name, attribute=attr)
node_attributes = {
"name": pool.name,
"total_volumes": pool.total_volumes,