Finish switch to inspector and inspector-client

This change is a bit ahead of time, as inspector was not released yet,
but we have chicken-and-egg problem with fixing inspector devstack here.

Change-Id: Iddb5377450806ad768582a705e1c4274079b002f
This commit is contained in:
Dmitry Tantsur 2015-06-18 17:25:35 +02:00
parent 13bcebcaf3
commit 6c08d283bb
7 changed files with 52 additions and 56 deletions

View File

@ -59,12 +59,12 @@ very similar to other OpenStack Services:
Optionally, one may wish to utilize the following associated projects for
additional functionality:
- ironic-discoverd_; An associated service which performs in-band hardware
- ironic-inspector_; An associated service which performs in-band hardware
introspection by PXE booting unregistered hardware into a "discovery ramdisk".
- diskimage-builder_; May be used to customize machine images, create and
discovery deploy ramdisks, if necessary.
.. _ironic-discoverd: https://github.com/stackforge/ironic-discoverd
.. _ironic-inspector: https://github.com/openstack/ironic-inspector
.. _diskimage-builder: https://github.com/openstack/diskimage-builder
@ -1396,7 +1396,7 @@ There are two kinds of inspection supported by Ironic:
#. Out-of-band inspection is currently implemented by iLO drivers, listed at
:ref:`ilo`.
#. In-band inspection is performed by utilizing the ironic-discoverd_ project.
#. In-band inspection is performed by utilizing the ironic-inspector_ project.
This is supported by the following drivers::
pxe_drac
@ -1404,22 +1404,31 @@ There are two kinds of inspection supported by Ironic:
pxe_ipminative
pxe_ssh
As of Kilo release this feature needs to be explicitly enabled in the
configuration by setting ``enabled = True`` in ``[discoverd]`` section.
You must additionally install ``ironic-discoverd`` to use this functionality.
You must set ``service_url`` if the ironic-discoverd service is
This feature needs to be explicitly enabled in the configuration
by setting ``enabled = True`` in ``[inspector]`` section.
You must additionally install python-ironic-inspector-client_ to use
this functionality.
You must set ``service_url`` if the ironic-inspector service is
being run on a separate host from the ironic-conductor service, or is using
non-standard port.
In order to ensure that ports in Ironic are synchronized with NIC ports on
the node, the following settings in the ironic-discoverd configuration file
the node, the following settings in the ironic-inspector configuration file
must be set::
[discoverd]
[processing]
add_ports = all
keep_ports = present
Note: It will require ironic-discoverd of version 1.1.0 or higher.
.. note::
During Kilo cycle we used on older verions of Inspector called
ironic-discoverd_. Inspector is expected to be a mostly drop-in
replacement, and the same client library should be used to connect to both.
For Ironic Kilo install ironic-discoverd_ of version 1.1.0 or higher
instead of python-ironic-inspector-client and use ``[discoverd]`` option
group in both Ironic and ironic-discoverd configuration files instead of
ones provided above.
Inspection can be initiated using node-set-provision-state.
The node should be in MANAGEABLE state before inspection is initiated.
@ -1435,7 +1444,8 @@ The node should be in MANAGEABLE state before inspection is initiated.
.. note::
The above commands require the python-ironicclient_ to be version 0.5.0 or greater.
.. _ironic-discoverd: https://github.com/stackforge/ironic-discoverd
.. _ironic-discoverd: https://pypi.python.org/pypi/ironic-discoverd
.. _python-ironic-inspector-client: https://pypi.python.org/pypi/python-ironic-inspector-client
.. _python-ironicclient: https://pypi.python.org/pypi/python-ironicclient
Specifying the disk for deployment

View File

@ -11,6 +11,17 @@ The Ironic service is tightly coupled with the Ironic driver that is shipped
with Nova. Currently, some special considerations must be taken into account
when upgrading your cloud from previous versions of OpenStack.
Upgrading from Kilo to Liberty
==============================
Inspection
----------
If you used in-band inspection with **ironic-discoverd**, you have to install
**python-ironic-inspector-client** before the upgrade. It's also recommended
that you switch to using **ironic-inspector**, which is a newer version of the
same service.
Upgrading from Juno to Kilo
===========================

View File

@ -4,10 +4,10 @@
# python projects they should package as optional dependencies for Ironic.
# These are available on pypi
ironic-discoverd>=1.0.0
proliantutils>=2.1.0
pyghmi
pysnmp
python-ironic-inspector-client
python-scciclient
python-seamicroclient>=0.4.0
UcsSdk==0.8.1.9

View File

@ -12,7 +12,7 @@
"""
Modules required to work with ironic_inspector:
https://pypi.python.org/pypi/ironic-discoverd
https://pypi.python.org/pypi/ironic-inspector
"""
import eventlet
@ -52,13 +52,10 @@ CONF = cfg.CONF
CONF.register_opts(inspector_opts, group='inspector')
# TODO(dtantsur): change this to ironic_inspector_client once it's available
ironic_inspector = importutils.try_import('ironic_inspector')
if not ironic_inspector:
# NOTE(dtantsur): old name for ironic-inspector
ironic_inspector = importutils.try_import('ironic_discoverd')
if ironic_inspector:
from ironic_inspector import client
client = importutils.try_import('ironic_inspector_client')
INSPECTOR_API_VERSION = (1, 0)
class Inspector(base.InspectInterface):
@ -84,16 +81,9 @@ class Inspector(base.InspectInterface):
raise exception.DriverLoadError(
_('ironic-inspector support is disabled'))
if not ironic_inspector:
if not client:
raise exception.DriverLoadError(
_('ironic-inspector Python module not found'))
# NOTE(dtantsur): __version_info__ attribute appeared in 1.0.0
version = getattr(ironic_inspector, '__version_info__', (0, 2))
if version < (1, 0):
raise exception.DriverLoadError(
_('ironic-inspector version is too old: required >= 1.0.0, '
'got %s') % '.'.join(str(x) for x in version))
_('python-ironic-inspector-client Python module not found'))
def get_properties(self):
"""Return the properties of the interface.
@ -123,9 +113,7 @@ class Inspector(base.InspectInterface):
:returns: states.INSPECTING
"""
LOG.debug('Starting inspection for node %(uuid)s using '
'ironic-inspector client %(version)s',
{'uuid': task.node.uuid, 'version':
ironic_inspector.__version__})
'ironic-inspector', {'uuid': task.node.uuid})
# NOTE(dtantsur): we're spawning a short-living green thread so that
# we can release a lock as soon as possible and allow ironic-inspector
@ -153,7 +141,7 @@ class Inspector(base.InspectInterface):
def _call_inspector(func, uuid, context):
"""Wrapper around calls to inspector."""
# NOTE(dtantsur): due to bug #1428652 None is not accepted for base_url.
kwargs = {}
kwargs = {'api_version': INSPECTOR_API_VERSION}
if CONF.inspector.service_url:
kwargs['base_url'] = CONF.inspector.service_url
return func(uuid, auth_token=context.auth_token, **kwargs)

View File

@ -11,8 +11,7 @@
# under the License.
import eventlet
import ironic_inspector
from ironic_inspector import client
import ironic_inspector_client as client
import mock
from ironic.common import driver_factory
@ -50,22 +49,15 @@ class DisabledTestCase(db_base.DbTestCase):
self._do_mock()
self.assertIsNotNone(self.driver.inspect)
@mock.patch.object(inspector, 'ironic_inspector', None)
@mock.patch.object(inspector, 'client', None)
def test_init_inspector_not_imported(self):
self.assertRaises(exception.DriverLoadError,
inspector.Inspector)
@mock.patch.object(ironic_inspector, '__version_info__', (1, 0, 0))
def test_init_ok(self):
self.config(enabled=True, group='inspector')
inspector.Inspector()
@mock.patch.object(ironic_inspector, '__version_info__', (0, 2, 2))
def test_init_old_version(self):
self.config(enabled=True, group='inspector')
self.assertRaises(exception.DriverLoadError,
inspector.Inspector)
class BaseTestCase(db_base.DbTestCase):
def setUp(self):
@ -190,7 +182,6 @@ class CheckStatusTestCase(BaseTestCase):
@mock.patch.object(eventlet.greenthread, 'spawn_n',
lambda f, *a, **kw: f(*a, **kw))
@mock.patch.object(ironic_inspector, '__version_info__', (1, 0, 0))
@mock.patch.object(task_manager, 'acquire', autospec=True)
@mock.patch.object(inspector, '_check_status', autospec=True)
class PeriodicTaskTestCase(BaseTestCase):

View File

@ -22,10 +22,9 @@ IBOOT_SPEC = (
)
# ironic_inspector
IRONIC_INSPECTOR_SPEC = (
'__version__',
'__version_info__',
'client',
IRONIC_INSPECTOR_CLIENT_SPEC = (
'introspect',
'get_status',
)
# proliantutils

View File

@ -186,14 +186,11 @@ if not pyremotevbox:
sys.modules['ironic.drivers.modules.virtualbox'])
ironic_inspector = importutils.try_import('ironic_inspector')
if not ironic_inspector:
ironic_inspector = mock.MagicMock(
spec_set=mock_specs.IRONIC_INSPECTOR_SPEC)
ironic_inspector.__version_info__ = (1, 0, 0)
ironic_inspector.__version__ = "1.0.0"
sys.modules['ironic_inspector'] = ironic_inspector
sys.modules['ironic_inspector.client'] = ironic_inspector.client
ironic_inspector_client = importutils.try_import('ironic_inspector_client')
if not ironic_inspector_client:
ironic_inspector_client = mock.MagicMock(
spec_set=mock_specs.IRONIC_INSPECTOR_CLIENT_SPEC)
sys.modules['ironic_inspector_client'] = ironic_inspector_client
if 'ironic.drivers.modules.inspector' in sys.modules:
six.moves.reload_module(
sys.modules['ironic.drivers.modules.inspector'])