Centralize config options - [virtualbox]

Nova style refactor of config options in Ironic.

Change-Id: I9c7b1ea0c4c35eaacc4655d605993297242f0c0a
Partial-Bug: #1561100
This commit is contained in:
Ramamani Yeleswarapu 2016-04-08 16:05:09 -07:00
parent 4938c8ec63
commit 28f74a8c9c
4 changed files with 31 additions and 11 deletions

View File

@ -32,6 +32,7 @@ from ironic.conf import seamicro
from ironic.conf import snmp from ironic.conf import snmp
from ironic.conf import ssh from ironic.conf import ssh
from ironic.conf import swift from ironic.conf import swift
from ironic.conf import virtualbox
CONF = cfg.CONF CONF = cfg.CONF
@ -52,3 +53,4 @@ seamicro.register_opts(CONF)
snmp.register_opts(CONF) snmp.register_opts(CONF)
ssh.register_opts(CONF) ssh.register_opts(CONF)
swift.register_opts(CONF) swift.register_opts(CONF)
virtualbox.register_opts(CONF)

View File

@ -33,7 +33,6 @@ import ironic.drivers.modules.deploy_utils
import ironic.drivers.modules.image_cache import ironic.drivers.modules.image_cache
import ironic.drivers.modules.iscsi_deploy import ironic.drivers.modules.iscsi_deploy
import ironic.drivers.modules.pxe import ironic.drivers.modules.pxe
import ironic.drivers.modules.virtualbox
import ironic.netconf import ironic.netconf
_default_opt_lists = [ _default_opt_lists = [
@ -85,7 +84,7 @@ _opts = [
('snmp', ironic.conf.snmp.opts), ('snmp', ironic.conf.snmp.opts),
('ssh', ironic.conf.ssh.opts), ('ssh', ironic.conf.ssh.opts),
('swift', ironic.conf.swift.opts), ('swift', ironic.conf.swift.opts),
('virtualbox', ironic.drivers.modules.virtualbox.opts), ('virtualbox', ironic.conf.virtualbox.opts),
] ]

27
ironic/conf/virtualbox.py Normal file
View File

@ -0,0 +1,27 @@
# Copyright 2016 Intel Corporation
#
# 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.PortOpt('port',
default=18083,
help=_('Port on which VirtualBox web service is listening.')),
]
def register_opts(conf):
conf.register_opts(opts, group='virtualbox')

View File

@ -14,7 +14,6 @@
VirtualBox Driver Modules VirtualBox Driver Modules
""" """
from oslo_config import cfg
from oslo_log import log as logging from oslo_log import log as logging
from oslo_utils import importutils from oslo_utils import importutils
@ -26,6 +25,7 @@ from ironic.common.i18n import _LW
from ironic.common import states from ironic.common import states
from ironic.common import utils from ironic.common import utils
from ironic.conductor import task_manager from ironic.conductor import task_manager
from ironic.conf import CONF
from ironic.drivers import base from ironic.drivers import base
pyremotevbox = importutils.try_import('pyremotevbox') pyremotevbox = importutils.try_import('pyremotevbox')
@ -47,14 +47,6 @@ VIRTUALBOX_TO_IRONIC_POWER_MAPPING = {
'Error': states.ERROR 'Error': states.ERROR
} }
opts = [
cfg.PortOpt('port',
default=18083,
help=_('Port on which VirtualBox web service is listening.')),
]
CONF = cfg.CONF
CONF.register_opts(opts, group='virtualbox')
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
REQUIRED_PROPERTIES = { REQUIRED_PROPERTIES = {