Remove python-oneviewclient from Ironic OneView drivers

This patch removes the python-oneviewclient library from
OneView drivers since it was migrated to python-hponeview
and python-ilorest-library.

Change-Id: I061381a941e7d7f82863b326bb7555d41395e661
Closes-Bug: #1693788
This commit is contained in:
Hugo Nicodemos 2017-07-04 14:07:03 -03:00
parent c2eb357aa1
commit 037360f64d
17 changed files with 30 additions and 159 deletions

View File

@ -24,9 +24,8 @@ Classic Drivers
===============
The ``iscsi_pxe_oneview`` and ``agent_pxe_oneview`` drivers implement the
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.
core interfaces of an ironic Driver [2]_, and use the ``hpOneView`` [3]_ to
provide communication between ironic and OneView through OneView's REST API.
.. note::
Classic drivers will be deprecated in favor of Hardware Types.
@ -39,15 +38,15 @@ process:
* The ironic driver for OneView, which can be:
* `iscsi_pxe_oneview` or
* `agent_pxe_oneview`
* The python-oneviewclient library
* The hpOneView 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 ``python-oneviewclient`` being responsible for the communication with the
OneView appliance.
the ``hpOneView`` 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
@ -72,14 +71,14 @@ The following requirements apply for both ``iscsi_pxe_oneview`` and
Minimum version supported is 2.0.
* ``python-oneviewclient`` is a python package containing a client to manage
the communication between ironic and OneView.
* ``hpOneView`` is a python package containing a client to manage the
communication between ironic and OneView.
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::
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::
$ pip install "python-oneviewclient<3.0.0,>=2.4.0"
$ pip install "hpOneView>=3.2.1"
* ``ironic-inspector`` if using hardware inspection.
@ -97,7 +96,7 @@ Tested platforms
- Proliant BL460c Gen8
- Proliant BL460c Gen9
- Proliant BL465c Gen8
- Proliant DL360 Gen9 (starting with python-oneviewclient 2.1.0)
- Proliant DL360 Gen9
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
@ -435,7 +434,7 @@ References
==========
.. [1] HP OneView - https://www.hpe.com/us/en/integrated-systems/software.html
.. [2] :ref:`architecture_drivers`
.. [3] python-oneviewclient - https://pypi.python.org/pypi/python-oneviewclient
.. [3] hpOneView - https://pypi.python.org/pypi/hpOneView
.. [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/

View File

@ -7,10 +7,9 @@
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<4.0.0,>=3.2.1
hpOneView>=3.2.1
UcsSdk==0.8.2.2
python-dracclient>=1.3.0

View File

@ -40,7 +40,6 @@ 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
@ -219,19 +218,14 @@ 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('oneview_client.client'):
if not importutils.try_import('hpOneView.oneview_client'):
raise exception.DriverLoadError(
driver=self.__class__.__name__,
reason=_("Unable to import python-oneviewclient library"))
reason=_("Unable to import hpOneView 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()

View File

@ -25,20 +25,10 @@ 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."),
}
@ -75,25 +65,6 @@ 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
@ -105,9 +76,9 @@ def prepare_manager_url(manager_url):
def get_hponeview_client():
"""Generate an instance of the hpOneView client.
"""Generate an instance of the HPE OneView client.
Generates an instance of the hpOneView client using the hpOneView library.
Generates an instance of the HPE OneView client using the hpOneView lib.
:returns: an instance of the OneViewClient
:raises: InvalidParameterValue if mandatory information is missing on the

View File

@ -221,7 +221,6 @@ 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()
@ -265,7 +264,6 @@ 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()

View File

@ -26,8 +26,6 @@ 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():
@ -201,7 +199,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 OneView client
:param client: an instance of the HPE OneView client
:param node: an ironic node object
:returns: Boolean value. True if node is in use by ironic,
False otherwise.

View File

@ -15,7 +15,6 @@
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
@ -28,9 +27,6 @@ from ironic.conf import CONF
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."""
@ -38,7 +34,6 @@ 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()
@ -68,7 +63,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.oneview_client, task.node, profile_name
self.client, task.node, profile_name
)
return super(OneViewInspect, self).inspect_hardware(task)

View File

@ -26,7 +26,6 @@ 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__)
@ -167,7 +166,6 @@ 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()
@ -192,7 +190,6 @@ 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
):

View File

@ -27,7 +27,6 @@ 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__)
@ -60,7 +59,6 @@ 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()

View File

@ -21,7 +21,6 @@ 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
@ -57,7 +56,7 @@ class OneViewHardware(generic.GenericHardware):
class AgentPXEOneViewDriver(base.BaseDriver):
"""OneViewDriver using OneViewClient interface.
"""OneViewDriver using HPE OneViewClient interface.
This driver implements the `core` functionality using
:class:ironic.drivers.modules.oneview.power.OneViewPower for power
@ -66,21 +65,11 @@ 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()
@ -90,7 +79,7 @@ class AgentPXEOneViewDriver(base.BaseDriver):
class ISCSIPXEOneViewDriver(base.BaseDriver):
"""OneViewDriver using OneViewClient interface.
"""OneViewDriver using HPE OneViewClient interface.
This driver implements the `core` functionality using
:class:ironic.drivers.modules.oneview.power.OneViewPower for power
@ -99,21 +88,11 @@ 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()

View File

@ -25,8 +25,7 @@ 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('oneview_client.client')
oneview_states = importutils.try_import('oneview_client.states')
hponeview_client = importutils.try_import('hpOneView.oneview_client')
class OneViewCommonTestCase(db_base.DbTestCase):

View File

@ -14,7 +14,6 @@
# under the License.
import mock
from oslo_utils import importutils
from ironic.common import driver_factory
from ironic.common import exception
@ -31,8 +30,6 @@ 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()
@ -86,7 +83,6 @@ 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)

View File

@ -29,10 +29,7 @@ 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')

View File

@ -31,8 +31,6 @@ 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')

View File

@ -123,26 +123,6 @@ 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',

View File

@ -25,7 +25,6 @@ Current list of mocked libraries:
- proliantutils
- pysnmp
- scciclient
- oneview_client
- hpOneView
- pywsman
- python-dracclient
@ -68,38 +67,6 @@ 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)

View File

@ -0,0 +1,6 @@
---
other:
- |
The OneView drivers no longer use ``python-oneviewclient`` to communicate with
OneView appliances. The ``oneview`` hardware type now uses the ``hpOneView``
and ``python-ilorest-library`` libraries.