Centralize config options - [ssh]

Nova style refactor of config options in Ironic.

Change-Id: I1b3e1f6d05d9fbea125933f6a410e4907fb0fadb
Partial-Bug: #1561100
This commit is contained in:
Ramamani Yeleswarapu 2016-04-08 15:39:54 -07:00
parent c3d8918f97
commit b05491433f
4 changed files with 42 additions and 21 deletions

View File

@ -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)

View File

@ -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),
]

38
ironic/conf/ssh.py Normal file
View File

@ -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')

View File

@ -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 = {