Coverage for manila/api/views/share_migration.py: 91%

11 statements  

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

1# Copyright (c) 2016 Hitachi Data Systems. 

2# All Rights Reserved. 

3# 

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

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

6# a copy of the License at 

7# 

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

9# 

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

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

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

13# License for the specific language governing permissions and limitations 

14# under the License. 

15 

16from manila.api import common 

17 

18 

19class ViewBuilder(common.ViewBuilder): 

20 """Model share migration view data response as a python dictionary.""" 

21 

22 _collection_name = 'share_migration' 

23 _detail_version_modifiers = [ 

24 'add_progress_details', 

25 ] 

26 

27 def get_progress(self, request, share, progress): 

28 """View of share migration job progress.""" 

29 result = { 

30 'total_progress': progress.pop('total_progress'), 

31 'task_state': share['task_state'], 

32 } 

33 self.update_versioned_resource_dict(request, result, progress) 

34 return result 

35 

36 @common.ViewBuilder.versioned_method('2.59') 

37 def add_progress_details(self, context, progress_dict, progress): 

38 progress_dict['details'] = progress