summaryrefslogtreecommitdiff
path: root/ironic/tests/unit/drivers/modules/test_inspector.py
Commit message (Collapse)AuthorAgeFilesLines
* Correct power state handling for managed in-band inspectionDmitry Tantsur2019-12-131-7/+9
| | | | | | | | | | | Do not try to configure networks when powered on, unless it's a node with a SmartNIC, in which case do power on before configuring networks. A new helper is created based on existing code in agent.py. Change-Id: I3a8fab7a39b604ed17a690fa9c31b3cd1dbdc6a7 Story: #1528920 Task: #37753
* Prevent localhost from being used as ironic-inspector callback URLDmitry Tantsur2019-11-271-0/+6
| | | | | | | | At least bifrost used to do it, so it's better to prevent users from shooting their legs. Change-Id: Idf25d9f434483f023ad7a40b6c242635ab89a804 Story: #1528920
* Foundation for boot/network management for in-band inspectionDmitry Tantsur2019-11-211-8/+262
| | | | | | | | | This change the required base driver interface additions and inspector interface changes to support in-band inspection driven by ironic. Change-Id: Ibf9a80d0f72d5f128bf46ddca4cb9762c9a8191b Story: #1528920 Task: #10404
* Use openstacksdk for accessing ironic-inspectorDmitry Tantsur2019-07-311-51/+30
| | | | Change-Id: Ibe4f6bf0b38364b5dd214e6c7e58d45a4d71ffdf
* Remove the ipmitool classic driversDmitry Tantsur2018-06-271-41/+0
| | | | | | | | | | | | | | | | | | This change removes pxe_ipmitool and agent_ipmitool. Some tests and documentation bits are removed, since we no longer have any classic drivers to provide examples. The Inspector.create_if_enabled method is no longer used and was removed. The [inspector]enabled option will be deprecated in a follow-up. IRONIC_ENABLED_DRIVERS is removed from devstack to prevent devstack-gate from injecting the removed drivers into it. A temporary migration from queens is updated to disable all classic drivers. It will be removed when the enabled_drivers option is completely removed. Change-Id: Iab247e3b3336f90446ef0687edb340cf8282a925
* Remove the fake_agent, fake_pxe and fake_inspector driversDmitry Tantsur2018-06-081-10/+10
| | | | Change-Id: I2ea9d7c0f41988d063cd6e1c7a31a0dfb62c620e
* Implements baremetal inspect abortKaifeng Wang2018-05-301-1/+15
| | | | | | | | | | | | | | | | | | | | | | | This patch implements the feature of baremetal inspect abort. For a node in inspect wait state, an abort request initiates the process of introspection abort. Adds transision from ``inspect wait`` to ``inspect failed`` with event ``abort`` to the state machine. Adds an ``abort`` interface to ``InspectInterface``, which raises UnsupportedDriverExtension by default. Implements the ``abort`` interface for ironic inspector inspect interface. API microversion is bumped for backwards compatibility. Closes-Bug: #10602 Story: #1703089 Task: #10602 Change-Id: I02a39ed08c7c64b36c6ef05678f0af6d8324c5e2
* Remove excessive usage of mock_the_extension_manager in unit tests - part 1Dmitry Tantsur2018-05-151-3/+2
| | | | | | | | | | | This function does not work properly with hardware types, and is not needed in the most cases where it is used. The enabled_drivers option is changed instead where needed. This change covers only a (randomly selected) part of files. Other files will be updated separately. Change-Id: Iae40ed6c5d37bb2d2af3219d2f94922a2b32d78d
* Implementation of inspect wait stateKaifeng Wang2018-04-101-2/+8
| | | | | | | | | | | | | | | | | | | This patch provides implementations to feature of adding inspect wait state. Changes covered in this patch: * Added state and transitions, state diagram regenerated. * inspector and oneview inspect interface now return INSPECTWAIT instead of INSPECTING. Move node to inspect wait if inspect interface returns INSPECTING or INSPECTWAIT. * Add a timeout option to conductor, and a periodic task to check timeout in the inspect wait state. Story: #1725211 Task: #10630 Partial-Bug: #1725211 Change-Id: Ie76bfdad5966014a4dae826919ff5705462c743b
* Use adapters for inspectorclientPavlo Shchelokovskyy2017-11-211-84/+76
| | | | | | | | | | | | | | | | | | | | | | | Inspector-client is a bit lacking behind other clients, as it does not have Adapter-based SessionClient and thus does not support all adapter-related options. That's why we construct a session and an adapter from config section, use adapter to resolve inspector API from service catalog (or return the fixed endpoint_override one) and then pass the session and inspector API endpoint to client. This patch also deprecates `[inspector]service_url` in favor of `[inspector]endpoint_override`. As a side-effect, addressig inspector service now supports both regions and interfaces to specify entry in service catalog. Also, inspectorclient calls are now being made with the user token (wrapped with a service token) when there is a token in the task's request context. Change-Id: I21836e712fa9764468ac2654525554b5b4f03741 Partial-Bug: #1699547
* Remove SSH-based driver interfaces and driversPavlo Shchelokovskyy2017-08-011-2/+2
| | | | | | | | | | | | | | | | | SSH drivers are being unsupported for about a year now. All current stable branches of ironic are officially supporting IPMI-capable HW simulation via virtualbmc. All ironic-related gate jobs have already been switched to not use or enable those drivers. This patch finally removes SSH-based power and managemtnt driver interfaces and all classic drivers using those from ironic code and documentation. Related exceptions and `ssh_connect` function, together with dependency on `paramiko` package are removed as well. Change-Id: Ieda7249b9cd78e3be1eff37804996295fc8d3969 Closes-Bug: #1570301 Depends-On: I9b60c9fa24652e9e64e787cd4e5b0152f51e7a28
* Refactor common keystone methodsPavlo Shchelokovskyy2017-06-291-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | - Split loading session and auth from config to separate functions, allow to override options loaded from config. This will lay ground to more efficiently load clients that allow passing in both session and auth plugin objects separately. - When resoving a service endpoint, either fetch the requested interface, or first try 'internal' and then 'public'. This is done due to our config lacking any options to set the default interface for service endpoints to use, and we've used 'internal' by default, although DevStack has no such endpoints for most services any more [0]. This will be changed again when gradually introducing usage of keystoneauth Adapters to ironic. - Remove get_admin_token method, it was used only in glance-related code once, and was simply moved there. [0] https://review.openstack.org/#/c/433272 Change-Id: I73b21098f15af4d0445f89fdd6ad4e4a42177df6 Partial-Bug: #1699547
* Remove legacy auth loadingPavlo Shchelokovskyy2017-06-061-0/+2
| | | | | | | | | remove support for specifying client auth in keystone_authtoken config section. This was deprecated about a year ago and now can safely be removed. Also, fill the [cinder] section with auth options in devstack. Change-Id: I0c45d12d80eff45e643af29cded178644071c9fe
* Do not fail in Inspector.__init__ if [inspector]enabled is FalseDmitry Tantsur2017-01-171-5/+2
| | | | | | | | | We already have a check in Inspector.create_if_enabled. This additional check prevents normal use of Inspector with hardware types, as it's not enough to add "inspector" to "enabled_inspect_interfaces" to use it. Change-Id: Iff29785002cd978702317d50ce52bdcebe06d0e3 Partial-Bug: #1524745
* Remove unnecessary setUpzhufl2016-09-201-3/+0
| | | | | | | | setUp will be automatically called around each testcase, so this is to remove setUp that doing nothing additional than super to keep code clean. Change-Id: I8ce1dd0cc0cbba760caa6df6516b300622bb67fe
* Switch Inspector interface to pass keystoneauth sessionsDmitry Tantsur2016-08-221-90/+68
| | | | | | This enables fetching the service URL from keystone catalog. Change-Id: If862481533cf121bc6e829f0f39893134578ec30
* Migrate to using keystoneauth SessionsPavlo Shchelokovskyy2016-08-031-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We currently construct Keystone client objects directly, which is no longer the preferred way. Instead, we should be using Sessions which allows use of different auth plugins. This change attempts to migrate our Keystone usage to this model. Additionally, we currently rely on the imported keystonemiddleware auth_token's configuration for all of the Keystone credentials used by the Ironic service user. This is bad, as that config is internal to that library and may change at any time. Also, the service user may be using different credentials than the token validator. This refactors the keystone module to use Sessions. It attempts to provide some backward compat for users who have not yet updated their config, by falling back to the authtoken config section when required. Operators impact: - Authentification parameters for each service now should specified in the corresponding config section for this service ([glance], [neutron] [swift], [inspector]). This includes providing both Keystone session-related options (timeout, SSL-related ones) and authentification options (`auth_type`, `auth_url` and proper options for the auth plugin). - New config section `service_catalog` for Ironic service user credentials, used to resolve Ironic API URL from Keystone catalog. - If loading from the service config section fails, an attempt is made to use respective options from [keystone_authtoken] section as a fall-back for backward compatibility. Implementation details: - using keystoneauth1 library instead of keystoneclient - For each service the keystone session is created only once and is reused further. This lowers the number of authentification requests made to Keystone but implies that only auth plugins that can re-authentificate themselves can be used (so no *Token plugins). This patch does not update the DevStack plugin, in order to test backwards compatibility with old config options. DevStack plugin will be modified in a subsequent patch. Change-Id: I166eebefc1e1335a1a7b632149cf6441512e9d5e Closes-Bug: #1422632 Related-Bug: #1418341 Related-Bug: #1494776 Co-Authored-By: Adam Gandelman <adamg@ubuntu.com>
* Remove iterated form of side effectsYuiko Takada Mori2016-07-071-2/+2
| | | | | | | | | Currently, mock side_effect is iterated form because of bug #1473381, but this bug has been fixed already. This patch set reverts it to previous form. Change-Id: Iff81effb75179be20c3f87b718a1509af51435bf Closes-Bug: #1473383
* Adopt Ironic's own contextLin Tan2016-04-011-1/+1
| | | | | | | | | | | | | Adopt Ironic's own context in Ironic and add tests. Refactor ensure_thread_contain_context to Ironic's own context class, this will be more generical and not bind to TaskManager anymore. Explicitly call ensure_thread_contain_context() in Inspector driver for inspect hardware action. Change-Id: Ic2bb16a2deb02054b4fca795d431c965e30a246f Closes-Bug: #1560264
* Rename utils.py to mgr_utils.py to avoid namespace collisionJohn L. Villalovos2015-10-231-1/+1
| | | | | | | | | | | | | | | | The file ironic/tests/unit/conductor/utils.py is used during testing but there is also an ironic/conductor/utils.py and then it is confusing which test_* file belongs to which file. Rename utils.py to mgr_utils.py and rename the test file Intentionally not renaming test_conductor_utils.py to test_utils.py at this time as we would lose git history for the files. This is best done in a follow-up patch. Updated all import statements for unit tests using this file. Change-Id: I5dfa1ffc01c5f54dc41a7caed83cd0bca3fb0be6
* Move unit tests to correct directoryJohn L. Villalovos2015-09-301-0/+239
Move unit tests that test ironic/drivers/modules/* from ironic/tests/drivers/* to ironic/tests/drivers/modules/* Update any unit test imports that were broken by move. Change-Id: Ic5c2e4143ad76e9d910a4361483dc09145dc1dff