7e7a31a1f765a84ccb810f0d359ad1d964c17e27
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>
Watcher
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!
- Free software: Apache license
- Wiki: https://wiki.openstack.org/wiki/Watcher
- Source: https://opendev.org/openstack/watcher
- Bugs: https://bugs.launchpad.net/watcher
- Documentation: https://docs.openstack.org/watcher/latest/
- Release notes: https://docs.openstack.org/releasenotes/watcher/
- Design specifications: https://specs.openstack.org/openstack/watcher-specs/
Description
Languages
Python
99.5%
Shell
0.5%