From 384f966003269f5dfd88ea7c8559db6050413fcd Mon Sep 17 00:00:00 2001 From: Dmitry Tantsur Date: Tue, 26 Jun 2018 10:42:47 +0200 Subject: [PATCH] Remove the OneView classic drivers This change removes iscsi_pxe_oneview and agent_pxe_oneview. Change-Id: I4301e35f321bd041441dcfce494393fb90e293f3 --- devstack/lib/ironic | 8 +- doc/source/admin/drivers/oneview.rst | 125 +++--------------- ironic/drivers/modules/oneview/common.py | 3 - ironic/drivers/modules/oneview/deploy.py | 14 +- ironic/drivers/modules/oneview/inspect.py | 21 ++- ironic/drivers/oneview.py | 110 +-------------- .../drivers/modules/oneview/test_common.py | 3 + .../drivers/modules/oneview/test_deploy.py | 42 ++---- .../drivers/modules/oneview/test_inspect.py | 50 +------ ironic/tests/unit/drivers/test_oneview.py | 46 ------- .../no-classic-oneview-e46ee2838d2b1d37.yaml | 6 + setup.cfg | 2 - 12 files changed, 57 insertions(+), 373 deletions(-) create mode 100644 releasenotes/notes/no-classic-oneview-e46ee2838d2b1d37.yaml diff --git a/devstack/lib/ironic b/devstack/lib/ironic index 5d911c25db..e37666282a 100644 --- a/devstack/lib/ironic +++ b/devstack/lib/ironic @@ -110,7 +110,7 @@ IRONIC_HW_ARCH=${IRONIC_HW_ARCH:-x86_64} # cisco-ucs-managed: # # -# *_oneview: +# oneview: # # # idrac: @@ -292,8 +292,7 @@ fi # are ``pxe_ipmitool``, ``agent_ipmitool``, ``snmp`` and ``ipmi``. # # Additional valid choices if IRONIC_IS_HARDWARE == true are: -# ``cisco-ucs-managed``, ``cisco-ucs-standalone`` -# ``*_pxe_oneview`` and ``idrac`` +# ``cisco-ucs-managed``, ``cisco-ucs-standalone``, ``oneview`` and ``idrac``. IRONIC_DEPLOY_DRIVER=${IRONIC_DEPLOY_DRIVER:-pxe_ipmitool} # If the requested driver is not yet enable, enable it, if it is not it will fail anyway @@ -630,7 +629,8 @@ function is_deployed_by_ucs { } function is_deployed_by_oneview { - [[ -z "${IRONIC_DEPLOY_DRIVER##*_oneview}" ]] && return 0 + [[ "${IRONIC_DEPLOY_DRIVER}" == oneview ]] && return 0 + return 1 } function is_deployed_by_ilo { diff --git a/doc/source/admin/drivers/oneview.rst b/doc/source/admin/drivers/oneview.rst index eac1e47dcc..fc953eb799 100644 --- a/doc/source/admin/drivers/oneview.rst +++ b/doc/source/admin/drivers/oneview.rst @@ -5,8 +5,8 @@ OneView drivers =============== .. note:: - The `oneview` drivers and hardware type, along with related interfaces - to support OneView, have been deprecated, and should be expected to be + The `oneview` hardware type, along with related interfaces to support + OneView, have been deprecated, and should be expected to be removed from ironic in the Stein cycle. Please see `storyboard `_ for additional details. @@ -21,30 +21,14 @@ instance. In this context, the ``HP OneView driver`` for ironic enables the users of OneView to use ironic as a bare metal provider to their managed physical hardware. -HPE OneView hardware is supported by the ``oneview`` hardware type and the -following classic drivers: - -* ``iscsi_pxe_oneview`` -* ``agent_pxe_oneview`` - -Classic Drivers -=============== - -The ``iscsi_pxe_oneview`` and ``agent_pxe_oneview`` drivers implement the core -interfaces of an ironic Driver [2]_, and use the ``hpOneView`` [3]_ library -to provide communication between ironic and OneView through OneView's REST API. - -.. note:: - Classic drivers will be deprecated in favor of Hardware Types. +HPE OneView hardware is supported by the ``oneview`` hardware type. To provide a bare metal instance there are four components involved in the process: * The ironic service * The ironic-inspector service (if using hardware inspection) -* The ironic driver for OneView, which can be: - * `iscsi_pxe_oneview` or - * `agent_pxe_oneview` +* The ironic hardware type for OneView * The hpOneView library * The OneView appliance @@ -70,9 +54,6 @@ the node is no longer in use, these tasks will make place them back in Prerequisites ============= -The following requirements apply for both ``iscsi_pxe_oneview`` and -``agent_pxe_oneview`` drivers: - * ``OneView appliance`` is the HP physical infrastructure manager to be integrated with the OneView drivers. @@ -216,49 +197,11 @@ hardware type: --driver oneview \ --deploy-interface oneview-iscsi +Deploy process with oneview-iscsi deploy interface +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Drivers -======= - -iscsi_pxe_oneview driver -^^^^^^^^^^^^^^^^^^^^^^^^ - -Overview -~~~~~~~~ - -``iscsi_pxe_oneview`` driver uses PXEBoot for boot and ISCSIDeploy for deploy. - -Configuring and enabling the driver -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -1. Add ``iscsi_pxe_oneview`` to the list of ``enabled_drivers`` in your - ``ironic.conf`` file. For example:: - - enabled_drivers = iscsi_pxe_oneview - -2. Update the [oneview] section of your ``ironic.conf`` file with your - OneView credentials and CA certificate files information. - -.. note:: - An operator can set the ``periodic_check_interval`` option in the [oneview] - section to set the interval between running the periodic check. The default - value is 300 seconds (5 minutes). A lower value will reduce the likelihood - of races between ironic and OneView at the cost of being more resource - intensive. - -3. Restart the ironic conductor service. For Ubuntu users, do:: - - $ sudo service ironic-conductor restart - -See :doc:`/install/index` for more information. - -Deploy process -~~~~~~~~~~~~~~ - -Here is an overview of the deploy process for this driver: - -1. Admin configures the Proliant baremetal node to use ``iscsi_pxe_oneview`` - driver. +1. Admin configures the Proliant baremetal node to use ``oneview-iscsi`` + deploy interface. 2. ironic gets a request to deploy a Glance image on the baremetal node. 3. Driver sets the boot device to PXE. 4. Driver powers on the baremetal node. @@ -270,45 +213,11 @@ Here is an overview of the deploy process for this driver: 10. Driver powers on the machine. 11. Baremetal node is active and ready to be used. -agent_pxe_oneview driver -^^^^^^^^^^^^^^^^^^^^^^^^ +Deploy process with oneview-direct deploy interface +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Overview -~~~~~~~~ - -``agent_pxe_oneview`` driver uses PXEBoot for boot and AgentDeploy for deploy. - -Configuring and enabling the driver -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -1. Add ``agent_pxe_oneview`` to the list of ``enabled_drivers`` in your - ``ironic.conf``. For example:: - - enabled_drivers = pxe_ipmitool,agent_pxe_oneview - -2. Update the [oneview] section of your ``ironic.conf`` file with your - OneView credentials and CA certificate files information. - -.. note:: - An operator can set the ``periodic_check_interval`` option in the [oneview] - section to set the interval between running the periodic check. The default - value is 300 seconds (5 minutes). A lower value will reduce the likelihood - of races between ironic and OneView at the cost of being more resource - intensive. - -3. Restart the ironic conductor service. For Ubuntu users, do:: - - $ service ironic-conductor restart - -See :doc:`/install/index` for more information. - -Deploy process -~~~~~~~~~~~~~~ - -Here is an overview of the deploy process for this driver: - -1. Admin configures the Proliant baremetal node to use ``agent_pxe_oneview`` - driver. +1. Admin configures the Proliant baremetal node to use ``oneview-direct`` + deploy interface. 2. ironic gets a request to deploy a Glance image on the baremetal node. 3. Driver sets the boot device to PXE. 4. Driver powers on the baremetal node. @@ -339,8 +248,8 @@ Registering a OneView node in ironic ==================================== Nodes configured to use any of the OneView drivers should have the ``driver`` -property set to ``iscsi_pxe_oneview`` or ``agent_pxe_oneview``. Considering -our context, a node is the representation of a ``Server Hardware`` in OneView, +property set to ``oneview``. Considering our context, a node is the +representation of a ``Server Hardware`` in OneView, and should be consistent with all its properties and related components, such as ``Server Hardware Type``, ``Server Profile Template``, ``Enclosure Group``, etc. In this case, to be enrolled, the node must have the following parameters: @@ -419,7 +328,7 @@ In order to ease user manual tasks, which are often time-consuming, we provide useful tools that work nicely with the OneView drivers. ironic-oneview-cli -^^^^^^^^^^^^^^^^^^ +~~~~~~~~~~~~~~~~~~ The ``ironic-oneView`` CLI is a command line interface for management tasks involving OneView nodes. Its features include a facility to create of ironic @@ -430,7 +339,7 @@ For more details on how Ironic-OneView CLI works and how to set it up, see [8]_. ironic-oneviewd -^^^^^^^^^^^^^^^ +~~~~~~~~~~~~~~~ The ``ironic-oneviewd`` daemon monitors the ironic inventory of resources and provides facilities to operators managing OneView driver deployments. @@ -440,8 +349,6 @@ For more details on how Ironic-OneViewd works and how to set it up, see [7]_. References ========== .. [1] HP OneView - https://www.hpe.com/us/en/integrated-systems/software.html -.. [2] :ref:`architecture_drivers` -.. [3] hpOneView - https://pypi.org/project/hpOneView .. [6] Dynamic Allocation in OneView drivers - https://specs.openstack.org/openstack/ironic-specs/specs/not-implemented/oneview-drivers-dynamic-allocation.html .. [7] ironic-oneviewd - https://pypi.org/project/ironic-oneviewd/ .. [8] ironic-oneview-cli - https://pypi.org/project/ironic-oneview-cli/ diff --git a/ironic/drivers/modules/oneview/common.py b/ironic/drivers/modules/oneview/common.py index 066730de4e..137c2b9c75 100644 --- a/ironic/drivers/modules/oneview/common.py +++ b/ironic/drivers/modules/oneview/common.py @@ -57,9 +57,6 @@ COMMON_PROPERTIES.update(REQUIRED_ON_DRIVER_INFO) COMMON_PROPERTIES.update(REQUIRED_ON_PROPERTIES) COMMON_PROPERTIES.update(OPTIONAL_ON_PROPERTIES) -ISCSI_PXE_ONEVIEW = 'iscsi_pxe_oneview' -AGENT_PXE_ONEVIEW = 'agent_pxe_oneview' - # NOTE(xavierr): We don't want to translate NODE_IN_USE_BY_ONEVIEW and # SERVER_HARDWARE_ALLOCATION_ERROR to avoid inconsistency in the nodes # caused by updates on translation in upgrades of ironic. diff --git a/ironic/drivers/modules/oneview/deploy.py b/ironic/drivers/modules/oneview/deploy.py index d3cfcf3bbb..e2d0e52e27 100644 --- a/ironic/drivers/modules/oneview/deploy.py +++ b/ironic/drivers/modules/oneview/deploy.py @@ -36,10 +36,6 @@ METRICS = metrics_utils.get_metrics_logger(__name__) @six.add_metaclass(abc.ABCMeta) class OneViewPeriodicTasks(object): - @abc.abstractproperty - def oneview_driver(self): - pass - @periodics.periodic(spacing=CONF.oneview.periodic_check_interval, enabled=CONF.oneview.enable_periodic_tasks) def _periodic_check_nodes_taken_by_oneview(self, manager, context): @@ -58,7 +54,7 @@ class OneViewPeriodicTasks(object): filters = { 'provision_state': states.AVAILABLE, 'maintenance': False, - 'driver': self.oneview_driver + 'driver': 'oneview' } node_iter = manager.iter_nodes(filters=filters) @@ -116,7 +112,7 @@ class OneViewPeriodicTasks(object): filters = { 'provision_state': states.MANAGEABLE, 'maintenance': True, - 'driver': self.oneview_driver + 'driver': 'oneview' } node_iter = manager.iter_nodes(fields=['maintenance_reason'], filters=filters) @@ -182,7 +178,7 @@ class OneViewPeriodicTasks(object): filters = { 'provision_state': states.CLEANFAIL, - 'driver': self.oneview_driver + 'driver': 'oneview' } node_iter = manager.iter_nodes(fields=['driver_internal_info'], filters=filters) @@ -224,8 +220,6 @@ class OneViewIscsiDeploy(iscsi_deploy.ISCSIDeploy, OneViewPeriodicTasks): # TODO(TheJulia): This should be expected to be removed in Stein. supported = False - oneview_driver = common.ISCSI_PXE_ONEVIEW - def get_properties(self): return deploy_utils.get_properties() @@ -270,8 +264,6 @@ class OneViewAgentDeploy(agent.AgentDeploy, OneViewPeriodicTasks): # TODO(TheJulia): This should be expected to be removed in Stein. supported = False - oneview_driver = common.AGENT_PXE_ONEVIEW - def get_properties(self): return deploy_utils.get_properties() diff --git a/ironic/drivers/modules/oneview/inspect.py b/ironic/drivers/modules/oneview/inspect.py index e2b99728bb..54aacf29c1 100644 --- a/ironic/drivers/modules/oneview/inspect.py +++ b/ironic/drivers/modules/oneview/inspect.py @@ -73,20 +73,19 @@ class OneViewInspect(inspector.Inspector): @periodics.periodic(spacing=CONF.inspector.status_check_period, enabled=CONF.inspector.enabled) def _periodic_check_result(self, manager, context): - filters = {'provision_state': states.INSPECTWAIT} + filters = {'provision_state': states.INSPECTWAIT, + 'driver': 'oneview'} node_iter = manager.iter_nodes(filters=filters) for node_uuid, driver in node_iter: - if driver in [common.AGENT_PXE_ONEVIEW, - common.ISCSI_PXE_ONEVIEW]: - try: - lock_purpose = 'checking hardware inspection status' - with task_manager.acquire(context, node_uuid, - shared=True, - purpose=lock_purpose) as task: - self._check_status(task) - except (exception.NodeLocked, exception.NodeNotFound): - continue + try: + lock_purpose = 'checking hardware inspection status' + with task_manager.acquire(context, node_uuid, + shared=True, + purpose=lock_purpose) as task: + self._check_status(task) + except (exception.NodeLocked, exception.NodeNotFound): + continue def _check_status(self, task): state_before = task.node.provision_state diff --git a/ironic/drivers/oneview.py b/ironic/drivers/oneview.py index 61cbfc813a..287f6cdc78 100644 --- a/ironic/drivers/oneview.py +++ b/ironic/drivers/oneview.py @@ -14,25 +14,15 @@ # under the License. """ -OneView Driver and supporting meta-classes. +OneView hardware type. """ -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 generic from ironic.drivers.modules import noop from ironic.drivers.modules.oneview import deploy from ironic.drivers.modules.oneview import inspect from ironic.drivers.modules.oneview import management from ironic.drivers.modules.oneview import power -from ironic.drivers.modules import pxe - - -CONF = cfg.CONF class OneViewHardware(generic.GenericHardware): @@ -66,101 +56,3 @@ class OneViewHardware(generic.GenericHardware): def supported_power_interfaces(self): """List of supported power interfaces.""" return [power.OneViewPower] - - -class AgentPXEOneViewDriver(base.BaseDriver): - """OneViewDriver using OneViewClient interface. - - This driver implements the `core` functionality using - :class:ironic.drivers.modules.oneview.power.OneViewPower for power - management. And - :class:ironic.drivers.modules.oneview.deploy.OneViewAgentDeploy for deploy. - """ - # NOTE(TheJulia): Marking as unsupported as 3rd party CI was taken down - # shortly before the beginning of the Rocky cycle, and no replies have - # indicated that 3rd party CI will be re-established nor visible - # actions observed regarding re-establishing 3rd party CI. - # TODO(TheJulia): This should be expected to be removed in Stein. - supported = False - - def __init__(self): - if not importutils.try_import('hpOneView.oneview_client'): - raise exception.DriverLoadError( - driver=self.__class__.__name__, - reason=_("Unable to import hpOneView library")) - - if not importutils.try_import('redfish'): - raise exception.DriverLoadError( - driver=self.__class__.__name__, - reason=_("Unable to import python-ilorest-library")) - - self.power = power.OneViewPower() - self.management = management.OneViewManagement() - self.boot = pxe.PXEBoot() - self.deploy = deploy.OneViewAgentDeploy() - self.inspect = inspect.OneViewInspect.create_if_enabled( - 'AgentPXEOneViewDriver') - - @classmethod - def to_hardware_type(cls): - # NOTE(dtantsur): classic drivers are not affected by the - # enabled_inspect_interfaces configuration option. - if CONF.inspector.enabled: - inspect_interface = 'oneview' - else: - inspect_interface = 'no-inspect' - - return 'oneview', {'boot': 'pxe', - 'deploy': 'oneview-direct', - 'inspect': inspect_interface, - 'management': 'oneview', - 'power': 'oneview'} - - -class ISCSIPXEOneViewDriver(base.BaseDriver): - """OneViewDriver using OneViewClient interface. - - This driver implements the `core` functionality using - :class:ironic.drivers.modules.oneview.power.OneViewPower for power - management. And - :class:ironic.drivers.modules.oneview.deploy.OneViewIscsiDeploy for deploy. - """ - # NOTE(TheJulia): Marking as unsupported as 3rd party CI was taken down - # shortly before the beginning of the Rocky cycle, and no replies have - # indicated that 3rd party CI will be re-established nor visible - # actions observed regarding re-establishing 3rd party CI. - # TODO(TheJulia): This should be expected to be removed in Stein. - supported = False - - def __init__(self): - if not importutils.try_import('hpOneView.oneview_client'): - raise exception.DriverLoadError( - driver=self.__class__.__name__, - reason=_("Unable to import hpOneView library")) - - if not importutils.try_import('redfish'): - raise exception.DriverLoadError( - driver=self.__class__.__name__, - reason=_("Unable to import python-ilorest-library")) - - self.power = power.OneViewPower() - self.management = management.OneViewManagement() - self.boot = pxe.PXEBoot() - self.deploy = deploy.OneViewIscsiDeploy() - self.inspect = inspect.OneViewInspect.create_if_enabled( - 'ISCSIPXEOneViewDriver') - - @classmethod - def to_hardware_type(cls): - # NOTE(dtantsur): classic drivers are not affected by the - # enabled_inspect_interfaces configuration option. - if CONF.inspector.enabled: - inspect_interface = 'oneview' - else: - inspect_interface = 'no-inspect' - - return 'oneview', {'boot': 'pxe', - 'deploy': 'oneview-iscsi', - 'inspect': inspect_interface, - 'management': 'oneview', - 'power': 'oneview'} diff --git a/ironic/tests/unit/drivers/modules/oneview/test_common.py b/ironic/tests/unit/drivers/modules/oneview/test_common.py index 7a28fdd250..6f2452bc53 100644 --- a/ironic/tests/unit/drivers/modules/oneview/test_common.py +++ b/ironic/tests/unit/drivers/modules/oneview/test_common.py @@ -28,6 +28,8 @@ hponeview_client = importutils.try_import('hpOneView.oneview_client') class BaseOneViewTest(db_base.DbTestCase): + deploy_interface = None + def setUp(self): super(BaseOneViewTest, self).setUp() self.config(enabled_hardware_types=['oneview', 'fake-hardware'], @@ -39,6 +41,7 @@ class BaseOneViewTest(db_base.DbTestCase): enabled_power_interfaces=['oneview', 'fake']) self.node = obj_utils.create_test_node( self.context, driver='oneview', + deploy_interface=self.deploy_interface, properties=db_utils.get_test_oneview_properties(), driver_info=db_utils.get_test_oneview_driver_info(), ) diff --git a/ironic/tests/unit/drivers/modules/oneview/test_deploy.py b/ironic/tests/unit/drivers/modules/oneview/test_deploy.py index 6a3f8f2ce1..a22e9129d5 100644 --- a/ironic/tests/unit/drivers/modules/oneview/test_deploy.py +++ b/ironic/tests/unit/drivers/modules/oneview/test_deploy.py @@ -15,7 +15,6 @@ import mock -from ironic.common import driver_factory from ironic.common import exception from ironic.common import states from ironic.conductor import task_manager @@ -25,14 +24,10 @@ from ironic.drivers.modules import iscsi_deploy from ironic.drivers.modules.oneview import common from ironic.drivers.modules.oneview import deploy from ironic.drivers.modules.oneview import deploy_utils -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.oneview import test_common from ironic.tests.unit.objects import utils as obj_utils METHODS = ['iter_nodes', 'update_node', 'do_provisioning_action'] -PXE_DRV_INFO_DICT = db_utils.get_test_pxe_driver_info() -PXE_INST_INFO_DICT = db_utils.get_test_pxe_instance_info() oneview_error = common.SERVER_HARDWARE_ALLOCATION_ERROR maintenance_reason = common.NODE_IN_USE_BY_ONEVIEW @@ -232,7 +227,9 @@ class OneViewPeriodicTasks(test_common.BaseOneViewTest): self.assertNotIn('oneview_error', self.node.driver_internal_info) -class OneViewIscsiDeployTestCase(db_base.DbTestCase): +class OneViewIscsiDeployTestCase(test_common.BaseOneViewTest): + + deploy_interface = 'oneview-iscsi' def setUp(self): super(OneViewIscsiDeployTestCase, self).setUp() @@ -240,24 +237,14 @@ class OneViewIscsiDeployTestCase(db_base.DbTestCase): self.config(username='user', group='oneview') self.config(password='password', group='oneview') - self.config(enabled_drivers=['iscsi_pxe_oneview']) - self.driver = driver_factory.get_driver('iscsi_pxe_oneview') - - OV_DRV_INFO_DICT = db_utils.get_test_oneview_driver_info() - OV_DRV_INFO_DICT.update(PXE_DRV_INFO_DICT) - self.node = obj_utils.create_test_node( - self.context, driver='iscsi_pxe_oneview', - properties=db_utils.get_test_oneview_properties(), - driver_info=OV_DRV_INFO_DICT, - instance_info=PXE_INST_INFO_DICT, - ) self.port = obj_utils.create_test_port(self.context, node_id=self.node.id) self.info = common.get_oneview_info(self.node) def test_get_properties(self): expected = common.COMMON_PROPERTIES - self.assertEqual(expected, self.driver.deploy.get_properties()) + self.assertEqual(expected, + deploy.OneViewIscsiDeploy().get_properties()) @mock.patch.object(common, 'validate_oneview_resources_compatibility', spect_set=True, autospec=True) @@ -360,31 +347,24 @@ class OneViewIscsiDeployTestCase(db_base.DbTestCase): self.assertTrue(deallocate_server_hardware_mock.called) -class OneViewAgentDeployTestCase(db_base.DbTestCase): +class OneViewAgentDeployTestCase(test_common.BaseOneViewTest): + + deploy_interface = 'oneview-direct' + def setUp(self): super(OneViewAgentDeployTestCase, self).setUp() self.config(manager_url='https://1.2.3.4', group='oneview') self.config(username='user', group='oneview') self.config(password='password', group='oneview') - self.config(enabled_drivers=['agent_pxe_oneview']) - self.driver = driver_factory.get_driver('agent_pxe_oneview') - - OV_DRV_INFO_DICT = db_utils.get_test_oneview_driver_info() - OV_DRV_INFO_DICT.update(PXE_DRV_INFO_DICT) - self.node = obj_utils.create_test_node( - self.context, driver='agent_pxe_oneview', - properties=db_utils.get_test_oneview_properties(), - driver_info=OV_DRV_INFO_DICT, - instance_info=PXE_INST_INFO_DICT, - ) self.port = obj_utils.create_test_port(self.context, node_id=self.node.id) self.info = common.get_oneview_info(self.node) def test_get_properties(self): expected = common.COMMON_PROPERTIES - self.assertEqual(expected, self.driver.deploy.get_properties()) + self.assertEqual(expected, + deploy.OneViewAgentDeploy().get_properties()) @mock.patch.object(common, 'validate_oneview_resources_compatibility', spect_set=True, autospec=True) diff --git a/ironic/tests/unit/drivers/modules/oneview/test_inspect.py b/ironic/tests/unit/drivers/modules/oneview/test_inspect.py index d6e1f5acb7..4a00cfd969 100644 --- a/ironic/tests/unit/drivers/modules/oneview/test_inspect.py +++ b/ironic/tests/unit/drivers/modules/oneview/test_inspect.py @@ -18,59 +18,15 @@ import mock from ironic.conductor import task_manager from ironic.drivers.modules.oneview import common as ov_common from ironic.drivers.modules.oneview import deploy_utils -from ironic.tests.unit.db import base as db_base -from ironic.tests.unit.db import utils as db_utils -from ironic.tests.unit.objects import utils as obj_utils +from ironic.tests.unit.drivers.modules.oneview import test_common -class AgentPXEOneViewInspectTestCase(db_base.DbTestCase): +class OneViewInspectTestCase(test_common.BaseOneViewTest): def setUp(self): - super(AgentPXEOneViewInspectTestCase, self).setUp() + super(OneViewInspectTestCase, self).setUp() self.config(enabled=True, group='inspector') self.config(manager_url='https://1.2.3.4', group='oneview') - self.config(enabled_drivers=['agent_pxe_oneview']) - self.node = obj_utils.create_test_node( - self.context, driver='agent_pxe_oneview', - properties=db_utils.get_test_oneview_properties(), - driver_info=db_utils.get_test_oneview_driver_info(), - ) - - def test_get_properties(self): - expected = deploy_utils.get_properties() - with task_manager.acquire(self.context, self.node.uuid, - shared=True) as task: - self.assertEqual(expected, task.driver.inspect.get_properties()) - - @mock.patch.object(ov_common, 'validate_oneview_resources_compatibility', - autospect=True) - def test_validate(self, mock_validate): - with task_manager.acquire(self.context, self.node.uuid, - shared=False) as task: - task.driver.inspect.validate(task) - self.assertTrue(mock_validate.called) - - @mock.patch.object(deploy_utils, 'allocate_server_hardware_to_ironic', - autospect=True) - def test_inspect_hardware(self, mock_allocate_server_hardware_to_ironic): - with task_manager.acquire(self.context, self.node.uuid, - shared=False) as task: - task.driver.inspect.inspect_hardware(task) - self.assertTrue(mock_allocate_server_hardware_to_ironic.called) - - -class ISCSIPXEOneViewInspectTestCase(db_base.DbTestCase): - - def setUp(self): - super(ISCSIPXEOneViewInspectTestCase, self).setUp() - self.config(enabled=True, group='inspector') - self.config(manager_url='https://1.2.3.4', group='oneview') - self.config(enabled_drivers=['iscsi_pxe_oneview']) - self.node = obj_utils.create_test_node( - self.context, driver='iscsi_pxe_oneview', - properties=db_utils.get_test_oneview_properties(), - driver_info=db_utils.get_test_oneview_driver_info(), - ) def test_get_properties(self): expected = deploy_utils.get_properties() diff --git a/ironic/tests/unit/drivers/test_oneview.py b/ironic/tests/unit/drivers/test_oneview.py index cd33a8134c..484630a0c7 100644 --- a/ironic/tests/unit/drivers/test_oneview.py +++ b/ironic/tests/unit/drivers/test_oneview.py @@ -15,16 +15,9 @@ """Test class for HPE OneView Drivers.""" -import mock -import testtools - -from ironic.common import exception from ironic.conductor import task_manager from ironic.drivers.modules import agent from ironic.drivers.modules import noop -from ironic.drivers.modules.oneview import deploy -from ironic.drivers.modules.oneview import management -from ironic.drivers.modules.oneview import power from ironic.drivers.modules import pxe from ironic.drivers.modules.storage import noop as noop_storage from ironic.drivers import oneview @@ -131,42 +124,3 @@ class OneViewHardwareTestCase(db_base.DbTestCase): oneview.power.OneViewPower) self.assertIsInstance(task.driver.raid, agent.AgentRAID) - - -@mock.patch.object(oneview.importutils, 'try_import', autospec=True) -class AgentPXEOneViewDriversTestCase(testtools.TestCase): - - def test_oneview_agent_driver(self, mock_try_import): - mock_try_import.return_value = True - driver = oneview.AgentPXEOneViewDriver() - - self.assertIsInstance(driver.boot, pxe.PXEBoot) - self.assertIsInstance(driver.power, power.OneViewPower) - self.assertIsInstance(driver.deploy, deploy.OneViewAgentDeploy) - self.assertIsInstance(driver.management, management.OneViewManagement) - - def test_oneview_agent_driver_exc(self, mock_try_import): - mock_try_import.return_value = None - - self.assertRaises(exception.DriverLoadError, - oneview.AgentPXEOneViewDriver) - - -@mock.patch.object(oneview.importutils, 'try_import', autospec=True) -class ISCSIPXEOneViewDriversTestCase(testtools.TestCase): - - def test_oneview_iscsi_driver(self, mock_try_import): - mock_try_import.return_value = True - - driver = oneview.ISCSIPXEOneViewDriver() - - self.assertIsInstance(driver.boot, pxe.PXEBoot) - self.assertIsInstance(driver.power, power.OneViewPower) - self.assertIsInstance(driver.deploy, deploy.OneViewIscsiDeploy) - self.assertIsInstance(driver.management, management.OneViewManagement) - - def test_oneview_iscsi_driver_exc(self, mock_try_import): - mock_try_import.return_value = None - - self.assertRaises(exception.DriverLoadError, - oneview.ISCSIPXEOneViewDriver) diff --git a/releasenotes/notes/no-classic-oneview-e46ee2838d2b1d37.yaml b/releasenotes/notes/no-classic-oneview-e46ee2838d2b1d37.yaml new file mode 100644 index 0000000000..8f040b6d26 --- /dev/null +++ b/releasenotes/notes/no-classic-oneview-e46ee2838d2b1d37.yaml @@ -0,0 +1,6 @@ +--- +upgrade: + - | + The deprecated classic drivers ``iscsi_pxe_oneview`` and + ``agent_pxe_oneview`` have been removed. Please use the ``oneview`` + hardware type. diff --git a/setup.cfg b/setup.cfg index 7780652cbd..fa8f7011f9 100644 --- a/setup.cfg +++ b/setup.cfg @@ -56,9 +56,7 @@ ironic.drivers = agent_ipmitool = ironic.drivers.ipmi:AgentAndIPMIToolDriver agent_ipmitool_socat = ironic.drivers.ipmi:AgentAndIPMIToolAndSocatDriver agent_irmc = ironic.drivers.irmc:IRMCVirtualMediaAgentDriver - agent_pxe_oneview = ironic.drivers.oneview:AgentPXEOneViewDriver iscsi_irmc = ironic.drivers.irmc:IRMCVirtualMediaIscsiDriver - iscsi_pxe_oneview = ironic.drivers.oneview:ISCSIPXEOneViewDriver pxe_ipmitool = ironic.drivers.ipmi:PXEAndIPMIToolDriver pxe_ipmitool_socat = ironic.drivers.ipmi:PXEAndIPMIToolAndSocatDriver pxe_irmc = ironic.drivers.pxe:PXEAndIRMCDriver