Coverage for manila/scheduler/filters/share_group_filters/consistent_snapshot.py: 78%

7 statements  

« prev     ^ index     » next       coverage.py v7.11.0, created at 2026-02-18 22:19 +0000

1# Licensed under the Apache License, Version 2.0 (the "License"); you may 

2# not use this file except in compliance with the License. You may obtain 

3# a copy of the License at 

4# 

5# http://www.apache.org/licenses/LICENSE-2.0 

6# 

7# Unless required by applicable law or agreed to in writing, software 

8# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 

9# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 

10# License for the specific language governing permissions and limitations 

11# under the License. 

12 

13 

14from manila.scheduler.filters import base_host 

15 

16 

17class ConsistentSnapshotFilter(base_host.BaseHostFilter): 

18 """Filters hosts based on possibility to create consistent SG snapshots.""" 

19 

20 def host_passes(self, host_state, filter_properties): 

21 """Return True if host will work with desired share group.""" 

22 

23 cs_group_spec = filter_properties['share_group_type'].get( 

24 'group_specs', {}).get('consistent_snapshot_support') 

25 

26 # NOTE(vpoomaryov): if 'consistent_snapshot_support' group spec 

27 # is not set, then we assume that share group owner do not care about 

28 # it, which means any host should pass this filter. 

29 if cs_group_spec is None: 29 ↛ 31line 29 didn't jump to line 31 because the condition on line 29 was always true

30 return True 

31 return cs_group_spec == host_state.sg_consistent_snapshot_support