Files
watcher/releasenotes/notes/960265-optional-pool-fields-storage-xml-26701a4ce5e54f2b.yaml
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

12 lines
483 B
YAML

---
fixes:
- |
Fixed the errors showing in the decision engine logs when generating the
xml representation of the storage model when using some storage backends
other than lvms (like ceph or nfs). Those drivers do not report pool
fields like total_volumes or free_capacity_gb that the lvm driver does,
so assuming those fields are always reported by the cinder api calls is
wrong.
See: https://bugs.launchpad.net/watcher/+bug/2121147 for more details.