Coverage for watcher/conf/decision_engine.py: 100%

8 statements  

« prev     ^ index     » next       coverage.py v7.8.2, created at 2025-06-17 12:22 +0000

1# -*- encoding: utf-8 -*- 

2# Copyright (c) 2015 Intel Corp 

3# 

4# Authors: Prudhvi Rao Shedimbi <prudhvi.rao.shedimbi@intel.com> 

5# 

6# Licensed under the Apache License, Version 2.0 (the "License"); 

7# you may not use this file except in compliance with the License. 

8# You may obtain a copy of the License at 

9# 

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

11# 

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

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

14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 

15# implied. 

16# See the License for the specific language governing permissions and 

17# limitations under the License. 

18 

19from oslo_config import cfg 

20 

21 

22watcher_decision_engine = cfg.OptGroup(name='watcher_decision_engine', 

23 title='Defines the parameters of ' 

24 'the module decision engine') 

25 

26WATCHER_DECISION_ENGINE_OPTS = [ 

27 cfg.StrOpt('conductor_topic', 

28 default='watcher.decision.control', 

29 help='The topic name used for ' 

30 'control events, this topic ' 

31 'used for RPC calls'), 

32 cfg.ListOpt('notification_topics', 

33 default=['nova.versioned_notifications', 

34 'watcher.watcher_notifications'], 

35 help='The exchange and topic names from which ' 

36 'notification events will be listened to. ' 

37 'The exchange should be specified to get ' 

38 'an ability to use pools.'), 

39 cfg.StrOpt('publisher_id', 

40 default='watcher.decision.api', 

41 help='The identifier used by the Watcher ' 

42 'module on the message broker'), 

43 cfg.IntOpt('max_audit_workers', 

44 default=2, 

45 required=True, 

46 help='The maximum number of threads that can be used to ' 

47 'execute audits in parallel.'), 

48 cfg.IntOpt('max_general_workers', 

49 default=4, 

50 required=True, 

51 help='The maximum number of threads that can be used to ' 

52 'execute general tasks in parallel. The number of general ' 

53 'workers will not increase depending on the number of ' 

54 'audit workers!'), 

55 cfg.IntOpt('action_plan_expiry', 

56 default=24, 

57 mutable=True, 

58 help='An expiry timespan(hours). Watcher invalidates any ' 

59 'action plan for which its creation time ' 

60 '-whose number of hours has been offset by this value-' 

61 ' is older that the current time.'), 

62 cfg.IntOpt('check_periodic_interval', 

63 default=30 * 60, 

64 mutable=True, 

65 help='Interval (in seconds) for checking action plan expiry.'), 

66 cfg.StrOpt('metric_map_path', 

67 default='/etc/watcher/metric_map.yaml', 

68 help='Path to metric map yaml formatted file. ' 

69 ' ' 

70 'The file contains a map per datasource whose keys ' 

71 'are the metric names as recognized by watcher and the ' 

72 'value is the real name of the metric in the datasource. ' 

73 'For example:: \n\n' 

74 ' monasca:\n' 

75 ' instance_cpu_usage: VM_CPU\n' 

76 ' gnocchi:\n' 

77 ' instance_cpu_usage: cpu_vm_util\n\n' 

78 'This file is optional.'), 

79 cfg.IntOpt('continuous_audit_interval', 

80 default=10, 

81 mutable=True, 

82 help='Interval (in seconds) for checking newly created ' 

83 'continuous audits.')] 

84 

85 

86def register_opts(conf): 

87 conf.register_group(watcher_decision_engine) 

88 conf.register_opts(WATCHER_DECISION_ENGINE_OPTS, 

89 group=watcher_decision_engine) 

90 

91 

92def list_opts(): 

93 return [(watcher_decision_engine, WATCHER_DECISION_ENGINE_OPTS)]