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

8 statements  

« prev     ^ index     » next       coverage.py v7.6.12, created at 2025-04-17 15:08 +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 

19service_update = { 

20 'type': 'object', 

21 'properties': { 

22 'host': parameter_types.fqdn, 

23 'binary': { 

24 'type': 'string', 'minLength': 1, 'maxLength': 255, 

25 }, 

26 'disabled_reason': { 

27 'type': 'string', 'minLength': 1, 'maxLength': 255, 

28 } 

29 }, 

30 'required': ['host', 'binary'], 

31 'additionalProperties': False 

32} 

33 

34service_update_v211 = { 

35 'type': 'object', 

36 'properties': { 

37 'host': parameter_types.fqdn, 

38 'binary': { 

39 'type': 'string', 'minLength': 1, 'maxLength': 255, 

40 }, 

41 'disabled_reason': { 

42 'type': 'string', 'minLength': 1, 'maxLength': 255, 

43 }, 

44 'forced_down': parameter_types.boolean 

45 }, 

46 'required': ['host', 'binary'], 

47 'additionalProperties': False 

48} 

49 

50# The 2.53 body is for updating a service's status and/or forced_down fields. 

51# There are no required attributes since the service is identified using a 

52# unique service_id on the request path, and status and/or forced_down can 

53# be specified in the body. If status=='disabled', then 'disabled_reason' is 

54# also checked in the body but is not required. Requesting status='enabled' and 

55# including a 'disabled_reason' results in a 400, but this is checked in code. 

56service_update_v2_53 = { 

57 'type': 'object', 

58 'properties': { 

59 'status': { 

60 'type': 'string', 

61 'enum': ['enabled', 'disabled'], 

62 }, 

63 'disabled_reason': { 

64 'type': 'string', 'minLength': 1, 'maxLength': 255, 

65 }, 

66 'forced_down': parameter_types.boolean 

67 }, 

68 'additionalProperties': False 

69} 

70 

71 

72index_query_schema = { 

73 'type': 'object', 

74 'properties': { 

75 'host': parameter_types.common_query_param, 

76 'binary': parameter_types.common_query_param, 

77 }, 

78 # For backward compatible changes 

79 'additionalProperties': True 

80} 

81 

82index_query_schema_275 = copy.deepcopy(index_query_schema) 

83index_query_schema_275['additionalProperties'] = False