From d91c8eedff4e337370860f2cedc5dc8db861fc79 Mon Sep 17 00:00:00 2001 From: "Kyle L. Henderson" Date: Wed, 13 Jan 2016 12:16:13 -0600 Subject: [PATCH] Centralize config options for PowerVM The Nova blueprint centralize-config-options aims to gather the many config options into a central location to make them more widely known and to provide better documentation. This PowerVM change implements the spirit of that blueprint and mimics the implementation. blueprint centralize-config-options Change-Id: Ia1e5901b27256754c807bb956b98ca2e66b1f312 --- nova_powervm/conf/__init__.py | 23 +++ nova_powervm/conf/powervm.py | 185 ++++++++++++++++++ nova_powervm/tests/conf/__init__.py | 0 nova_powervm/tests/conf/test_conf.py | 67 +++++++ .../tests/virt/powervm/test_driver.py | 3 +- .../tests/virt/powervm/volume/test_npiv.py | 4 +- .../tests/virt/powervm/volume/test_vscsi.py | 5 +- nova_powervm/virt/powervm/__init__.py | 106 ---------- nova_powervm/virt/powervm/disk/driver.py | 2 +- nova_powervm/virt/powervm/disk/localdisk.py | 24 +-- nova_powervm/virt/powervm/disk/ssp.py | 15 +- nova_powervm/virt/powervm/driver.py | 2 +- nova_powervm/virt/powervm/live_migration.py | 4 +- nova_powervm/virt/powervm/media.py | 4 +- nova_powervm/virt/powervm/tasks/network.py | 6 +- nova_powervm/virt/powervm/vios.py | 4 +- nova_powervm/virt/powervm/vm.py | 2 +- nova_powervm/virt/powervm/volume/__init__.py | 29 +-- nova_powervm/virt/powervm/volume/npiv.py | 10 +- nova_powervm/virt/powervm/volume/vscsi.py | 4 +- 20 files changed, 304 insertions(+), 195 deletions(-) create mode 100644 nova_powervm/conf/__init__.py create mode 100644 nova_powervm/conf/powervm.py create mode 100644 nova_powervm/tests/conf/__init__.py create mode 100644 nova_powervm/tests/conf/test_conf.py diff --git a/nova_powervm/conf/__init__.py b/nova_powervm/conf/__init__.py new file mode 100644 index 00000000..1851fabc --- /dev/null +++ b/nova_powervm/conf/__init__.py @@ -0,0 +1,23 @@ +# Copyright 2016 IBM Corp. +# +# 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 nova_powervm.conf import powervm + +CONF = cfg.CONF + +powervm.register_opts(CONF) diff --git a/nova_powervm/conf/powervm.py b/nova_powervm/conf/powervm.py new file mode 100644 index 00000000..348a7f16 --- /dev/null +++ b/nova_powervm/conf/powervm.py @@ -0,0 +1,185 @@ +# Copyright 2016 IBM Corp. +# +# 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 + +CONF = cfg.CONF +# Pull in the imports that nova-powervm uses so they are validated +CONF.import_opt('host', 'nova.netconf') +CONF.import_opt('my_ip', 'nova.netconf') +CONF.import_opt('vncserver_proxyclient_address', 'nova.vnc', group='vnc') +CONF.import_opt('vif_plugging_is_fatal', 'nova.virt.driver') +CONF.import_opt('vif_plugging_timeout', 'nova.virt.driver') + +powervm_group = cfg.OptGroup( + 'powervm', + title='PowerVM Options') + + +powervm_opts = [ + cfg.FloatOpt('proc_units_factor', + default=0.1, + help='Factor used to calculate the processor units per vcpu. ' + 'Valid values are: 0.05 - 1.0'), + cfg.IntOpt('uncapped_proc_weight', + default=64, + help='The processor weight to assign to newly created VMs. ' + 'Value should be between 1 and 255. Represents how ' + 'aggressively LPARs grab CPU when unused cycles are ' + 'available.'), + cfg.StrOpt('vopt_media_volume_group', + default='rootvg', + help='The volume group on the system that should be used ' + 'to store the config drive metadata that will be attached ' + 'to VMs.'), + cfg.IntOpt('vopt_media_rep_size', + default=1, + help='The size of the media repository (in GB) for the ' + 'metadata for config drive. Only used if the media ' + 'repository needs to be created.'), + cfg.StrOpt('image_meta_local_path', + default='/tmp/cfgdrv/', + help='The location where the config drive ISO files should be ' + 'built.'), + cfg.StrOpt('disk_driver', + default='localdisk', + help='The disk driver to use for PowerVM disks. ' + 'Valid options are: localdisk, ssp'), +] + +localdisk_opts = [ + cfg.StrOpt('volume_group_name', + default='', + help='Volume Group to use for block device operations. Must ' + 'not be rootvg. If disk_driver is localdisk, and more ' + 'than one non-rootvg volume group exists across the ' + 'Virtual I/O Servers, then this attribute must be ' + 'specified.'), + cfg.StrOpt('volume_group_vios_name', + default='', + help='(Optional) The name of the Virtual I/O Server hosting ' + 'the volume group. If this is not specified, the system ' + 'will query through the Virtual I/O Servers looking for ' + 'one that matches the volume_group_vios_name. This is ' + 'only needed if the system has multiple Virtual I/O ' + 'Servers with a non-rootvg volume group whose name is ' + 'duplicated.') +] + +ssp_opts = [ + cfg.StrOpt('cluster_name', + default='', + help='Cluster hosting the Shared Storage Pool to use for ' + 'storage operations. If none specified, the host is ' + 'queried; if a single Cluster is found, it is used. ' + 'Not used unless disk_driver option is set to ssp.') +] + +vol_adapter_opts = [ + cfg.StrOpt('fc_attach_strategy', + default='vscsi', + help='The Fibre Channel Volume Strategy defines how FC Cinder ' + 'volumes should be attached to the Virtual Machine. The ' + 'options are: npiv or vscsi.'), + cfg.StrOpt('fc_npiv_adapter_api', + default='nova_powervm.virt.powervm.volume.npiv.' + 'NPIVVolumeAdapter', + help='Volume Adapter API to connect FC volumes using NPIV' + 'connection mechanism.'), + cfg.StrOpt('fc_vscsi_adapter_api', + default='nova_powervm.virt.powervm.volume.vscsi.' + 'VscsiVolumeAdapter', + help='Volume Adapter API to connect FC volumes through Virtual ' + 'I/O Server using PowerVM vSCSI connection mechanism.'), + cfg.IntOpt('vscsi_vios_connections_required', default=1, + help='Indicates a minimum number of Virtual I/O Servers that ' + 'are required to support a Cinder volume attach with the ' + 'vSCSI volume connector.') +] + +# NPIV Options. Only applicable if the 'fc_attach_strategy' is set to 'npiv'. +# Otherwise this section can be ignored. +npiv_opts = [ + cfg.IntOpt('ports_per_fabric', default=1, + help='The number of physical ports that should be connected ' + 'directly to the Virtual Machine, per fabric. ' + 'Example: 2 fabrics and ports_per_fabric set to 2 will ' + 'result in 4 NPIV ports being created, two per fabric. ' + 'If multiple Virtual I/O Servers are available, will ' + 'attempt to span ports across I/O Servers.'), + cfg.StrOpt('fabrics', default='A', + help='Unique identifier for each physical FC fabric that is ' + 'available. This is a comma separated list. If there ' + 'are two fabrics for multi-pathing, then this could be ' + 'set to A,B.' + 'The fabric identifiers are used for the ' + '\'fabric__port_wwpns\' key.') +] + +STATIC_OPTIONS = (powervm_opts + localdisk_opts + ssp_opts + vol_adapter_opts + + npiv_opts) + +# Dictionary where the key is the NPIV Fabric Name, and the value is a list of +# Physical WWPNs that match the key. +NPIV_FABRIC_WWPNS = {} +FABRIC_WWPN_HELP = ('A comma delimited list of all the physical FC port ' + 'WWPNs that support the specified fabric. Is tied to ' + 'the NPIV fabrics key.') +# This is only used to provide a sample for the list_opt() method +fabric_sample = [ + cfg.StrOpt('fabric_A_port_wwpns', default='', help=FABRIC_WWPN_HELP), + cfg.StrOpt('fabric_B_port_wwpns', default='', help=FABRIC_WWPN_HELP), +] + + +def _register_fabrics(conf, fabric_mapping): + """Registers the fabrics to WWPNs options and builds a mapping. + + This method registers the 'fabric_X_port_wwpns' (where X is determined by + the 'fabrics' option values) and then builds a dictionary that mapps the + fabrics to the WWPNs. This mapping can then be later used without having + to reparse the options. + """ + # At this point, the fabrics should be specified. Iterate over those to + # determine the port_wwpns per fabric. + if conf.powervm.fabrics is not None: + port_wwpn_keys = [] + fabrics = conf.powervm.fabrics.split(',') + for fabric in fabrics: + opt = cfg.StrOpt('fabric_%s_port_wwpns' % fabric, + default='', help=FABRIC_WWPN_HELP) + port_wwpn_keys.append(opt) + + conf.register_opts(port_wwpn_keys, group='powervm') + + # Now that we've registered the fabrics, saturate the NPIV dictionary + for fabric in fabrics: + key = 'fabric_%s_port_wwpns' % fabric + wwpns = conf.powervm[key].split(',') + wwpns = [x.upper().strip(':') for x in wwpns] + fabric_mapping[fabric] = wwpns + + +def register_opts(conf): + conf.register_group(powervm_group) + conf.register_opts(STATIC_OPTIONS, group=powervm_group) + _register_fabrics(conf, NPIV_FABRIC_WWPNS) + + +# list_opts is called by the nova sample creation tooling. It's not used for +# powervm for now. +def list_opts(): + return {powervm_group.name: STATIC_OPTIONS + fabric_sample} diff --git a/nova_powervm/tests/conf/__init__.py b/nova_powervm/tests/conf/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/nova_powervm/tests/conf/test_conf.py b/nova_powervm/tests/conf/test_conf.py new file mode 100644 index 00000000..ab6f1d65 --- /dev/null +++ b/nova_powervm/tests/conf/test_conf.py @@ -0,0 +1,67 @@ +# Copyright 2016 IBM Corp. +# +# 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 nova import test +import oslo_config + +from nova_powervm import conf as cfg + +CONF = cfg.CONF + + +class TestConf(test.TestCase): + def setUp(self): + super(TestConf, self).setUp() + + def test_conf(self): + """Tests that powervm config values are configured.""" + # Try an option from each grouping of static options + + # Base set of options + self.assertEqual(0.1, CONF.powervm.proc_units_factor) + # Local disk + self.assertEqual('', CONF.powervm.volume_group_name) + # SSP disk + self.assertEqual('', CONF.powervm.cluster_name) + # Volume attach + self.assertEqual('vscsi', CONF.powervm.fc_attach_strategy) + # NPIV + self.assertEqual(1, CONF.powervm.ports_per_fabric) + + +class TestConfDynamic(test.TestCase): + def setUp(self): + super(TestConfDynamic, self).setUp() + self.conf_fx = self.useFixture( + oslo_config.fixture.Config(oslo_config.cfg.ConfigOpts())) + # Set the raw values in the config + self.conf_fx.load_raw_values(group='powervm', fabrics='A,B', + fabric_A_port_wwpns='WWPN1', + fabric_B_port_wwpns='WWPN2') + # Now register the NPIV options with the values + self.conf_fx.register_opts(cfg.powervm.npiv_opts, group='powervm') + self.conf = self.conf_fx.conf + + def test_npiv(self): + """Tests that NPIV dynamic options are registered correctly.""" + # Register the dynamic FC values + fabric_mapping = {} + cfg.powervm._register_fabrics(self.conf, fabric_mapping) + self.assertEqual('A,B', self.conf.powervm.fabrics) + self.assertEqual('WWPN1', self.conf.powervm.fabric_A_port_wwpns) + self.assertEqual('WWPN2', self.conf.powervm.fabric_B_port_wwpns) + # Ensure the NPIV data was setup correctly + self.assertEqual({'B': ['WWPN2'], 'A': ['WWPN1']}, fabric_mapping) diff --git a/nova_powervm/tests/virt/powervm/test_driver.py b/nova_powervm/tests/virt/powervm/test_driver.py index 2f2f6a37..5dee2760 100644 --- a/nova_powervm/tests/virt/powervm/test_driver.py +++ b/nova_powervm/tests/virt/powervm/test_driver.py @@ -18,7 +18,6 @@ import logging import mock -from oslo_config import cfg from oslo_serialization import jsonutils from nova import block_device as nova_block_device @@ -41,6 +40,7 @@ import pypowervm.wrappers.logical_partition as pvm_lpar import pypowervm.wrappers.managed_system as pvm_ms import pypowervm.wrappers.virtual_io_server as pvm_vios +from nova_powervm import conf as cfg from nova_powervm.tests.virt import powervm from nova_powervm.tests.virt.powervm import fixtures as fx from nova_powervm.virt.powervm import driver @@ -56,7 +56,6 @@ LOG = logging.getLogger(__name__) logging.basicConfig() CONF = cfg.CONF -CONF.import_opt('my_ip', 'nova.netconf') class FakeClass(object): diff --git a/nova_powervm/tests/virt/powervm/volume/test_npiv.py b/nova_powervm/tests/virt/powervm/volume/test_npiv.py index c9daae02..d1c864ee 100644 --- a/nova_powervm/tests/virt/powervm/volume/test_npiv.py +++ b/nova_powervm/tests/virt/powervm/volume/test_npiv.py @@ -1,4 +1,4 @@ -# Copyright 2015 IBM Corp. +# Copyright 2015, 2016 IBM Corp. # # All Rights Reserved. # @@ -15,13 +15,13 @@ # under the License. import mock -from oslo_config import cfg from nova.compute import task_states from pypowervm.tests import test_fixtures as pvm_fx from pypowervm.tests.test_utils import pvmhttp from pypowervm.wrappers import virtual_io_server as pvm_vios +from nova_powervm import conf as cfg from nova_powervm.tests.virt.powervm.volume import test_driver as test_vol from nova_powervm.virt.powervm import exception as exc from nova_powervm.virt.powervm.volume import npiv diff --git a/nova_powervm/tests/virt/powervm/volume/test_vscsi.py b/nova_powervm/tests/virt/powervm/volume/test_vscsi.py index 2499afce..4337ff67 100644 --- a/nova_powervm/tests/virt/powervm/volume/test_vscsi.py +++ b/nova_powervm/tests/virt/powervm/volume/test_vscsi.py @@ -1,4 +1,4 @@ -# Copyright 2015 IBM Corp. +# Copyright 2015, 2016 IBM Corp. # # All Rights Reserved. # @@ -16,8 +16,7 @@ import mock -from oslo_config import cfg - +from nova_powervm import conf as cfg from nova_powervm.tests.virt.powervm.volume import test_driver as test_vol from nova_powervm.virt.powervm import exception as p_exc from nova_powervm.virt.powervm.volume import vscsi diff --git a/nova_powervm/virt/powervm/__init__.py b/nova_powervm/virt/powervm/__init__.py index 3306859b..e69de29b 100644 --- a/nova_powervm/virt/powervm/__init__.py +++ b/nova_powervm/virt/powervm/__init__.py @@ -1,106 +0,0 @@ -# Copyright 2014, 2015 IBM Corp. -# -# 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 - -pvm_opts = [ - cfg.FloatOpt('proc_units_factor', - default=0.1, - help='Factor used to calculate the processor units per vcpu. ' - 'Valid values are: 0.05 - 1.0'), - cfg.IntOpt('uncapped_proc_weight', - default=64, - help='The processor weight to assign to newly created VMs. ' - 'Value should be between 1 and 255. Represents how ' - 'aggressively LPARs grab CPU when unused cycles are ' - 'available.'), - cfg.StrOpt('vopt_media_volume_group', - default='rootvg', - help='The volume group on the system that should be used ' - 'to store the config drive metadata that will be attached ' - 'to VMs.'), - cfg.IntOpt('vopt_media_rep_size', - default=1, - help='The size of the media repository (in GB) for the ' - 'metadata for config drive. Only used if the media ' - 'repository needs to be created.'), - cfg.StrOpt('image_meta_local_path', - default='/tmp/cfgdrv/', - help='The location where the config drive ISO files should be ' - 'built.'), - cfg.StrOpt('disk_driver', - default='localdisk', - help='The disk driver to use for PowerVM disks. ' - 'Valid options are: localdisk, ssp') -] - - -CONF = cfg.CONF -CONF.register_opts(pvm_opts, group='powervm') - -# Options imported from other regions -CONF.import_opt('host', 'nova.netconf') -CONF.import_opt('my_ip', 'nova.netconf') -CONF.import_opt('vncserver_proxyclient_address', 'nova.vnc', group='vnc') -CONF.import_opt('vncserver_listen', 'nova.vnc', group='vnc') - - -# NPIV Options. Only applicable if the 'fc_attach_strategy' is set to 'npiv'. -# Otherwise this section can be ignored. -npiv_opts = [ - cfg.IntOpt('ports_per_fabric', default=1, - help='The number of physical ports that should be connected ' - 'directly to the Virtual Machine, per fabric. ' - 'Example: 2 fabrics and ports_per_fabric set to 2 will ' - 'result in 4 NPIV ports being created, two per fabric. ' - 'If multiple Virtual I/O Servers are available, will ' - 'attempt to span ports across I/O Servers.'), - cfg.StrOpt('fabrics', default='A', - help='Unique identifier for each physical FC fabric that is ' - 'available. This is a comma separated list. If there ' - 'are two fabrics for multi-pathing, then this could be ' - 'set to A,B.' - 'The fabric identifiers are used for the ' - '\'fabric__port_wwpns\' key.') -] -CONF.register_opts(npiv_opts, group='powervm') - -# Dictionary where the key is the NPIV Fabric Name, and the value is a list of -# Physical WWPNs that match the key. -NPIV_FABRIC_WWPNS = {} - -# At this point, the fabrics should be specified. Iterate over those to -# determine the port_wwpns per fabric. -if CONF.powervm.fabrics is not None: - port_wwpn_keys = [] - help_text = ('A comma delimited list of all the physical FC port WWPNs ' - 'that support the specified fabric. Is tied to the NPIV ' - 'fabrics key.') - - fabrics = CONF.powervm.fabrics.split(',') - for fabric in fabrics: - opt = cfg.StrOpt('fabric_%s_port_wwpns' % fabric, - default='', help=help_text) - port_wwpn_keys.append(opt) - - CONF.register_opts(port_wwpn_keys, group='powervm') - - # Now that we've registered the fabrics, saturate the NPIV dictionary - for fabric in fabrics: - key = 'fabric_%s_port_wwpns' % fabric - wwpns = CONF.powervm[key].split(',') - wwpns = [x.upper().strip(':') for x in wwpns] - NPIV_FABRIC_WWPNS[fabric] = wwpns diff --git a/nova_powervm/virt/powervm/disk/driver.py b/nova_powervm/virt/powervm/disk/driver.py index 8d371c3c..171b6e7c 100644 --- a/nova_powervm/virt/powervm/disk/driver.py +++ b/nova_powervm/virt/powervm/disk/driver.py @@ -1,5 +1,5 @@ # Copyright 2013 OpenStack Foundation -# Copyright 2015 IBM Corp. +# Copyright 2015, 2016 IBM Corp. # # All Rights Reserved. # diff --git a/nova_powervm/virt/powervm/disk/localdisk.py b/nova_powervm/virt/powervm/disk/localdisk.py index 70d6c417..63ed15de 100644 --- a/nova_powervm/virt/powervm/disk/localdisk.py +++ b/nova_powervm/virt/powervm/disk/localdisk.py @@ -1,5 +1,5 @@ # Copyright 2013 OpenStack Foundation -# Copyright 2015 IBM Corp. +# Copyright 2015, 2016 IBM Corp. # # All Rights Reserved. # @@ -15,7 +15,6 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_config import cfg from oslo_log import log as logging from nova import exception as nova_exc @@ -26,6 +25,7 @@ from pypowervm.wrappers import managed_system as pvm_ms from pypowervm.wrappers import storage as pvm_stg from pypowervm.wrappers import virtual_io_server as pvm_vios +from nova_powervm import conf as cfg from nova_powervm.virt.powervm.disk import driver as disk_dvr from nova_powervm.virt.powervm import exception as npvmex from nova_powervm.virt.powervm.i18n import _LE @@ -33,29 +33,9 @@ from nova_powervm.virt.powervm.i18n import _LI from nova_powervm.virt.powervm import vios from nova_powervm.virt.powervm import vm -localdisk_opts = [ - cfg.StrOpt('volume_group_name', - default='', - help='Volume Group to use for block device operations. Must ' - 'not be rootvg. If disk_driver is localdisk, and more ' - 'than one non-rootvg volume group exists across the ' - 'Virtual I/O Servers, then this attribute must be ' - 'specified.'), - cfg.StrOpt('volume_group_vios_name', - default='', - help='(Optional) The name of the Virtual I/O Server hosting ' - 'the volume group. If this is not specified, the system ' - 'will query through the Virtual I/O Servers looking for ' - 'one that matches the volume_group_vios_name. This is ' - 'only needed if the system has multiple Virtual I/O ' - 'Servers with a non-rootvg volume group whose name is ' - 'duplicated.') -] - LOG = logging.getLogger(__name__) CONF = cfg.CONF -CONF.register_opts(localdisk_opts, group='powervm') class LocalStorage(disk_dvr.DiskAdapter): diff --git a/nova_powervm/virt/powervm/disk/ssp.py b/nova_powervm/virt/powervm/disk/ssp.py index c930ca62..fcf893ed 100644 --- a/nova_powervm/virt/powervm/disk/ssp.py +++ b/nova_powervm/virt/powervm/disk/ssp.py @@ -1,4 +1,4 @@ -# Copyright 2015 IBM Corp. +# Copyright 2015, 2016 IBM Corp. # # All Rights Reserved. # @@ -16,9 +16,9 @@ import random -from oslo_config import cfg import oslo_log.log as logging +from nova_powervm import conf as cfg from nova_powervm.virt.powervm.disk import driver as disk_drv from nova_powervm.virt.powervm import exception as npvmex from nova_powervm.virt.powervm.i18n import _ @@ -35,19 +35,8 @@ import pypowervm.wrappers.storage as pvm_stg import pypowervm.wrappers.virtual_io_server as pvm_vios -ssp_opts = [ - cfg.StrOpt('cluster_name', - default='', - help='Cluster hosting the Shared Storage Pool to use for ' - 'storage operations. If none specified, the host is ' - 'queried; if a single Cluster is found, it is used. ' - 'Not used unless disk_driver option is set to ssp.') -] - - LOG = logging.getLogger(__name__) CONF = cfg.CONF -CONF.register_opts(ssp_opts, group='powervm') class SSPDiskAdapter(disk_drv.DiskAdapter): diff --git a/nova_powervm/virt/powervm/driver.py b/nova_powervm/virt/powervm/driver.py index 7e61d738..0318d6c4 100644 --- a/nova_powervm/virt/powervm/driver.py +++ b/nova_powervm/virt/powervm/driver.py @@ -28,7 +28,6 @@ from nova.virt import configdrive from nova.virt import driver import re -from oslo_config import cfg from oslo_log import log as logging from oslo_utils import importutils import six @@ -46,6 +45,7 @@ from pypowervm.wrappers import base_partition as pvm_bp from pypowervm.wrappers import managed_system as pvm_ms from pypowervm.wrappers import virtual_io_server as pvm_vios +from nova_powervm import conf as cfg from nova_powervm.virt.powervm.disk import driver as disk_dvr from nova_powervm.virt.powervm import host as pvm_host from nova_powervm.virt.powervm.i18n import _ diff --git a/nova_powervm/virt/powervm/live_migration.py b/nova_powervm/virt/powervm/live_migration.py index 947e76ba..063f3631 100644 --- a/nova_powervm/virt/powervm/live_migration.py +++ b/nova_powervm/virt/powervm/live_migration.py @@ -1,4 +1,4 @@ -# Copyright 2015 IBM Corp. +# Copyright 2015, 2016 IBM Corp. # # All Rights Reserved. # @@ -22,10 +22,10 @@ from pypowervm.tasks import migration as mig from pypowervm.tasks import storage as stor_task from pypowervm.tasks import vterm -from oslo_config import cfg from oslo_log import log as logging import six +from nova_powervm import conf as cfg from nova_powervm.virt.powervm.i18n import _ from nova_powervm.virt.powervm.i18n import _LE from nova_powervm.virt.powervm.i18n import _LI diff --git a/nova_powervm/virt/powervm/media.py b/nova_powervm/virt/powervm/media.py index 2c5fd1b9..12bb7256 100644 --- a/nova_powervm/virt/powervm/media.py +++ b/nova_powervm/virt/powervm/media.py @@ -1,4 +1,4 @@ -# Copyright 2015 IBM Corp. +# Copyright 2015, 2016 IBM Corp. # # All Rights Reserved. # @@ -22,7 +22,6 @@ import os from taskflow import task from oslo_concurrency import lockutils -from oslo_config import cfg from oslo_log import log as logging from pypowervm import const as pvm_const @@ -35,6 +34,7 @@ from pypowervm.wrappers import managed_system as pvm_ms from pypowervm.wrappers import storage as pvm_stg from pypowervm.wrappers import virtual_io_server as pvm_vios +from nova_powervm import conf as cfg from nova_powervm.virt.powervm import exception as npvmex from nova_powervm.virt.powervm.i18n import _LI from nova_powervm.virt.powervm.i18n import _LW diff --git a/nova_powervm/virt/powervm/tasks/network.py b/nova_powervm/virt/powervm/tasks/network.py index 56855dc7..a1a66598 100644 --- a/nova_powervm/virt/powervm/tasks/network.py +++ b/nova_powervm/virt/powervm/tasks/network.py @@ -1,4 +1,4 @@ -# Copyright 2015 IBM Corp. +# Copyright 2015, 2016 IBM Corp. # # All Rights Reserved. # @@ -19,10 +19,10 @@ import eventlet from nova import exception from nova import utils -from oslo_config import cfg from oslo_log import log as logging from taskflow import task +from nova_powervm import conf as cfg from nova_powervm.virt.powervm.i18n import _ from nova_powervm.virt.powervm.i18n import _LE from nova_powervm.virt.powervm.i18n import _LI @@ -31,8 +31,6 @@ from nova_powervm.virt.powervm import vm LOG = logging.getLogger(__name__) CONF = cfg.CONF -CONF.import_opt('vif_plugging_is_fatal', 'nova.virt.driver') -CONF.import_opt('vif_plugging_timeout', 'nova.virt.driver') class VirtualInterfaceUnplugException(exception.NovaException): diff --git a/nova_powervm/virt/powervm/vios.py b/nova_powervm/virt/powervm/vios.py index 673b6f1f..158b120e 100644 --- a/nova_powervm/virt/powervm/vios.py +++ b/nova_powervm/virt/powervm/vios.py @@ -1,4 +1,4 @@ -# Copyright 2015 IBM Corp. +# Copyright 2015, 2016 IBM Corp. # # All Rights Reserved. # @@ -14,7 +14,6 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_config import cfg from oslo_log import log as logging from pypowervm.utils import transaction as pvm_tx @@ -24,7 +23,6 @@ from pypowervm.wrappers import virtual_io_server as pvm_vios LOG = logging.getLogger(__name__) -CONF = cfg.CONF # RMC must be either active or busy. Busy is allowed because that simply # means that something is running against the VIOS at the moment...but diff --git a/nova_powervm/virt/powervm/vm.py b/nova_powervm/virt/powervm/vm.py index cfff6be5..f56538ba 100644 --- a/nova_powervm/virt/powervm/vm.py +++ b/nova_powervm/virt/powervm/vm.py @@ -15,7 +15,6 @@ # under the License. import json -from oslo_config import cfg from oslo_log import log as logging import re import six @@ -38,6 +37,7 @@ from pypowervm.wrappers import managed_system as pvm_ms from pypowervm.wrappers import network as pvm_net from pypowervm.wrappers import shared_proc_pool as pvm_spp +from nova_powervm import conf as cfg from nova_powervm.virt.powervm.i18n import _ from nova_powervm.virt.powervm.i18n import _LE from nova_powervm.virt.powervm.i18n import _LI diff --git a/nova_powervm/virt/powervm/volume/__init__.py b/nova_powervm/virt/powervm/volume/__init__.py index 35d28a15..13d34ee7 100644 --- a/nova_powervm/virt/powervm/volume/__init__.py +++ b/nova_powervm/virt/powervm/volume/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2015 IBM Corp. +# Copyright 2015, 2016 IBM Corp. # # All Rights Reserved. # @@ -15,33 +15,10 @@ # under the License. # Defines the various volume connectors that can be used. -from oslo_config import cfg +from nova_powervm import conf as cfg + CONF = cfg.CONF - -vol_adapter_opts = [ - cfg.StrOpt('fc_attach_strategy', - default='vscsi', - help='The Fibre Channel Volume Strategy defines how FC Cinder ' - 'volumes should be attached to the Virtual Machine. The ' - 'options are: npiv or vscsi.'), - cfg.StrOpt('fc_npiv_adapter_api', - default='nova_powervm.virt.powervm.volume.npiv.' - 'NPIVVolumeAdapter', - help='Volume Adapter API to connect FC volumes using NPIV' - 'connection mechanism'), - cfg.StrOpt('fc_vscsi_adapter_api', - default='nova_powervm.virt.powervm.volume.vscsi.' - 'VscsiVolumeAdapter', - help='Volume Adapter API to connect FC volumes through Virtual ' - 'I/O Server using PowerVM vSCSI connection mechanism'), - cfg.IntOpt('vscsi_vios_connections_required', default=1, - help='Indicates a minimum number of Virtual I/O Servers that ' - 'are required to support a Cinder volume attach with the ' - 'vSCSI volume connector.') -] -CONF.register_opts(vol_adapter_opts, group='powervm') - FC_STRATEGY_MAPPING = { 'npiv': CONF.powervm.fc_npiv_adapter_api, 'vscsi': CONF.powervm.fc_vscsi_adapter_api diff --git a/nova_powervm/virt/powervm/volume/npiv.py b/nova_powervm/virt/powervm/volume/npiv.py index c3a56f6b..07e522ad 100644 --- a/nova_powervm/virt/powervm/volume/npiv.py +++ b/nova_powervm/virt/powervm/volume/npiv.py @@ -1,4 +1,4 @@ -# Copyright 2015 IBM Corp. +# Copyright 2015, 2016 IBM Corp. # # All Rights Reserved. # @@ -15,7 +15,6 @@ # under the License. from oslo_concurrency import lockutils -from oslo_config import cfg from oslo_log import log as logging from taskflow import task @@ -23,7 +22,8 @@ from nova.compute import task_states from pypowervm.tasks import vfc_mapper as pvm_vfcm from pypowervm.wrappers import virtual_io_server as pvm_vios -from nova_powervm.virt import powervm +from nova_powervm import conf as cfg +from nova_powervm.conf import powervm as pvm_cfg from nova_powervm.virt.powervm import exception as exc from nova_powervm.virt.powervm.i18n import _ from nova_powervm.virt.powervm.i18n import _LE @@ -593,11 +593,11 @@ class NPIVVolumeAdapter(v_driver.FibreChannelVolumeAdapter): def _fabric_names(self): """Returns a list of the fabric names.""" - return powervm.NPIV_FABRIC_WWPNS.keys() + return pvm_cfg.NPIV_FABRIC_WWPNS.keys() def _fabric_ports(self, fabric_name): """Returns a list of WWPNs for the fabric's physical ports.""" - return powervm.NPIV_FABRIC_WWPNS[fabric_name] + return pvm_cfg.NPIV_FABRIC_WWPNS[fabric_name] def _ports_per_fabric(self): """Returns the number of virtual ports that should be used per fabric. diff --git a/nova_powervm/virt/powervm/volume/vscsi.py b/nova_powervm/virt/powervm/volume/vscsi.py index 1fb53899..9954685b 100644 --- a/nova_powervm/virt/powervm/volume/vscsi.py +++ b/nova_powervm/virt/powervm/volume/vscsi.py @@ -1,4 +1,4 @@ -# Copyright 2015 IBM Corp. +# Copyright 2015, 2016 IBM Corp. # # All Rights Reserved. # @@ -15,10 +15,10 @@ # under the License. from oslo_concurrency import lockutils -from oslo_config import cfg from oslo_log import log as logging from taskflow import task +from nova_powervm import conf as cfg from nova_powervm.virt.powervm import exception as p_exc from nova_powervm.virt.powervm.i18n import _ from nova_powervm.virt.powervm.i18n import _LE