diff --git a/ironic/conf/__init__.py b/ironic/conf/__init__.py index 8f95572d58..929b9ec173 100644 --- a/ironic/conf/__init__.py +++ b/ironic/conf/__init__.py @@ -30,6 +30,7 @@ from ironic.conf import keystone from ironic.conf import oneview from ironic.conf import seamicro from ironic.conf import snmp +from ironic.conf import ssh CONF = cfg.CONF @@ -48,3 +49,4 @@ keystone.register_opts(CONF) oneview.register_opts(CONF) seamicro.register_opts(CONF) snmp.register_opts(CONF) +ssh.register_opts(CONF) diff --git a/ironic/conf/opts.py b/ironic/conf/opts.py index 8d08968c6d..63c65202e2 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.ssh import ironic.drivers.modules.virtualbox import ironic.netconf @@ -85,7 +84,7 @@ _opts = [ ironic.drivers.modules.pxe.pxe_opts)), ('seamicro', ironic.conf.seamicro.opts), ('snmp', ironic.conf.snmp.opts), - ('ssh', ironic.drivers.modules.ssh.libvirt_opts), + ('ssh', ironic.conf.ssh.opts), ('swift', ironic.common.swift.swift_opts), ('virtualbox', ironic.drivers.modules.virtualbox.opts), ] diff --git a/ironic/conf/ssh.py b/ironic/conf/ssh.py new file mode 100644 index 0000000000..4ae4aabc13 --- /dev/null +++ b/ironic/conf/ssh.py @@ -0,0 +1,38 @@ +# Copyright 2016 Intel Corporation +# Copyright 2013 Hewlett-Packard Development Company, L.P. +# 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.StrOpt('libvirt_uri', + default='qemu:///system', + help=_('libvirt URI.')), + cfg.IntOpt('get_vm_name_attempts', + default=3, + help=_("Number of attempts to try to get VM name used by the " + "host that corresponds to a node's MAC address.")), + cfg.IntOpt('get_vm_name_retry_interval', + default=3, + help=_("Number of seconds to wait between attempts to get " + "VM name used by the host that corresponds to a " + "node's MAC address.")), +] + + +def register_opts(conf): + conf.register_opts(opts, group='ssh') diff --git a/ironic/drivers/modules/ssh.py b/ironic/drivers/modules/ssh.py index 38da701ed8..9002c7acb1 100644 --- a/ironic/drivers/modules/ssh.py +++ b/ironic/drivers/modules/ssh.py @@ -31,7 +31,6 @@ Currently supported environments are: import os from oslo_concurrency import processutils -from oslo_config import cfg from oslo_log import log as logging from oslo_utils import excutils from oslo_utils import strutils @@ -46,28 +45,11 @@ 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 from ironic.drivers.modules import console_utils from ironic.drivers import utils as driver_utils -libvirt_opts = [ - cfg.StrOpt('libvirt_uri', - default='qemu:///system', - help=_('libvirt URI.')), - cfg.IntOpt('get_vm_name_attempts', - default=3, - help=_("Number of attempts to try to get VM name used by the " - "host that corresponds to a node's MAC address.")), - cfg.IntOpt('get_vm_name_retry_interval', - default=3, - help=_("Number of seconds to wait between attempts to get " - "VM name used by the host that corresponds to a " - "node's MAC address.")), -] - -CONF = cfg.CONF -CONF.register_opts(libvirt_opts, group='ssh') - LOG = logging.getLogger(__name__) REQUIRED_PROPERTIES = {