jgilaber 7e7a31a1f7 Handle missing fields building storage model XML or list
When generating XML or list representations of the storage model, Watcher
assumed that certain fields will always be present. Some fields,
like 'total_volumes', are reported by the LVM driver but not by
others such as the NFS driver, logging NotImplementedError exceptions
that do not prevent the model being built but can be confusing for the user.

Add specific exception handling for NotImplementedError in the
as_xml_element() method and to_list(), allowing the code to gracefully
skip missing fields and continue processing. When an optional field is not
available, a debug message is logged indicating which attribute is
missing.

This approach aligns with the existing error handling in the Cinder
collector[1] and ensures that audits can complete
successfully regardless of which storage backend is in use.

As a follow-up, we can remove fields in the Pool model[2] which are
marked as optional in Cinder's volume driver interface[3] and may not be
available from all drivers:

- total_volumes: Number of volumes in the pool
- free_capacity_gb: Free capacity in GB
- provisioned_capacity_gb: Provisioned capacity in GB
- allocated_capacity_gb: Allocated capacity in GB

[1] https://github.com/openstack/watcher/blob/master/watcher/decision_engine/model/collector/cinder.py#L250
[2] https://github.com/openstack/watcher/blob/master/watcher/decision_engine/model/element/node.py#L87-L93
[3] https://github.com/openstack/cinder/blob/master/cinder/interface/volume_driver.py#L78

Closes-Bug: #2121147

Change-Id: Icce725c05c48b83f7bc4c6d573d3fbe759f5866b
Signed-off-by: jgilaber <jgilaber@redhat.com>
2026-02-27 18:43:24 +01:00
2025-10-03 17:22:43 +01:00
2025-09-13 11:49:11 +09:00
2019-04-19 19:40:45 +00:00
2015-06-04 15:27:57 +02:00
2018-07-10 15:38:50 +07:00
2025-05-19 23:55:20 +00:00
2017-04-07 10:55:59 +08:00
2018-02-28 03:58:07 +00:00
2015-06-04 15:27:57 +02:00
2025-12-11 02:35:07 +09:00
2025-12-10 07:19:48 +00:00
2026-02-19 12:13:13 +01:00
2020-04-09 02:37:00 +00:00

Watcher

image

OpenStack Watcher provides a flexible and scalable resource optimization service for multi-tenant OpenStack-based clouds. Watcher provides a robust framework to realize a wide range of cloud optimization goals, including the reduction of data center operating costs, increased system performance via intelligent virtual machine migration, increased energy efficiency and more!

S
Description
Resource optimization service for OpenStack.
Readme 41 MiB
Languages
Python 99.5%
Shell 0.5%