summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Nicodemos <nicodemos@lsd.ufcg.edu.br>2017-11-09 18:07:01 +0000
committerHugo Nicodemos <nicodemos@lsd.ufcg.edu.br>2017-11-09 16:12:03 -0300
commit9b523967e1aeb996e5567eebe6184b00fbbc4377 (patch)
tree542843cca22f0e0bb67cfa453764f2029c9b50be
parent9982a881e6d3181cdeb0a72ba6727773116279a6 (diff)
downloadironic-9b523967e1aeb996e5567eebe6184b00fbbc4377.tar.gz
Revert "Remove python-oneviewclient from Ironic OneView drivers"
Reverting these changes because python-hpOneView does not provide HTTPS secure connection with custom CAcert and could cause a possible security issue. This reverts commit 037360f64d5db7401df1d656fa8f1932011b5587. Change-Id: I2a95f3cd23f20c363fe97fc347c9d2619d2ab5e9
-rw-r--r--doc/source/admin/drivers/oneview.rst27
-rw-r--r--driver-requirements.txt3
-rw-r--r--ironic/drivers/fake.py12
-rw-r--r--ironic/drivers/modules/oneview/common.py33
-rw-r--r--ironic/drivers/modules/oneview/deploy.py2
-rw-r--r--ironic/drivers/modules/oneview/deploy_utils.py4
-rw-r--r--ironic/drivers/modules/oneview/inspect.py7
-rw-r--r--ironic/drivers/modules/oneview/management.py3
-rw-r--r--ironic/drivers/modules/oneview/power.py2
-rw-r--r--ironic/drivers/oneview.py25
-rw-r--r--ironic/tests/unit/drivers/modules/oneview/test_common.py3
-rw-r--r--ironic/tests/unit/drivers/modules/oneview/test_deploy.py4
-rw-r--r--ironic/tests/unit/drivers/modules/oneview/test_management.py3
-rw-r--r--ironic/tests/unit/drivers/modules/oneview/test_power.py2
-rw-r--r--ironic/tests/unit/drivers/third_party_driver_mock_specs.py20
-rw-r--r--ironic/tests/unit/drivers/third_party_driver_mocks.py33
-rw-r--r--releasenotes/notes/remove-python-oneviewclient-f47e22322f7d151f.yaml6
17 files changed, 159 insertions, 30 deletions
diff --git a/doc/source/admin/drivers/oneview.rst b/doc/source/admin/drivers/oneview.rst
index 91d369671..2793af870 100644
--- a/doc/source/admin/drivers/oneview.rst
+++ b/doc/source/admin/drivers/oneview.rst
@@ -24,8 +24,9 @@ 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]_ to
-provide communication between ironic and OneView through OneView's REST API.
+core interfaces of an ironic Driver [2]_, and use the ``python-oneviewclient``
+[3]_ to provide communication between ironic and OneView through OneView's
+REST API.
.. note::
Classic drivers will be deprecated in favor of Hardware Types.
@@ -38,15 +39,15 @@ process:
* The ironic driver for OneView, which can be:
* `iscsi_pxe_oneview` or
* `agent_pxe_oneview`
-* The hpOneView library
+* The python-oneviewclient library
* The OneView appliance
The role of ironic is to serve as a bare metal provider to OneView's managed
physical hardware and to provide communication with other necessary OpenStack
services such as Nova and Glance. When ironic receives a boot request, it
works together with the ironic OneView driver to access a machine in OneView,
-the ``hpOneView`` being responsible for the communication with the OneView
-appliance.
+the ``python-oneviewclient`` being responsible for the communication with the
+OneView appliance.
From the Newton release on, OneView drivers enables a new feature called
**dynamic allocation** of nodes [6]_. In this model, the driver allocates
@@ -71,14 +72,14 @@ The following requirements apply for both ``iscsi_pxe_oneview`` and
Minimum version supported is 2.0.
-* ``hpOneView`` is a python package containing a client to manage the
- communication between ironic and OneView.
+* ``python-oneviewclient`` is a python package containing a client to manage
+ the communication between ironic and OneView.
- Install the ``hpOneView`` module to enable the communication. Minimum version
- required is 3.2.1 but it is recommended to install the most up-to-date
- version::
+ Install the ``python-oneviewclient`` module to enable the communication.
+ Minimum version required is 2.4.0 but it is recommended to install the most
+ up-to-date version::
- $ pip install "hpOneView>=3.2.1"
+ $ pip install "python-oneviewclient<3.0.0,>=2.4.0"
* ``ironic-inspector`` if using hardware inspection.
@@ -96,7 +97,7 @@ Tested platforms
- Proliant BL460c Gen8
- Proliant BL460c Gen9
- Proliant BL465c Gen8
- - Proliant DL360 Gen9
+ - Proliant DL360 Gen9 (starting with python-oneviewclient 2.1.0)
Notice that for the driver to work correctly with Gen8 and Gen9 DL servers
in general, the hardware also needs to run version 4.2.3 of iLO, with
@@ -434,7 +435,7 @@ References
==========
.. [1] HP OneView - https://www.hpe.com/us/en/integrated-systems/software.html
.. [2] :ref:`architecture_drivers`
-.. [3] hpOneView - https://pypi.python.org/pypi/hpOneView
+.. [3] python-oneviewclient - https://pypi.python.org/pypi/python-oneviewclient
.. [6] Dynamic Allocation in OneView drivers - http://specs.openstack.org/openstack/ironic-specs/specs/not-implemented/oneview-drivers-dynamic-allocation.html
.. [7] ironic-oneviewd - https://pypi.python.org/pypi/ironic-oneviewd/
.. [8] ironic-oneview-cli - https://pypi.python.org/pypi/ironic-oneview-cli/
diff --git a/driver-requirements.txt b/driver-requirements.txt
index ac0070fbf..2c3a62b8e 100644
--- a/driver-requirements.txt
+++ b/driver-requirements.txt
@@ -7,9 +7,10 @@
proliantutils>=2.4.1
pysnmp
python-ironic-inspector-client>=1.5.0
+python-oneviewclient<3.0.0,>=2.5.2
python-scciclient>=0.5.0
python-ilorest-library>=1.9.2
-hpOneView>=3.2.1
+hpOneView<4.0.0,>=3.2.1
UcsSdk==0.8.2.2
python-dracclient>=1.3.0
diff --git a/ironic/drivers/fake.py b/ironic/drivers/fake.py
index 27b62e152..28ddf1f7f 100644
--- a/ironic/drivers/fake.py
+++ b/ironic/drivers/fake.py
@@ -40,6 +40,7 @@ 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
+from ironic.drivers.modules.oneview import common as oneview_common
from ironic.drivers.modules.oneview import management as oneview_management
from ironic.drivers.modules.oneview import power as oneview_power
from ironic.drivers.modules import pxe
@@ -218,14 +219,19 @@ class FakeCIMCDriver(base.BaseDriver):
class FakeOneViewDriver(base.BaseDriver):
- """Fake OneView driver. For testing purposes."""
+ """Fake OneView driver. For testing purposes. """
def __init__(self):
- if not importutils.try_import('hpOneView.oneview_client'):
+ if not importutils.try_import('oneview_client.client'):
raise exception.DriverLoadError(
driver=self.__class__.__name__,
- reason=_("Unable to import hpOneView library"))
+ reason=_("Unable to import python-oneviewclient library"))
+ # Checks connectivity to OneView and version compatibility on driver
+ # initialization
+ oneview_client = oneview_common.get_oneview_client()
+ oneview_client.verify_oneview_version()
+ oneview_client.verify_credentials()
self.power = oneview_power.OneViewPower()
self.management = oneview_management.OneViewManagement()
self.boot = fake.FakeBoot()
diff --git a/ironic/drivers/modules/oneview/common.py b/ironic/drivers/modules/oneview/common.py
index 122c847f2..cb0b871a6 100644
--- a/ironic/drivers/modules/oneview/common.py
+++ b/ironic/drivers/modules/oneview/common.py
@@ -25,10 +25,20 @@ from ironic.drivers import utils
LOG = logging.getLogger(__name__)
+# NOTE(mrtenio): hpOneView will be the default library for OneView. It
+# is being introduced together with the python-oneviewclient to be used
+# generally by other patches. python-oneviewclient will be removed
+# subsequently.
+client = importutils.try_import('oneview_client.client')
+oneview_utils = importutils.try_import('oneview_client.utils')
+oneview_states = importutils.try_import('oneview_client.states')
+oneview_exceptions = importutils.try_import('oneview_client.exceptions')
+
hponeview_client = importutils.try_import('hpOneView.oneview_client')
redfish = importutils.try_import('redfish')
client_exception = importutils.try_import('hpOneView.exceptions')
+
REQUIRED_ON_DRIVER_INFO = {
'server_hardware_uri': _("Server Hardware URI. Required in driver_info."),
}
@@ -65,6 +75,25 @@ NODE_IN_USE_BY_ONEVIEW = 'node in use by OneView'
SERVER_HARDWARE_ALLOCATION_ERROR = 'server hardware allocation error'
+def get_oneview_client():
+ """Generate an instance of the OneView client.
+
+ Generates an instance of the OneView client using the imported
+ oneview_client library.
+
+ :returns: an instance of the OneView client
+ """
+ oneview_client = client.Client(
+ manager_url=CONF.oneview.manager_url,
+ username=CONF.oneview.username,
+ password=CONF.oneview.password,
+ allow_insecure_connections=CONF.oneview.allow_insecure_connections,
+ tls_cacert_file=CONF.oneview.tls_cacert_file,
+ max_polling_attempts=CONF.oneview.max_polling_attempts
+ )
+ return oneview_client
+
+
def prepare_manager_url(manager_url):
# NOTE(mrtenio) python-oneviewclient uses https or http in the manager_url
# while python-hpOneView does not. This will not be necessary when
@@ -76,9 +105,9 @@ def prepare_manager_url(manager_url):
def get_hponeview_client():
- """Generate an instance of the HPE OneView client.
+ """Generate an instance of the hpOneView client.
- Generates an instance of the HPE OneView client using the hpOneView lib.
+ Generates an instance of the hpOneView client using the hpOneView library.
:returns: an instance of the OneViewClient
:raises: InvalidParameterValue if mandatory information is missing on the
diff --git a/ironic/drivers/modules/oneview/deploy.py b/ironic/drivers/modules/oneview/deploy.py
index 3f2704986..d4553a32f 100644
--- a/ironic/drivers/modules/oneview/deploy.py
+++ b/ironic/drivers/modules/oneview/deploy.py
@@ -221,6 +221,7 @@ class OneViewIscsiDeploy(iscsi_deploy.ISCSIDeploy, OneViewPeriodicTasks):
def __init__(self):
super(OneViewIscsiDeploy, self).__init__()
self.client = common.get_hponeview_client()
+ self.oneview_client = common.get_oneview_client()
def get_properties(self):
return deploy_utils.get_properties()
@@ -264,6 +265,7 @@ class OneViewAgentDeploy(agent.AgentDeploy, OneViewPeriodicTasks):
def __init__(self):
super(OneViewAgentDeploy, self).__init__()
self.client = common.get_hponeview_client()
+ self.oneview_client = common.get_oneview_client()
def get_properties(self):
return deploy_utils.get_properties()
diff --git a/ironic/drivers/modules/oneview/deploy_utils.py b/ironic/drivers/modules/oneview/deploy_utils.py
index 9b6b31b1d..ad6a711e0 100644
--- a/ironic/drivers/modules/oneview/deploy_utils.py
+++ b/ironic/drivers/modules/oneview/deploy_utils.py
@@ -26,6 +26,8 @@ from ironic.drivers.modules.oneview import common
LOG = logging.getLogger(__name__)
client_exception = importutils.try_import('hpOneView.exceptions')
+oneview_exception = importutils.try_import('oneview_client.exceptions')
+oneview_utils = importutils.try_import('oneview_client.utils')
def get_properties():
@@ -199,7 +201,7 @@ def is_node_in_use_by_oneview(client, node):
def is_node_in_use_by_ironic(client, node):
"""Check if node is in use by ironic in OneView.
- :param client: an instance of the HPE OneView client
+ :param client: an instance of the OneView client
:param node: an ironic node object
:returns: Boolean value. True if node is in use by ironic,
False otherwise.
diff --git a/ironic/drivers/modules/oneview/inspect.py b/ironic/drivers/modules/oneview/inspect.py
index 40d674547..fc3838d50 100644
--- a/ironic/drivers/modules/oneview/inspect.py
+++ b/ironic/drivers/modules/oneview/inspect.py
@@ -15,6 +15,7 @@
from futurist import periodics
from ironic_lib import metrics_utils
+from oslo_utils import importutils
from ironic.common import exception
from ironic.common import states
@@ -26,6 +27,9 @@ from ironic.drivers.modules.oneview import deploy_utils
METRICS = metrics_utils.get_metrics_logger(__name__)
+oneview_exception = importutils.try_import('oneview_client.exceptions')
+oneview_utils = importutils.try_import('oneview_client.utils')
+
class OneViewInspect(inspector.Inspector):
"""Interface for in band inspection."""
@@ -33,6 +37,7 @@ class OneViewInspect(inspector.Inspector):
def __init__(self):
super(OneViewInspect, self).__init__()
self.client = common.get_hponeview_client()
+ self.oneview_client = common.get_oneview_client()
def get_properties(self):
return deploy_utils.get_properties()
@@ -62,7 +67,7 @@ class OneViewInspect(inspector.Inspector):
def inspect_hardware(self, task):
profile_name = 'Ironic Inspecting [%s]' % task.node.uuid
deploy_utils.allocate_server_hardware_to_ironic(
- self.client, task.node, profile_name
+ self.oneview_client, task.node, profile_name
)
return super(OneViewInspect, self).inspect_hardware(task)
diff --git a/ironic/drivers/modules/oneview/management.py b/ironic/drivers/modules/oneview/management.py
index bf6549c22..f94c1bca3 100644
--- a/ironic/drivers/modules/oneview/management.py
+++ b/ironic/drivers/modules/oneview/management.py
@@ -26,6 +26,7 @@ from ironic.drivers.modules.oneview import common
from ironic.drivers.modules.oneview import deploy_utils
client_exception = importutils.try_import('hpOneView.exceptions')
+oneview_exceptions = importutils.try_import('oneview_client.exceptions')
LOG = logging.getLogger(__name__)
METRICS = metrics_utils.get_metrics_logger(__name__)
@@ -166,6 +167,7 @@ class OneViewManagement(base.ManagementInterface):
def __init__(self):
super(OneViewManagement, self).__init__()
self.client = common.get_hponeview_client()
+ self.oneview_client = common.get_oneview_client()
def get_properties(self):
return deploy_utils.get_properties()
@@ -190,6 +192,7 @@ class OneViewManagement(base.ManagementInterface):
try:
common.validate_oneview_resources_compatibility(self.client, task)
+
if not deploy_utils.is_node_in_use_by_ironic(
self.client, task.node
):
diff --git a/ironic/drivers/modules/oneview/power.py b/ironic/drivers/modules/oneview/power.py
index ab0091f55..fe4115bf5 100644
--- a/ironic/drivers/modules/oneview/power.py
+++ b/ironic/drivers/modules/oneview/power.py
@@ -27,6 +27,7 @@ from ironic.drivers.modules.oneview import deploy_utils
from ironic.drivers.modules.oneview import management
client_exception = importutils.try_import('hpOneView.exceptions')
+oneview_exceptions = importutils.try_import('oneview_client.exceptions')
LOG = logging.getLogger(__name__)
METRICS = metrics_utils.get_metrics_logger(__name__)
@@ -59,6 +60,7 @@ class OneViewPower(base.PowerInterface):
def __init__(self):
super(OneViewPower, self).__init__()
self.client = common.get_hponeview_client()
+ self.oneview_client = common.get_oneview_client()
def get_properties(self):
return deploy_utils.get_properties()
diff --git a/ironic/drivers/oneview.py b/ironic/drivers/oneview.py
index 9391bcd97..27038a46d 100644
--- a/ironic/drivers/oneview.py
+++ b/ironic/drivers/oneview.py
@@ -21,6 +21,7 @@ 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 common
from ironic.drivers.modules.oneview import deploy
from ironic.drivers.modules.oneview import inspect
from ironic.drivers.modules.oneview import management
@@ -56,7 +57,7 @@ class OneViewHardware(generic.GenericHardware):
class AgentPXEOneViewDriver(base.BaseDriver):
- """OneViewDriver using HPE OneViewClient interface.
+ """OneViewDriver using OneViewClient interface.
This driver implements the `core` functionality using
:class:ironic.drivers.modules.oneview.power.OneViewPower for power
@@ -65,11 +66,21 @@ class AgentPXEOneViewDriver(base.BaseDriver):
"""
def __init__(self):
+ if not importutils.try_import('oneview_client.client'):
+ raise exception.DriverLoadError(
+ driver=self.__class__.__name__,
+ reason=_("Unable to import python-oneviewclient library"))
+
if not importutils.try_import('hpOneView.oneview_client'):
raise exception.DriverLoadError(
driver=self.__class__.__name__,
reason=_("Unable to import hpOneView library"))
+ # Checks connectivity to OneView and version compatibility on driver
+ # initialization
+ oneview_client = common.get_oneview_client()
+ oneview_client.verify_oneview_version()
+ oneview_client.verify_credentials()
self.power = power.OneViewPower()
self.management = management.OneViewManagement()
self.boot = pxe.PXEBoot()
@@ -79,7 +90,7 @@ class AgentPXEOneViewDriver(base.BaseDriver):
class ISCSIPXEOneViewDriver(base.BaseDriver):
- """OneViewDriver using HPE OneViewClient interface.
+ """OneViewDriver using OneViewClient interface.
This driver implements the `core` functionality using
:class:ironic.drivers.modules.oneview.power.OneViewPower for power
@@ -88,11 +99,21 @@ class ISCSIPXEOneViewDriver(base.BaseDriver):
"""
def __init__(self):
+ if not importutils.try_import('oneview_client.client'):
+ raise exception.DriverLoadError(
+ driver=self.__class__.__name__,
+ reason=_("Unable to import python-oneviewclient library"))
+
if not importutils.try_import('hpOneView.oneview_client'):
raise exception.DriverLoadError(
driver=self.__class__.__name__,
reason=_("Unable to import hpOneView library"))
+ # Checks connectivity to OneView and version compatibility on driver
+ # initialization
+ oneview_client = common.get_oneview_client()
+ oneview_client.verify_oneview_version()
+ oneview_client.verify_credentials()
self.power = power.OneViewPower()
self.management = management.OneViewManagement()
self.boot = pxe.PXEBoot()
diff --git a/ironic/tests/unit/drivers/modules/oneview/test_common.py b/ironic/tests/unit/drivers/modules/oneview/test_common.py
index 0755d5c06..7f26221ed 100644
--- a/ironic/tests/unit/drivers/modules/oneview/test_common.py
+++ b/ironic/tests/unit/drivers/modules/oneview/test_common.py
@@ -25,7 +25,8 @@ 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
-hponeview_client = importutils.try_import('hpOneView.oneview_client')
+hponeview_client = importutils.try_import('oneview_client.client')
+oneview_states = importutils.try_import('oneview_client.states')
class OneViewCommonTestCase(db_base.DbTestCase):
diff --git a/ironic/tests/unit/drivers/modules/oneview/test_deploy.py b/ironic/tests/unit/drivers/modules/oneview/test_deploy.py
index 7304786de..0dd8e003f 100644
--- a/ironic/tests/unit/drivers/modules/oneview/test_deploy.py
+++ b/ironic/tests/unit/drivers/modules/oneview/test_deploy.py
@@ -14,6 +14,7 @@
# under the License.
import mock
+from oslo_utils import importutils
from ironic.common import driver_factory
from ironic.common import exception
@@ -30,6 +31,8 @@ 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
+oneview_models = importutils.try_import('oneview_client.models')
+
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()
@@ -83,6 +86,7 @@ class OneViewDriverDeploy(deploy.OneViewPeriodicTasks):
def __init__(self):
self.client = mock.MagicMock()
+ self.oneview_client = mock.MagicMock()
@mock.patch('ironic.objects.Node', spec_set=True, autospec=True)
diff --git a/ironic/tests/unit/drivers/modules/oneview/test_management.py b/ironic/tests/unit/drivers/modules/oneview/test_management.py
index af48dbe9b..c6bbf1f69 100644
--- a/ironic/tests/unit/drivers/modules/oneview/test_management.py
+++ b/ironic/tests/unit/drivers/modules/oneview/test_management.py
@@ -29,7 +29,10 @@ 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
+
client_exception = importutils.try_import('hpOneView.exceptions')
+oneview_exceptions = importutils.try_import('oneview_client.exceptions')
+oneview_models = importutils.try_import('oneview_client.models')
@mock.patch.object(common, 'get_hponeview_client')
diff --git a/ironic/tests/unit/drivers/modules/oneview/test_power.py b/ironic/tests/unit/drivers/modules/oneview/test_power.py
index f4cb60055..0cba73b67 100644
--- a/ironic/tests/unit/drivers/modules/oneview/test_power.py
+++ b/ironic/tests/unit/drivers/modules/oneview/test_power.py
@@ -31,6 +31,8 @@ from ironic.tests.unit.db import utils as db_utils
from ironic.tests.unit.objects import utils as obj_utils
client_exception = importutils.try_import('hpOneView.exceptions')
+oneview_models = importutils.try_import('oneview_client.models')
+oneview_exceptions = importutils.try_import('oneview_client.exceptions')
@mock.patch.object(common, 'get_hponeview_client')
diff --git a/ironic/tests/unit/drivers/third_party_driver_mock_specs.py b/ironic/tests/unit/drivers/third_party_driver_mock_specs.py
index c18586e61..4e7e8b7c0 100644
--- a/ironic/tests/unit/drivers/third_party_driver_mock_specs.py
+++ b/ironic/tests/unit/drivers/third_party_driver_mock_specs.py
@@ -123,6 +123,26 @@ SCCICLIENT_VIOM_CONF_SPEC = (
'terminate',
)
+ONEVIEWCLIENT_SPEC = (
+ 'client',
+ 'states',
+ 'exceptions',
+ 'models',
+ 'utils',
+)
+
+ONEVIEWCLIENT_CLIENT_CLS_SPEC = (
+)
+
+ONEVIEWCLIENT_STATES_SPEC = (
+ 'ONEVIEW_POWER_OFF',
+ 'ONEVIEW_POWERING_OFF',
+ 'ONEVIEW_POWER_ON',
+ 'ONEVIEW_POWERING_ON',
+ 'ONEVIEW_RESETTING',
+ 'ONEVIEW_ERROR',
+)
+
HPONEVIEW_SPEC = (
'oneview_client',
'resources',
diff --git a/ironic/tests/unit/drivers/third_party_driver_mocks.py b/ironic/tests/unit/drivers/third_party_driver_mocks.py
index 2eafc8a09..ed5992f50 100644
--- a/ironic/tests/unit/drivers/third_party_driver_mocks.py
+++ b/ironic/tests/unit/drivers/third_party_driver_mocks.py
@@ -25,6 +25,7 @@ Current list of mocked libraries:
- proliantutils
- pysnmp
- scciclient
+- oneview_client
- hpOneView
- pywsman
- python-dracclient
@@ -67,6 +68,38 @@ if not proliantutils:
if 'ironic.drivers.ilo' in sys.modules:
six.moves.reload_module(sys.modules['ironic.drivers.ilo'])
+
+oneview_client = importutils.try_import('oneview_client')
+if not oneview_client:
+ oneview_client = mock.MagicMock(spec_set=mock_specs.ONEVIEWCLIENT_SPEC)
+ sys.modules['oneview_client'] = oneview_client
+ sys.modules['oneview_client.client'] = oneview_client.client
+ states = mock.MagicMock(
+ spec_set=mock_specs.ONEVIEWCLIENT_STATES_SPEC,
+ ONEVIEW_POWER_OFF='Off',
+ ONEVIEW_POWERING_OFF='PoweringOff',
+ ONEVIEW_POWER_ON='On',
+ ONEVIEW_POWERING_ON='PoweringOn',
+ ONEVIEW_RESETTING='Resetting',
+ ONEVIEW_ERROR='error')
+ sys.modules['oneview_client.states'] = states
+ sys.modules['oneview_client.exceptions'] = oneview_client.exceptions
+ sys.modules['oneview_client.utils'] = oneview_client.utils
+ oneview_client.exceptions.OneViewException = type('OneViewException',
+ (Exception,), {})
+ sys.modules['oneview_client.models'] = oneview_client.models
+
+oneview_client_module = importutils.try_import('oneview_client.client')
+# NOTE(vdrok): Always mock the oneview client, as it tries to establish
+# connection to oneview right in __init__, and stevedore does not seem to care
+# about mocks when it loads a module in mock_the_extension_manager
+sys.modules['oneview_client.client'].Client = mock.MagicMock(
+ spec_set=mock_specs.ONEVIEWCLIENT_CLIENT_CLS_SPEC
+)
+if 'ironic.drivers.oneview' in sys.modules:
+ six.moves.reload_module(sys.modules['ironic.drivers.modules.oneview'])
+
+
hpOneView = importutils.try_import('hpOneView')
if not hpOneView:
hpOneView = mock.MagicMock(spec_set=mock_specs.HPONEVIEW_SPEC)
diff --git a/releasenotes/notes/remove-python-oneviewclient-f47e22322f7d151f.yaml b/releasenotes/notes/remove-python-oneviewclient-f47e22322f7d151f.yaml
deleted file mode 100644
index 468299e9e..000000000
--- a/releasenotes/notes/remove-python-oneviewclient-f47e22322f7d151f.yaml
+++ /dev/null
@@ -1,6 +0,0 @@
----
-upgrade:
- - |
- The ``oneview`` drivers now use ``hpOneView`` and
- ``python-ilorest-library`` libraries to communicate with OneView
- appliances. The ``python-oneviewclient`` library is no longer used.