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

12 statements  

« prev     ^ index     » next       coverage.py v7.6.12, created at 2025-04-24 11:16 +0000

1# Copyright 2014 NEC Corporation. All rights reserved. 

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 

19 

20evacuate = { 

21 'type': 'object', 

22 'properties': { 

23 'evacuate': { 

24 'type': 'object', 

25 'properties': { 

26 'host': parameter_types.fqdn, 

27 'onSharedStorage': parameter_types.boolean, 

28 'adminPass': parameter_types.admin_password, 

29 }, 

30 'required': ['onSharedStorage'], 

31 'additionalProperties': False, 

32 }, 

33 }, 

34 'required': ['evacuate'], 

35 'additionalProperties': False, 

36} 

37 

38evacuate_v214 = copy.deepcopy(evacuate) 

39del evacuate_v214['properties']['evacuate']['properties']['onSharedStorage'] 

40del evacuate_v214['properties']['evacuate']['required'] 

41 

42evacuate_v229 = copy.deepcopy(evacuate_v214) 

43evacuate_v229['properties']['evacuate']['properties'][ 

44 'force'] = parameter_types.boolean 

45 

46# v2.68 removes the 'force' parameter added in v2.29, meaning it is identical 

47# to v2.14 

48evacuate_v268 = copy.deepcopy(evacuate_v214) 

49 

50# v2.95 keeps the same schema, evacuating an instance will now result its state 

51# to be stopped at destination. 

52evacuate_v295 = copy.deepcopy(evacuate_v268) 

53 

54evacuate_response = { 

55 'type': ['object', 'null'], 

56 'properties': { 

57 'adminPass': { 

58 'type': ['null', 'string'], 

59 } 

60 }, 

61 # adminPass is a rare-example of configuration-driven API behavior: the 

62 # value depends on '[api] enable_instance_password' 

63 'required': [], 

64 'additionalProperties': False, 

65} 

66 

67evacuate_response_v214 = { 

68 'type': 'null', 

69}