diff --git a/doc/source/admin/drivers/irmc.rst b/doc/source/admin/drivers/irmc.rst index 5af489af56..355e47f047 100644 --- a/doc/source/admin/drivers/irmc.rst +++ b/doc/source/admin/drivers/irmc.rst @@ -174,264 +174,6 @@ Node configuration - ``driver_info/irmc_snmp_community`` property overrides ``snmp_community``. - ``driver_info/irmc_snmp_security`` property overrides ``snmp_security``. -Upgrading to ``irmc`` hardware type -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -When upgrading from a classic driver to the ``irmc`` hardware type, -make sure you specify the hardware interfaces that are used by the -classic driver. :doc:`/admin/upgrade-to-hardware-types` has more -information, including the hardware interfaces corresponding to -the classic drivers. - -Classic Drivers (Deprecated) -============================ - -These are the classic drivers (deprecated) for FUJITSU PRIMERGY servers. - -* ``pxe_irmc`` -* ``iscsi_irmc`` -* ``agent_irmc`` - -.. warning:: - The classic drivers are deprecated in the Queens release and will be removed - in the Rocky release. The ``irmc`` hardware type should be used instead of - the classic drivers. - -pxe_irmc driver -^^^^^^^^^^^^^^^ - -This driver enables PXE deploy and power control via ServerView Common -Command Interface (SCCI). - -Enabling the driver -~~~~~~~~~~~~~~~~~~~ - -- Add ``pxe_irmc`` to the list of ``enabled_drivers`` in ``[DEFAULT]`` - section of ``/etc/ironic/ironic.conf``. -- Ironic Conductor must be restarted for the new driver to be loaded. - -Node configuration -~~~~~~~~~~~~~~~~~~ - -* Each node is configured for iRMC with PXE deploy by setting the - following ironic node object’s properties: - - - ``driver`` property to be ``pxe_irmc`` - - ``driver_info/irmc_address`` property to be ``IP address`` or - ``hostname`` of the iRMC. - - ``driver_info/irmc_username`` property to be ``username`` for - the iRMC with administrator privileges. - - ``driver_info/irmc_password`` property to be ``password`` for - irmc_username. - - ``properties/capabilities`` property to be ``boot_mode:uefi`` if - UEFI boot is required. - - ``properties/capabilities`` property to be ``secure_boot:true`` if - UEFI Secure Boot is required. Please refer to `UEFI Secure Boot Support`_ - for more information. - -* All of nodes are configured by setting the following configuration - options in ``[irmc]`` section of ``/etc/ironic/ironic.conf``: - - - ``port``: Port to be used for iRMC operations; either 80 - or 443. The default value is 443. Optional. - - ``auth_method``: Authentication method for iRMC operations; - either ``basic`` or ``digest``. The default value is ``basic``. Optional. - - ``client_timeout``: Timeout (in seconds) for iRMC - operations. The default value is 60. Optional. - - ``sensor_method``: Sensor data retrieval method; either - ``ipmitool`` or ``scci``. The default value is ``ipmitool``. Optional. - -* The following options are only required for inspection: - - - ``snmp_version``: SNMP protocol version; either ``v1``, ``v2c`` or - ``v3``. The default value is ``v2c``. Optional. - - ``snmp_port``: SNMP port. The default value is ``161``. Optional. - - ``snmp_community``: SNMP community required for versions ``v1`` - and ``v2c``. The default value is ``public``. Optional. - - ``snmp_security``: SNMP security name required for version ``v3``. - Optional. - -* Each node can be further configured by setting the following ironic - node object’s properties which override the parameter values in - ``[irmc]`` section of ``/etc/ironic/ironic.conf``: - - - ``driver_info/irmc_port`` property overrides ``port``. - - ``driver_info/irmc_auth_method`` property overrides ``auth_method``. - - ``driver_info/irmc_client_timeout`` property overrides ``client_timeout``. - - ``driver_info/irmc_sensor_method`` property overrides ``sensor_method``. - - ``driver_info/irmc_snmp_version`` property overrides ``snmp_version``. - - ``driver_info/irmc_snmp_port`` property overrides ``snmp_port``. - - ``driver_info/irmc_snmp_community`` property overrides ``snmp_community``. - - ``driver_info/irmc_snmp_security`` property overrides ``snmp_security``. - - -iscsi_irmc driver -^^^^^^^^^^^^^^^^^ - -This driver enables Virtual Media deploy with image build from -Diskimage Builder and power control via ServerView Common Command -Interface (SCCI). - -Enabling the driver -~~~~~~~~~~~~~~~~~~~ - -- Add ``iscsi_irmc`` to the list of ``enabled_drivers`` in - ``[DEFAULT]`` section of ``/etc/ironic/ironic.conf``. -- Ironic Conductor must be restarted for the new driver to be loaded. - -Node configuration -~~~~~~~~~~~~~~~~~~ - -* Each node is configured for iRMC with PXE deploy by setting the - followings ironic node object’s properties: - - - ``driver`` property to be ``iscsi_irmc`` - - ``driver_info/irmc_address`` property to be ``IP address`` or - ``hostname`` of the iRMC. - - ``driver_info/irmc_username`` property to be ``username`` for - the iRMC with administrator privileges. - - ``driver_info/irmc_password`` property to be ``password`` for - irmc_username. - - ``properties/capabilities`` property to be ``boot_mode:uefi`` if - UEFI boot is required. - - ``properties/capabilities`` property to be ``secure_boot:true`` if - Secure Boot is required. Please refer to `UEFI Secure Boot Support`_ - for more information. - - ``driver_info/irmc_deploy_iso`` property to be either deploy iso - file name, Glance UUID, or Image Service URL. - - ``instance info/irmc_boot_iso`` property to be either boot iso - file name, Glance UUID, or Image Service URL. This is optional - property when ``boot_option`` is set to ``netboot``. - -* All of nodes are configured by setting the following configuration - options in ``[irmc]`` section of ``/etc/ironic/ironic.conf``: - - - ``port``: Port to be used for iRMC operations; either ``80`` - or ``443``. The default value is ``443``. Optional. - - ``auth_method``: Authentication method for iRMC operations; - either ``basic`` or ``digest``. The default value is ``basic``. Optional. - - ``client_timeout``: Timeout (in seconds) for iRMC - operations. The default value is 60. Optional. - - ``sensor_method``: Sensor data retrieval method; either - ``ipmitool`` or ``scci``. The default value is ``ipmitool``. Optional. - - ``remote_image_share_root``: Ironic conductor node's ``NFS`` or - ``CIFS`` root path. The default value is ``/remote_image_share_root``. - - ``remote_image_server``: IP of remote image server. - - ``remote_image_share_type``: Share type of virtual media, either - ``NFS`` or ``CIFS``. The default is ``CIFS``. - - ``remote_image_share_name``: share name of ``remote_image_server``. - The default value is ``share``. - - ``remote_image_user_name``: User name of ``remote_image_server``. - - ``remote_image_user_password``: Password of ``remote_image_user_name``. - - ``remote_image_user_domain``: Domain name of ``remote_image_user_name``. - -* The following options are only required for inspection: - - - ``snmp_version``: SNMP protocol version; either ``v1``, ``v2c`` or - ``v3``. The default value is ``v2c``. Optional. - - ``snmp_port``: SNMP port. The default value is ``161``. Optional. - - ``snmp_community``: SNMP community required for versions ``v1`` - and ``v2c``. The default value is ``public``. Optional. - - ``snmp_security``: SNMP security name required for version ``v3``. - Optional. - -* Each node can be further configured by setting the following ironic - node object’s properties which override the parameter values in - ``[irmc]`` section of ``/etc/ironic/ironic.conf``: - - - ``driver_info/irmc_port`` property overrides ``port``. - - ``driver_info/irmc_auth_method`` property overrides ``auth_method``. - - ``driver_info/irmc_client_timeout`` property overrides ``client_timeout``. - - ``driver_info/irmc_sensor_method`` property overrides ``sensor_method``. - - ``driver_info/irmc_snmp_version`` property overrides ``snmp_version``. - - ``driver_info/irmc_snmp_port`` property overrides ``snmp_port``. - - ``driver_info/irmc_snmp_community`` property overrides ``snmp_community``. - - ``driver_info/irmc_snmp_security`` property overrides ``snmp_security``. - - -agent_irmc driver -^^^^^^^^^^^^^^^^^ - -This driver enables Virtual Media deploy with IPA (Ironic Python -Agent) and power control via ServerView Common Command Interface -(SCCI). - -Enabling the driver -~~~~~~~~~~~~~~~~~~~ - -- Add ``agent_irmc`` to the list of ``enabled_drivers`` in - ``[DEFAULT]`` section of ``/etc/ironic/ironic.conf``. -- Ironic Conductor must be restarted for the new driver to be loaded. - -Node configuration -~~~~~~~~~~~~~~~~~~ - -* Each node is configured for iRMC with PXE deploy by setting the - followings ironic node object’s properties: - - - ``driver`` property to be ``agent_irmc`` - - ``driver_info/irmc_address`` property to be ``IP address`` or - ``hostname`` of the iRMC. - - ``driver_info/irmc_username`` property to be ``username`` for - the iRMC with administrator privileges. - - ``driver_info/irmc_password`` property to be ``password`` for - irmc_username. - - ``properties/capabilities`` property to be ``boot_mode:uefi`` if - UEFI boot is required. - - ``properties/capabilities`` property to be ``secure_boot:true`` if - Secure Boot is required. Please refer to `UEFI Secure Boot Support`_ - for more information. - - ``driver_info/irmc_deploy_iso`` property to be either deploy iso - file name, Glance UUID, or Image Service URL. - - ``instance info/irmc_boot_iso`` property to be either boot iso - file name, Glance UUID, or Image Service URL. This is optional - property when ``boot_option`` is set to ``netboot``. - -* All of nodes are configured by setting the following configuration - options in ``[irmc]`` section of ``/etc/ironic/ironic.conf``: - - - ``port``: Port to be used for iRMC operations; either 80 - or 443. The default value is 443. Optional. - - ``auth_method``: Authentication method for iRMC operations; - either ``basic`` or ``digest``. The default value is ``basic``. Optional. - - ``client_timeout``: Timeout (in seconds) for iRMC - operations. The default value is 60. Optional. - - ``sensor_method``: Sensor data retrieval method; either - ``ipmitool`` or ``scci``. The default value is ``ipmitool``. Optional. - - ``remote_image_share_root``: Ironic conductor node's ``NFS`` or - ``CIFS`` root path. The default value is ``/remote_image_share_root``. - - ``remote_image_server``: IP of remote image server. - - ``remote_image_share_type``: Share type of virtual media, either - ``NFS`` or ``CIFS``. The default is ``CIFS``. - - ``remote_image_share_name``: share name of ``remote_image_server``. - The default value is ``share``. - - ``remote_image_user_name``: User name of ``remote_image_server``. - - ``remote_image_user_password``: Password of ``remote_image_user_name``. - - ``remote_image_user_domain``: Domain name of ``remote_image_user_name``. - -* The following options are only required for inspection: - - - ``snmp_version``: SNMP protocol version; either ``v1``, ``v2c`` or - ``v3``. The default value is ``v2c``. Optional. - - ``snmp_port``: SNMP port. The default value is ``161``. Optional. - - ``snmp_community``: SNMP community required for versions ``v1`` - and ``v2c``. The default value is ``public``. Optional. - - ``snmp_security``: SNMP security name required for version ``v3``. - Optional. - -* Each node can be further configured by setting the following ironic - node object’s properties which override the parameter values in - ``[irmc]`` section of ``/etc/ironic/ironic.conf``: - - - ``driver_info/irmc_port`` property overrides ``port``. - - ``driver_info/irmc_auth_method`` property overrides ``auth_method``. - - ``driver_info/irmc_client_timeout`` property overrides ``client_timeout``. - - ``driver_info/irmc_sensor_method`` property overrides ``sensor_method``. - - ``driver_info/irmc_snmp_version`` property overrides ``snmp_version``. - - ``driver_info/irmc_snmp_port`` property overrides ``snmp_port``. - - ``driver_info/irmc_snmp_community`` property overrides ``snmp_community``. - - ``driver_info/irmc_snmp_security`` property overrides ``snmp_security``. - Optional functionalities for the ``irmc`` hardware type ======================================================= @@ -497,18 +239,16 @@ For more information on node automated cleaning, see :ref:`automated_cleaning` Boot from Remote Volume ^^^^^^^^^^^^^^^^^^^^^^^ -The ``irmc`` hardware type (and ``pxe_irmc`` classic driver) supports the -generic iPXE-based remote volume booting when using the following boot -interfaces: +The ``irmc`` hardware type supports the generic iPXE-based remote volume +booting when using the following boot interfaces: * ``irmc-pxe`` * ``pxe`` In addition, the ``irmc`` hardware type supports remote volume booting without -iPXE. This is available when using the ``irmc-virtual-media`` boot interface -(and ``iscsi_irmc`` and ``agent_irmc`` classic drivers). This feature -configures a node to boot from a remote volume by using the API of iRMC. It -supports iSCSI and FibreChannel. +iPXE. This is available when using the ``irmc-virtual-media`` boot interface. +This feature configures a node to boot from a remote volume by using the API +of iRMC. It supports iSCSI and FibreChannel. Configuration ~~~~~~~~~~~~~ diff --git a/ironic/drivers/irmc.py b/ironic/drivers/irmc.py index c962747265..45da922620 100644 --- a/ironic/drivers/irmc.py +++ b/ironic/drivers/irmc.py @@ -16,89 +16,17 @@ iRMC Driver for managing FUJITSU PRIMERGY BX S4 or RX S8 generation of FUJITSU PRIMERGY servers, and above servers. """ -from oslo_utils import importutils - -from ironic.common import exception -from ironic.common.i18n import _ -from ironic.drivers import base from ironic.drivers import generic -from ironic.drivers.modules import agent from ironic.drivers.modules import inspector from ironic.drivers.modules import ipmitool from ironic.drivers.modules.irmc import boot from ironic.drivers.modules.irmc import inspect from ironic.drivers.modules.irmc import management from ironic.drivers.modules.irmc import power -from ironic.drivers.modules import iscsi_deploy from ironic.drivers.modules import noop from ironic.drivers.modules import pxe -class IRMCVirtualMediaIscsiDriver(base.BaseDriver): - """iRMC Driver using SCCI. - - This driver implements the `core` functionality using - :class:ironic.drivers.modules.irmc.power.IRMCPower for power management. - and - :class:ironic.drivers.modules.iscsi_deploy.ISCSIDeploy for deploy. - """ - - def __init__(self): - if not importutils.try_import('scciclient.irmc.scci'): - raise exception.DriverLoadError( - driver=self.__class__.__name__, - reason=_("Unable to import python-scciclient library")) - - self.power = power.IRMCPower() - self.boot = boot.IRMCVirtualMediaBoot() - self.deploy = iscsi_deploy.ISCSIDeploy() - self.console = ipmitool.IPMIShellinaboxConsole() - self.management = management.IRMCManagement() - self.inspect = inspect.IRMCInspect() - - @classmethod - def to_hardware_type(cls): - return 'irmc', {'boot': 'irmc-virtual-media', - 'console': 'ipmitool-shellinabox', - 'deploy': 'iscsi', - 'inspect': 'irmc', - 'management': 'irmc', - 'power': 'irmc'} - - -class IRMCVirtualMediaAgentDriver(base.BaseDriver): - """iRMC Driver using SCCI. - - This driver implements the `core` functionality using - :class:ironic.drivers.modules.irmc.power.IRMCPower for power management - and - :class:ironic.drivers.modules.irmc.deploy.IRMCVirtualMediaAgentDriver for - deploy. - """ - - def __init__(self): - if not importutils.try_import('scciclient.irmc.scci'): - raise exception.DriverLoadError( - driver=self.__class__.__name__, - reason=_("Unable to import python-scciclient library")) - - self.power = power.IRMCPower() - self.boot = boot.IRMCVirtualMediaBoot() - self.deploy = agent.AgentDeploy() - self.console = ipmitool.IPMIShellinaboxConsole() - self.management = management.IRMCManagement() - self.inspect = inspect.IRMCInspect() - - @classmethod - def to_hardware_type(cls): - return 'irmc', {'boot': 'irmc-virtual-media', - 'console': 'ipmitool-shellinabox', - 'deploy': 'direct', - 'inspect': 'irmc', - 'management': 'irmc', - 'power': 'irmc'} - - class IRMCHardware(generic.GenericHardware): """iRMC hardware type. diff --git a/ironic/drivers/pxe.py b/ironic/drivers/pxe.py deleted file mode 100644 index 7a9d15909e..0000000000 --- a/ironic/drivers/pxe.py +++ /dev/null @@ -1,70 +0,0 @@ -# -*- encoding: utf-8 -*- -# -# Copyright 2013 Hewlett-Packard Development Company, L.P. -# -# 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. -""" -PXE Driver and supporting meta-classes. -""" - -from oslo_config import cfg -from oslo_utils import importutils - -from ironic.common import exception -from ironic.common.i18n import _ -from ironic.drivers import base -from ironic.drivers import ipmi -from ironic.drivers.modules import ipmitool -from ironic.drivers.modules.irmc import boot as irmc_boot -from ironic.drivers.modules.irmc import inspect as irmc_inspect -from ironic.drivers.modules.irmc import management as irmc_management -from ironic.drivers.modules.irmc import power as irmc_power -from ironic.drivers.modules import iscsi_deploy - - -CONF = cfg.CONF - - -# For backward compatibility -PXEAndIPMIToolDriver = ipmi.PXEAndIPMIToolDriver -PXEAndIPMIToolAndSocatDriver = ipmi.PXEAndIPMIToolAndSocatDriver - - -class PXEAndIRMCDriver(base.BaseDriver): - """PXE + iRMC driver using SCCI. - - This driver implements the `core` functionality using - :class:`ironic.drivers.modules.irmc.power.IRMCPower` for - power management :class:`ironic.drivers.modules.iscsi_deploy.ISCSIDeploy` - for image deployment. - """ - def __init__(self): - if not importutils.try_import('scciclient'): - raise exception.DriverLoadError( - driver=self.__class__.__name__, - reason=_("Unable to import python-scciclient library")) - self.power = irmc_power.IRMCPower() - self.console = ipmitool.IPMIShellinaboxConsole() - self.boot = irmc_boot.IRMCPXEBoot() - self.deploy = iscsi_deploy.ISCSIDeploy() - self.management = irmc_management.IRMCManagement() - self.inspect = irmc_inspect.IRMCInspect() - - @classmethod - def to_hardware_type(cls): - return 'irmc', {'boot': 'irmc-pxe', - 'console': 'ipmitool-shellinabox', - 'deploy': 'iscsi', - 'inspect': 'irmc', - 'management': 'irmc', - 'power': 'irmc'} diff --git a/ironic/tests/unit/drivers/modules/irmc/test_boot.py b/ironic/tests/unit/drivers/modules/irmc/test_boot.py index 9c10f671d7..966adb269e 100644 --- a/ironic/tests/unit/drivers/modules/irmc/test_boot.py +++ b/ironic/tests/unit/drivers/modules/irmc/test_boot.py @@ -40,8 +40,8 @@ from ironic.drivers.modules.irmc import boot as irmc_boot from ironic.drivers.modules.irmc import common as irmc_common from ironic.drivers.modules.irmc import management as irmc_management from ironic.drivers.modules import pxe -from ironic.tests.unit.db import base as db_base from ironic.tests.unit.db import utils as db_utils +from ironic.tests.unit.drivers.modules.irmc import test_common from ironic.tests.unit.drivers.modules import test_pxe from ironic.tests.unit.drivers import third_party_driver_mock_specs \ as mock_specs @@ -68,15 +68,14 @@ PARSED_IFNO = { } -class IRMCDeployPrivateMethodsTestCase(db_base.DbTestCase): +class IRMCDeployPrivateMethodsTestCase(test_common.BaseIRMCTest): + + boot_interface = 'irmc-virtual-media' def setUp(self): irmc_boot.check_share_fs_mounted_patcher.start() self.addCleanup(irmc_boot.check_share_fs_mounted_patcher.stop) super(IRMCDeployPrivateMethodsTestCase, self).setUp() - self.config(enabled_drivers=['iscsi_irmc']) - self.node = obj_utils.create_test_node( - self.context, driver='iscsi_irmc', driver_info=INFO_DICT) CONF.irmc.remote_image_share_root = '/remote_image_share_root' CONF.irmc.remote_image_server = '10.20.30.40' @@ -887,24 +886,14 @@ class IRMCDeployPrivateMethodsTestCase(db_base.DbTestCase): parse_conf_mock.assert_called_once_with() -class IRMCVirtualMediaBootTestCase(db_base.DbTestCase): +class IRMCVirtualMediaBootTestCase(test_common.BaseIRMCTest): + + boot_interface = 'irmc-virtual-media' def setUp(self): irmc_boot.check_share_fs_mounted_patcher.start() self.addCleanup(irmc_boot.check_share_fs_mounted_patcher.stop) super(IRMCVirtualMediaBootTestCase, self).setUp() - self.config(enabled_hardware_types=['irmc'], - enabled_boot_interfaces=['irmc-virtual-media'], - enabled_console_interfaces=['ipmitool-socat'], - enabled_deploy_interfaces=['iscsi'], - enabled_inspect_interfaces=['irmc'], - enabled_management_interfaces=['irmc'], - enabled_power_interfaces=['irmc'], - enabled_raid_interfaces=['no-raid'], - enabled_rescue_interfaces=['agent'], - enabled_vendor_interfaces=['no-vendor']) - self.node = obj_utils.create_test_node( - self.context, driver='irmc', driver_info=INFO_DICT) @mock.patch.object(deploy_utils, 'validate_image_properties', spec_set=True, autospec=True) @@ -1309,13 +1298,7 @@ class IRMCVirtualMediaBootTestCase(db_base.DbTestCase): task.driver.boot.validate_rescue, task) -class IRMCPXEBootTestCase(db_base.DbTestCase): - - def setUp(self): - super(IRMCPXEBootTestCase, self).setUp() - self.config(enabled_drivers=['pxe_irmc']) - self.node = obj_utils.create_test_node( - self.context, driver='pxe_irmc', driver_info=INFO_DICT) +class IRMCPXEBootTestCase(test_common.BaseIRMCTest): @mock.patch.object(irmc_management, 'backup_bios_config', spec_set=True, autospec=True) @@ -1468,20 +1451,17 @@ class IRMCPXEBootTestCase(db_base.DbTestCase): @mock.patch.object(irmc_boot, 'viom', spec_set=mock_specs.SCCICLIENT_VIOM_SPEC) -class IRMCVirtualMediaBootWithVolumeTestCase(db_base.DbTestCase): +class IRMCVirtualMediaBootWithVolumeTestCase(test_common.BaseIRMCTest): + + boot_interface = 'irmc-virtual-media' def setUp(self): super(IRMCVirtualMediaBootWithVolumeTestCase, self).setUp() irmc_boot.check_share_fs_mounted_patcher.start() self.addCleanup(irmc_boot.check_share_fs_mounted_patcher.stop) - self.config(enabled_hardware_types=['irmc'], - enabled_boot_interfaces=['irmc-virtual-media'], - enabled_deploy_interfaces=['direct'], - enabled_power_interfaces=['irmc'], - enabled_management_interfaces=['irmc'], - enabled_storage_interfaces=['cinder']) driver_info = INFO_DICT d_in_info = dict(boot_from_volume='volume-uuid') + self.config(enabled_storage_interfaces=['cinder']) self.node = obj_utils.create_test_node(self.context, driver='irmc', driver_info=driver_info, @@ -1904,8 +1884,7 @@ class IRMCVirtualMediaBootWithVolumeTestCase(db_base.DbTestCase): class IRMCPXEBootBasicTestCase(test_pxe.PXEBootTestCase): - driver = 'pxe_irmc' - boot_interface = None + boot_interface = 'irmc-pxe' # NOTE(etingof): add driver-specific configuration driver_info = dict(test_pxe.PXEBootTestCase.driver_info) driver_info.update(PARSED_IFNO) diff --git a/ironic/tests/unit/drivers/modules/irmc/test_common.py b/ironic/tests/unit/drivers/modules/irmc/test_common.py index 0ab12894ac..586c8cb9fa 100644 --- a/ironic/tests/unit/drivers/modules/irmc/test_common.py +++ b/ironic/tests/unit/drivers/modules/irmc/test_common.py @@ -18,6 +18,7 @@ Test class for common methods used by iRMC modules. import mock from oslo_config import cfg +from oslo_utils import uuidutils from ironic.common import exception from ironic.conductor import task_manager @@ -31,18 +32,22 @@ from ironic.tests.unit.objects import utils as obj_utils class BaseIRMCTest(db_base.DbTestCase): + boot_interface = 'irmc-pxe' + def setUp(self): super(BaseIRMCTest, self).setUp() self.config(enabled_hardware_types=['irmc', 'fake-hardware'], enabled_power_interfaces=['irmc', 'fake'], enabled_management_interfaces=['irmc', 'fake'], - enabled_boot_interfaces=['irmc-pxe', 'fake'], + enabled_boot_interfaces=[self.boot_interface, 'fake'], enabled_inspect_interfaces=['irmc', 'no-inspect', 'fake']) self.info = db_utils.get_test_irmc_info() self.node = obj_utils.create_test_node( self.context, driver='irmc', - driver_info=self.info) + boot_interface=self.boot_interface, + driver_info=self.info, + uuid=uuidutils.generate_uuid()) class IRMCValidateParametersTestCase(BaseIRMCTest): diff --git a/ironic/tests/unit/drivers/modules/irmc/test_management.py b/ironic/tests/unit/drivers/modules/irmc/test_management.py index 00d5946452..e1c3fcc42b 100644 --- a/ironic/tests/unit/drivers/modules/irmc/test_management.py +++ b/ironic/tests/unit/drivers/modules/irmc/test_management.py @@ -457,9 +457,8 @@ class IRMCManagementTestCase(test_common.BaseIRMCTest): e = self.assertRaises( exception.FailedToGetSensorData, irmc_management.IRMCManagement().get_sensors_data, task) - self.assertEqual("Failed to get sensor data for node 1be26c0b-" - "03f2-4d2e-ae87-c02d7f33c123. Error: Fake Error", - str(e)) + self.assertEqual("Failed to get sensor data for node %s. " + "Error: Fake Error" % self.node.uuid, str(e)) @mock.patch.object(irmc_management.LOG, 'error', spec_set=True, autospec=True) diff --git a/ironic/tests/unit/drivers/modules/test_pxe.py b/ironic/tests/unit/drivers/modules/test_pxe.py index b82de3d0f0..a14ec03149 100644 --- a/ironic/tests/unit/drivers/modules/test_pxe.py +++ b/ironic/tests/unit/drivers/modules/test_pxe.py @@ -764,20 +764,14 @@ class PXEBootTestCase(db_base.DbTestCase): self.config_temp_dir('http_root', group='deploy') instance_info = INST_INFO_DICT instance_info['deploy_key'] = 'fake-56789' - if self.driver != 'fake-hardware': - # TODO(dtantsur): remove this when removing the vendor classic - # drivers - self.config(enabled_drivers=[self.driver]) + self.config(enabled_boot_interfaces=[self.boot_interface, 'fake']) self.node = obj_utils.create_test_node( self.context, driver=self.driver, boot_interface=self.boot_interface, # Avoid fake properties in get_properties() output - # TODO(dtantsur): remove the 'if' condition when removing - # the vendor classic drivers - vendor_interface=('no-vendor' if self.driver == 'fake-hardware' - else None), + vendor_interface='no-vendor', instance_info=instance_info, driver_info=self.driver_info, driver_internal_info=self.driver_internal_info) diff --git a/ironic/tests/unit/drivers/test_irmc.py b/ironic/tests/unit/drivers/test_irmc.py index cc45a1a3b9..9489d5eea0 100644 --- a/ironic/tests/unit/drivers/test_irmc.py +++ b/ironic/tests/unit/drivers/test_irmc.py @@ -16,10 +16,6 @@ Test class for iRMC Deploy Driver """ -import mock -import testtools - -from ironic.common import exception from ironic.conductor import task_manager from ironic.drivers import irmc from ironic.drivers.modules import agent @@ -31,90 +27,6 @@ from ironic.tests.unit.db import base as db_base from ironic.tests.unit.objects import utils as obj_utils -class IRMCVirtualMediaIscsiTestCase(testtools.TestCase): - - def setUp(self): - irmc.boot.check_share_fs_mounted_patcher.start() - self.addCleanup(irmc.boot.check_share_fs_mounted_patcher.stop) - super(IRMCVirtualMediaIscsiTestCase, self).setUp() - - @mock.patch.object(irmc.importutils, 'try_import', spec_set=True, - autospec=True) - def test___init___share_fs_mounted_ok(self, - mock_try_import): - mock_try_import.return_value = True - - driver = irmc.IRMCVirtualMediaIscsiDriver() - - self.assertIsInstance(driver.power, irmc.power.IRMCPower) - self.assertIsInstance(driver.boot, - irmc.boot.IRMCVirtualMediaBoot) - self.assertIsInstance(driver.deploy, iscsi_deploy.ISCSIDeploy) - self.assertIsInstance(driver.console, - irmc.ipmitool.IPMIShellinaboxConsole) - self.assertIsInstance(driver.management, - irmc.management.IRMCManagement) - self.assertIsInstance(driver.inspect, irmc.inspect.IRMCInspect) - - @mock.patch.object(irmc.importutils, 'try_import') - def test___init___try_import_exception(self, mock_try_import): - mock_try_import.return_value = False - - self.assertRaises(exception.DriverLoadError, - irmc.IRMCVirtualMediaIscsiDriver) - - @mock.patch.object(irmc.boot.IRMCVirtualMediaBoot, '__init__', - spec_set=True, autospec=True) - def test___init___share_fs_not_mounted_exception(self, __init___mock): - __init___mock.side_effect = exception.IRMCSharedFileSystemNotMounted( - share='/share') - - self.assertRaises(exception.IRMCSharedFileSystemNotMounted, - irmc.IRMCVirtualMediaIscsiDriver) - - -class IRMCVirtualMediaAgentTestCase(testtools.TestCase): - - def setUp(self): - irmc.boot.check_share_fs_mounted_patcher.start() - self.addCleanup(irmc.boot.check_share_fs_mounted_patcher.stop) - super(IRMCVirtualMediaAgentTestCase, self).setUp() - - @mock.patch.object(irmc.importutils, 'try_import', spec_set=True, - autospec=True) - def test___init___share_fs_mounted_ok(self, - mock_try_import): - mock_try_import.return_value = True - - driver = irmc.IRMCVirtualMediaAgentDriver() - - self.assertIsInstance(driver.power, irmc.power.IRMCPower) - self.assertIsInstance(driver.boot, - irmc.boot.IRMCVirtualMediaBoot) - self.assertIsInstance(driver.deploy, agent.AgentDeploy) - self.assertIsInstance(driver.console, - irmc.ipmitool.IPMIShellinaboxConsole) - self.assertIsInstance(driver.management, - irmc.management.IRMCManagement) - self.assertIsInstance(driver.inspect, irmc.inspect.IRMCInspect) - - @mock.patch.object(irmc.importutils, 'try_import') - def test___init___try_import_exception(self, mock_try_import): - mock_try_import.return_value = False - - self.assertRaises(exception.DriverLoadError, - irmc.IRMCVirtualMediaAgentDriver) - - @mock.patch.object(irmc.boot.IRMCVirtualMediaBoot, '__init__', - spec_set=True, autospec=True) - def test___init___share_fs_not_mounted_exception(self, __init___mock): - __init___mock.side_effect = exception.IRMCSharedFileSystemNotMounted( - share='/share') - - self.assertRaises(exception.IRMCSharedFileSystemNotMounted, - irmc.IRMCVirtualMediaAgentDriver) - - class IRMCHardwareTestCase(db_base.DbTestCase): def setUp(self): diff --git a/ironic/tests/unit/drivers/test_pxe.py b/ironic/tests/unit/drivers/test_pxe.py deleted file mode 100644 index 6c7bb8d0bb..0000000000 --- a/ironic/tests/unit/drivers/test_pxe.py +++ /dev/null @@ -1,53 +0,0 @@ -# Copyright 2015 Hewlett-Packard Development Company, L.P. -# -# 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. - -""" -Test class for PXE Drivers -""" - -import mock -import testtools - -from ironic.common import exception -from ironic.drivers.modules import ipmitool -from ironic.drivers.modules.irmc import boot as irmc_boot -from ironic.drivers.modules.irmc import management as irmc_management -from ironic.drivers.modules.irmc import power as irmc_power -from ironic.drivers.modules import iscsi_deploy -from ironic.drivers import pxe - - -class PXEDriversTestCase(testtools.TestCase): - - @mock.patch.object(pxe.importutils, 'try_import', spec_set=True, - autospec=True) - def test_pxe_irmc_driver(self, try_import_mock): - try_import_mock.return_value = True - - driver = pxe.PXEAndIRMCDriver() - - self.assertIsInstance(driver.power, irmc_power.IRMCPower) - self.assertIsInstance(driver.console, ipmitool.IPMIShellinaboxConsole) - self.assertIsInstance(driver.boot, irmc_boot.IRMCPXEBoot) - self.assertIsInstance(driver.deploy, iscsi_deploy.ISCSIDeploy) - self.assertIsInstance(driver.management, - irmc_management.IRMCManagement) - - @mock.patch.object(pxe.importutils, 'try_import', spec_set=True, - autospec=True) - def test_pxe_irmc_driver_import_error(self, try_import_mock): - try_import_mock.return_value = False - - self.assertRaises(exception.DriverLoadError, - pxe.PXEAndIRMCDriver) diff --git a/ironic/tests/unit/drivers/third_party_driver_mocks.py b/ironic/tests/unit/drivers/third_party_driver_mocks.py index 24f8f27373..3a99a6b1c1 100644 --- a/ironic/tests/unit/drivers/third_party_driver_mocks.py +++ b/ironic/tests/unit/drivers/third_party_driver_mocks.py @@ -169,7 +169,7 @@ if 'ironic.drivers.modules.irmc' in sys.modules: six.moves.reload_module(sys.modules['ironic.drivers.modules.irmc']) -# install mock object to prevent 'iscsi_irmc' and 'agent_irmc' from +# install mock object to prevent the irmc-virtual-media boot interface from # checking whether NFS/CIFS share file system is mounted or not. irmc_boot = importutils.import_module( 'ironic.drivers.modules.irmc.boot') diff --git a/releasenotes/notes/no-classic-irmc-3a606045e87119b7.yaml b/releasenotes/notes/no-classic-irmc-3a606045e87119b7.yaml new file mode 100644 index 0000000000..958db20c8a --- /dev/null +++ b/releasenotes/notes/no-classic-irmc-3a606045e87119b7.yaml @@ -0,0 +1,5 @@ +--- +upgrade: + - | + The deprecated classic drivers ``pxe_irmc``, ``agent_irmc`` and + ``iscsi_irmc`` have been removed. Please use the ``irmc`` hardware type. diff --git a/setup.cfg b/setup.cfg index fa8f7011f9..899e8f03be 100644 --- a/setup.cfg +++ b/setup.cfg @@ -55,11 +55,8 @@ ironic.dhcp = ironic.drivers = agent_ipmitool = ironic.drivers.ipmi:AgentAndIPMIToolDriver agent_ipmitool_socat = ironic.drivers.ipmi:AgentAndIPMIToolAndSocatDriver - agent_irmc = ironic.drivers.irmc:IRMCVirtualMediaAgentDriver - iscsi_irmc = ironic.drivers.irmc:IRMCVirtualMediaIscsiDriver pxe_ipmitool = ironic.drivers.ipmi:PXEAndIPMIToolDriver pxe_ipmitool_socat = ironic.drivers.ipmi:PXEAndIPMIToolAndSocatDriver - pxe_irmc = ironic.drivers.pxe:PXEAndIRMCDriver ironic.hardware.interfaces.bios = fake = ironic.drivers.modules.fake:FakeBIOS