Coverage for nova/api/openstack/compute/schemas/migrations.py: 100%

10 statements  

« prev     ^ index     » next       coverage.py v7.6.12, created at 2025-04-17 15:08 +0000

1# Copyright 2017 Huawei Technologies Co.,LTD. 

2# 

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

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

5# a copy of the License at 

6# 

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

8# 

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

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

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

12# License for the specific language governing permissions and limitations 

13# under the License. 

14 

15import copy 

16 

17from nova.api.validation import parameter_types 

18 

19list_query_schema_v20 = { 

20 'type': 'object', 

21 'properties': { 

22 'hidden': parameter_types.common_query_param, 

23 'host': parameter_types.common_query_param, 

24 'instance_uuid': parameter_types.common_query_param, 

25 'source_compute': parameter_types.common_query_param, 

26 'status': parameter_types.common_query_param, 

27 'migration_type': parameter_types.common_query_param, 

28 }, 

29 # For backward compatible changes 

30 'additionalProperties': True 

31} 

32 

33list_query_params_v259 = copy.deepcopy(list_query_schema_v20) 

34list_query_params_v259['properties'].update({ 

35 # The 2.59 microversion added support for paging by limit and marker 

36 # and filtering by changes-since. 

37 'limit': parameter_types.single_param( 

38 parameter_types.non_negative_integer), 

39 'marker': parameter_types.single_param({'type': 'string'}), 

40 'changes-since': parameter_types.single_param( 

41 {'type': 'string', 'format': 'date-time'}), 

42}) 

43list_query_params_v259['additionalProperties'] = False 

44 

45list_query_params_v266 = copy.deepcopy(list_query_params_v259) 

46list_query_params_v266['properties'].update({ 

47 'changes-before': parameter_types.single_param( 

48 {'type': 'string', 'format': 'date-time'}), 

49}) 

50 

51list_query_params_v280 = copy.deepcopy(list_query_params_v266) 

52list_query_params_v280['properties'].update({ 

53 # The 2.80 microversion added support for filtering migrations 

54 # by user_id and/or project_id 

55 'user_id': parameter_types.single_param({'type': 'string'}), 

56 'project_id': parameter_types.single_param({'type': 'string'}), 

57})