Fix: failed to create snapshot with DriverFilter
Previously, while creating snapshots, the code didn't pass through scheduler therefore available capacity for backend wasn't checked. This was supported by [1] which passed a RequestSpec object to scheduler with snapshot and volume properties (the same RequestSpec object is used for volumes). But when the scheduler tries to get volume_type from RequestSpec obj, unfortunately, it has a property named 'volume_type' but is None for snapshots which breaks the scheduler when getting extra_specs from the volume type (as the default value {} would've been set if the property didn't exist). Similar issue occurred when we supported untyped volumes and was fixed by [2] and [3]. This patch sets the volume_type to an empty dict when it is found None (which is the case while creating snapshots). [1] https://review.opendev.org/#/c/509011/ [2] https://review.opendev.org/#/c/457431/ [3] https://review.opendev.org/#/c/471672/ Change-Id: I89a8cc42ca8984ee837a2b88f60ad126783282b9 Closes-Bug: #1856126
This commit is contained in:
parent
3ab8ec971c
commit
1e67072122
@ -287,7 +287,12 @@ class FilterScheduler(driver.Scheduler):
|
||||
# takes 'resource_XX' and 'volume_XX' as input respectively, copying
|
||||
# 'volume_XX' to 'resource_XX' will make both filters happy.
|
||||
volume_type = request_spec.get("volume_type")
|
||||
resource_type = volume_type if volume_type is not None else {}
|
||||
# When creating snapshots, the value of volume_type is None here
|
||||
# which causes issues in filters (Eg: Bug #1856126).
|
||||
# To prevent that, we set it as an empty dictionary here.
|
||||
if volume_type is None:
|
||||
volume_type = {}
|
||||
resource_type = volume_type
|
||||
|
||||
config_options = self._get_configuration_options()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user