diff --git a/ironic/conf/__init__.py b/ironic/conf/__init__.py index 7e5703b91a..8f95572d58 100644 --- a/ironic/conf/__init__.py +++ b/ironic/conf/__init__.py @@ -29,6 +29,7 @@ from ironic.conf import irmc from ironic.conf import keystone from ironic.conf import oneview from ironic.conf import seamicro +from ironic.conf import snmp CONF = cfg.CONF @@ -46,3 +47,4 @@ irmc.register_opts(CONF) keystone.register_opts(CONF) oneview.register_opts(CONF) seamicro.register_opts(CONF) +snmp.register_opts(CONF) diff --git a/ironic/conf/opts.py b/ironic/conf/opts.py index 07853b871a..8d08968c6d 100644 --- a/ironic/conf/opts.py +++ b/ironic/conf/opts.py @@ -34,7 +34,6 @@ import ironic.drivers.modules.deploy_utils import ironic.drivers.modules.image_cache import ironic.drivers.modules.iscsi_deploy import ironic.drivers.modules.pxe -import ironic.drivers.modules.snmp import ironic.drivers.modules.ssh import ironic.drivers.modules.virtualbox import ironic.netconf @@ -85,7 +84,7 @@ _opts = [ ironic.drivers.modules.iscsi_deploy.pxe_opts, ironic.drivers.modules.pxe.pxe_opts)), ('seamicro', ironic.conf.seamicro.opts), - ('snmp', ironic.drivers.modules.snmp.opts), + ('snmp', ironic.conf.snmp.opts), ('ssh', ironic.drivers.modules.ssh.libvirt_opts), ('swift', ironic.common.swift.swift_opts), ('virtualbox', ironic.drivers.modules.virtualbox.opts), diff --git a/ironic/conf/snmp.py b/ironic/conf/snmp.py new file mode 100644 index 0000000000..acaae9ad02 --- /dev/null +++ b/ironic/conf/snmp.py @@ -0,0 +1,41 @@ +# Copyright 2016 Intel Corporation +# Copyright 2013,2014 Cray Inc +# +# Authors: David Hewson +# Stig Telfer +# Mark Goddard +# +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from oslo_config import cfg + +from ironic.common.i18n import _ + +opts = [ + cfg.IntOpt('power_timeout', + default=10, + help=_('Seconds to wait for power action to be completed')), + # NOTE(yuriyz): some of SNMP-enabled hardware have own options for pause + # between off and on. This option guarantees minimal value. + cfg.IntOpt('reboot_delay', + default=0, + min=0, + help=_('Time (in seconds) to sleep between when rebooting ' + '(powering off and on again)')) +] + + +def register_opts(conf): + conf.register_opts(opts, group='snmp') diff --git a/ironic/drivers/modules/snmp.py b/ironic/drivers/modules/snmp.py index 4787b56368..af5d7b72b0 100644 --- a/ironic/drivers/modules/snmp.py +++ b/ironic/drivers/modules/snmp.py @@ -30,7 +30,6 @@ models. import abc import time -from oslo_config import cfg from oslo_log import log as logging from oslo_service import loopingcall from oslo_utils import importutils @@ -42,6 +41,7 @@ from ironic.common.i18n import _LW from ironic.common import states from ironic.common import utils from ironic.conductor import task_manager +from ironic.conf import CONF from ironic.drivers import base pysnmp = importutils.try_import('pysnmp') @@ -54,24 +54,8 @@ else: snmp_error = None rfc1902 = None -opts = [ - cfg.IntOpt('power_timeout', - default=10, - help=_('Seconds to wait for power action to be completed')), - # NOTE(yuriyz): some of SNMP-enabled hardware have own options for pause - # between off and on. This option guarantees minimal value. - cfg.IntOpt('reboot_delay', - default=0, - min=0, - help=_('Time (in seconds) to sleep between when rebooting ' - '(powering off and on again)')) -] - LOG = logging.getLogger(__name__) -CONF = cfg.CONF -CONF.register_opts(opts, group='snmp') - SNMP_V1 = '1' SNMP_V2C = '2c'