From f609e3a0d7112777566a68174561c9cdac6f97c3 Mon Sep 17 00:00:00 2001 From: Ramamani Yeleswarapu Date: Fri, 22 Apr 2016 16:03:36 -0700 Subject: [PATCH] Centralize config options - [iscsi] Nova style refactor of config options in Ironic. Change-Id: I238af0a0d92073cdf62b5303550e5ada25a69655 Partial-Bug: #1561100 --- ironic/conf/__init__.py | 2 ++ ironic/conf/iscsi.py | 30 ++++++++++++++++++++++++++ ironic/conf/opts.py | 3 +-- ironic/drivers/modules/iscsi_deploy.py | 10 --------- 4 files changed, 33 insertions(+), 12 deletions(-) create mode 100644 ironic/conf/iscsi.py diff --git a/ironic/conf/__init__.py b/ironic/conf/__init__.py index 5c8a0e18db..7164395fa0 100644 --- a/ironic/conf/__init__.py +++ b/ironic/conf/__init__.py @@ -32,6 +32,7 @@ from ironic.conf import ilo from ironic.conf import inspector from ironic.conf import ipmi from ironic.conf import irmc +from ironic.conf import iscsi from ironic.conf import keystone from ironic.conf import metrics from ironic.conf import metrics_statsd @@ -64,6 +65,7 @@ ilo.register_opts(CONF) inspector.register_opts(CONF) ipmi.register_opts(CONF) irmc.register_opts(CONF) +iscsi.register_opts(CONF) keystone.register_opts(CONF) metrics.register_opts(CONF) metrics_statsd.register_opts(CONF) diff --git a/ironic/conf/iscsi.py b/ironic/conf/iscsi.py new file mode 100644 index 0000000000..c9b95222e9 --- /dev/null +++ b/ironic/conf/iscsi.py @@ -0,0 +1,30 @@ +# 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.PortOpt('portal_port', + default=3260, + help=_('The port number on which the iSCSI portal listens ' + 'for incoming connections.')), +] + + +def register_opts(conf): + conf.register_opts(opts, group='iscsi') diff --git a/ironic/conf/opts.py b/ironic/conf/opts.py index fdbcca30c9..b1571bfddc 100644 --- a/ironic/conf/opts.py +++ b/ironic/conf/opts.py @@ -14,7 +14,6 @@ import itertools import ironic.drivers.modules.amt.common import ironic.drivers.modules.amt.power -import ironic.drivers.modules.iscsi_deploy _default_opt_lists = [ ironic.conf.default.api_opts, @@ -50,7 +49,7 @@ _opts = [ ('inspector', ironic.conf.inspector.list_opts()), ('ipmi', ironic.conf.ipmi.opts), ('irmc', ironic.conf.irmc.opts), - ('iscsi', ironic.drivers.modules.iscsi_deploy.iscsi_opts), + ('iscsi', ironic.conf.iscsi.opts), ('keystone', ironic.conf.keystone.opts), ('metrics', ironic.conf.metrics.opts), ('metrics_statsd', ironic.conf.metrics_statsd.opts), diff --git a/ironic/drivers/modules/iscsi_deploy.py b/ironic/drivers/modules/iscsi_deploy.py index 4f13a5a94c..5f710363b0 100644 --- a/ironic/drivers/modules/iscsi_deploy.py +++ b/ironic/drivers/modules/iscsi_deploy.py @@ -18,7 +18,6 @@ import os from ironic_lib import disk_utils from ironic_lib import metrics_utils from ironic_lib import utils as ironic_utils -from oslo_config import cfg from oslo_log import log as logging from oslo_utils import fileutils from six.moves.urllib import parse @@ -40,15 +39,6 @@ LOG = logging.getLogger(__name__) METRICS = metrics_utils.get_metrics_logger(__name__) -iscsi_opts = [ - cfg.PortOpt('portal_port', - default=3260, - help=_('The port number on which the iSCSI portal listens ' - 'for incoming connections.')), -] - -CONF.register_opts(iscsi_opts, group='iscsi') - DISK_LAYOUT_PARAMS = ('root_gb', 'swap_mb', 'ephemeral_gb')