Remove python-oneviewclient from oneview hardware type.

This patch removes the ``python-oneviewclient`` library from
``oneview`` hardware type since it was migrated to ``hponeview``
and ``python-ilorest-library``.

Change-Id: I3393189abdff6a0e56f54375877cc310d72ff5b1
Closes-Bug: #1693788
This commit is contained in:
Hugo Nicodemos 2017-12-01 17:58:11 -03:00 committed by Julia Kreger
parent 22711ba98b
commit f8bf0ad51b
16 changed files with 33 additions and 147 deletions

View File

@ -23,10 +23,9 @@ following classic drivers:
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.
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.
@ -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 4.4.0 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>=4.4.0"
* ``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

@ -2954,10 +2954,6 @@
# Path to CA certificate. (string value)
#tls_cacert_file = <None>
# Max connection retries to check changes on OneView. (integer
# value)
#max_polling_attempts = 12
# Whether to enable the periodic tasks for OneView driver be
# aware when OneView hardware resources are taken and released
# by Ironic or OneView users and proactively manage nodes in

View File

@ -31,9 +31,6 @@ opts = [
help=_('Option to allow insecure connection with OneView.')),
cfg.StrOpt('tls_cacert_file',
help=_('Path to CA certificate.')),
cfg.IntOpt('max_polling_attempts',
default=12,
help=_('Max connection retries to check changes on OneView.')),
cfg.BoolOpt('enable_periodic_tasks',
default=True,
help=_('Whether to enable the periodic tasks for OneView '

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

@ -27,11 +27,6 @@ from ironic.drivers import utils
LOG = logging.getLogger(__name__)
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')
@ -72,25 +67,6 @@ NODE_IN_USE_BY_ONEVIEW = 'node in use by OneView'
SERVER_HARDWARE_ALLOCATION_ERROR = 'server hardware allocation error'
def get_oneview_client():
"""Generates 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

View File

@ -25,8 +25,6 @@ from ironic.drivers.modules.oneview import common
LOG = logging.getLogger(__name__)
oneview_exception = importutils.try_import('oneview_client.exceptions')
oneview_utils = importutils.try_import('oneview_client.utils')
client_exception = importutils.try_import('hpOneView.exceptions')

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
@ -27,9 +26,6 @@ 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."""

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__)

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__)

View File

@ -23,7 +23,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
@ -68,11 +67,6 @@ 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__,
@ -83,11 +77,6 @@ class AgentPXEOneViewDriver(base.BaseDriver):
driver=self.__class__.__name__,
reason=_("Unable to import python-ilorest-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()
@ -106,11 +95,6 @@ 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__,
@ -121,11 +105,6 @@ class ISCSIPXEOneViewDriver(base.BaseDriver):
driver=self.__class__.__name__,
reason=_("Unable to import python-ilorest-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

@ -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()
@ -84,9 +81,6 @@ def _setup_node_in_cleanfailed_state_without_oneview_error(node):
class OneViewDriverDeploy(deploy.OneViewPeriodicTasks):
oneview_driver = 'fake_oneview'
def __init__(self):
self.oneview_client = mock.MagicMock()
@mock.patch('ironic.objects.Node', spec_set=True, autospec=True)
@mock.patch.object(deploy_utils, 'is_node_in_use_by_oneview')

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')
class OneViewPowerDriverTestCase(db_base.DbTestCase):

View File

@ -124,26 +124,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',
)
HPE_ONEVIEW_SPEC = (
'oneview_client',
'resources',

View File

@ -25,7 +25,6 @@ Current list of mocked libraries:
- proliantutils
- pysnmp
- scciclient
- oneview_client
- hpOneView
- pywsman
- python-dracclient
@ -69,37 +68,6 @@ if not proliantutils:
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.HPE_ONEVIEW_SPEC)

View File

@ -0,0 +1,16 @@
---
issues:
- |
The library ``python-ilorest-library`` is a fork of the
``python-redfish-library`` and imported with same name, hence conflict
when together. ``python-redfish-library`` cannot be used when ``oneview``
hardware type is in use.
upgrade:
- |
The ``oneview`` hardware type now use ``hpOneView`` and
``python-ilorest-library`` libraries to communicate with OneView
appliances. The ``python-oneviewclient`` library is no longer used.
upgrade:
- |
Configuration ``[oneview]max_polling_attempts`` is removed since
``hpOneView`` doesn't support this option.