Commit Graph

15 Commits

Author SHA1 Message Date
Riccardo Pittau 3accdfbbc6 Use openstacksdk for ironic module
This patches removes the ironic-client dependency from the
ironic module in favor of openstacksdk.

Increase minimum required version of openstacksdk to use
recent added features.

Change-Id: I31964179835ad454e8205a59f483b419de4fb62d
2020-03-23 14:28:09 +01:00
Dmitry Tantsur ada6b106c5 Pass reset_interfaces when updating a driver from the rules
Otherwise updating a driver requires listing all interfaces with their
new values. This patch is designed to be backportable, so it has
a fall-back to the previous behavior if the required API version and/or
ironicclient versions are not available.

Story: #2005148
Task: #29854
Depends-On: https://review.openstack.org/#/c/643264/
Change-Id: I115b92b9d7bcdbb1c03f0d259dbba6efd2baec2a
2019-03-14 11:02:40 +01:00
Iury Gregory Melo Ferreira 22294abac6 Accept None value for set-attribute
Allows the ``set-attribute`` introspection rule action
to use ``None`` as a valid value.

Co-Authored-By: Riccardo Pittau <elfosardo@gmail.com>

Change-Id: I1aa11c8095c4557107223e352424e3b718e2ab35
Story: #2004546
Task: #28299
2018-12-07 15:12:17 +01:00
Dmitry Tantsur 0a26a6677d Add introspection rules actions to add/remove traits on nodes
Otherwise it's not possible to modify them, since they're not updated
via the regular node updating mechanism.

Change-Id: I338015ff9dafe07f4e70a23ddcf6cd488eda9907
Story: #2003788
Task: #26496
2018-09-18 10:13:48 +02:00
ji-xuepeng cd08d79e01 remove unused LOG
This is to remove unused LOG to keep code clean.

Change-Id: If329acd9b7d1b9c0f1b7abc282f96d1543324003
2016-07-10 13:44:21 +08:00
Dmitry Tantsur 50b989474d is-empty conditions should accept missing values
Returning False from is-empty condition on missing values seems extremely
confusing and rules out some potential use cases.

Closes-Bug: #1578184
Change-Id: I8f976516f89367512e2ffae2815085be1776b6f6
2016-05-04 14:26:15 +02:00
Jenkins cc0c7bd77c Merge "Add new condition: is-empty" 2016-02-23 13:31:18 +00:00
Jenkins 03b690d48c Merge "Extend conditions and actions" 2016-02-22 12:44:29 +00:00
Anton Arefiev 061d839a26 Add new condition: is-empty
Now, if operators want to check some attribute isn't specified,
they should use 'eq' condition with None, '', etc values:

    {'op': 'eq', 'field': 'inventory.bmc_addres', 'value': ''}

It would be useful to have condition plugin witch verify this case,
'is-empty' checks that field is empty string, list, dict or None value:

    {'op': 'is-empty', 'field': 'inventory.bmc_addres'}

Change-Id: I6596a067e769530092c3db34405e0f0917d2f052
2016-02-22 14:21:09 +02:00
Anton Arefiev bf86545ca4 Extend conditions and actions
Conditions: ``field`` supports new format, it allow to comparison
data both from inspection and node info:

     {'field': 'node://ironic/style/path', 'op': 'eq', 'value': 'val'}
     {'field': 'data://introspection/path', 'op': 'eq', 'value': 'val'}

Actions: ``value`` supports fetching data from introspection, it's
using python string formatting notation:

     {'action': 'set-attribute', 'path': '/driver_info/ipmi_address',
      'value': '{data[inventory][bmc_address]}'}

Related-Bug: #1524753
Change-Id: Ie05f82e7a29fba2f743217f0893c085fd843cd5b
2016-02-17 19:07:30 +02:00
Dmitry Tantsur 31f7a5ada6 Drop rollback actions for set-XX and extend-XX rules actions
Rollback actions were designed to help with rerunning introspection
on the same node. However, rollback actions for these actions proved
to be confusing and were never properly documented at all.
Even worse, the rollback action for set-attribute actually makes
this command impossible to use with non-removable attributes
(e.g. /driver).

This change removes rollback actions from all rules.
We need to rethink how we handle rollback in rules later on.

Change-Id: I2260f4b463c5dc804edac642c86e0da153e163f6
2016-02-16 11:12:23 +01:00
Dmitry Tantsur d6ff54faf7 Add new conditions: matches and contains
Both check a value against a regular expression. The former requires
full match, while the latter requires matching anywhere in the string
representaion of value.

Change-Id: Ia59d17d6f8383aed97696d678fc1e7e329242692
2016-01-26 17:01:41 +01:00
Dmitry Tantsur 0423d93736 Track node identification during the whole processing
Currently our logging in processing is very inconsistent:
some log strings mention node UUID, some - node BMC IP, some nothing.
This change introduces a common prefix for all processing logs
based on as much information as possible.
Only code that actually have some context about the node (either
NodeInfo or introspection data) is updated.

Also logging BMC addresses can be disabled now.

Updates example.conf (a lot of updated comments from oslo).

Change-Id: Ib20f2acdc60bfaceed7a33467557b92857c32798
2016-01-13 12:23:15 +01:00
Dmitry Tantsur 6c686e81ce Add missing plugins for introspection rules
Conditions:
* in-net: checks if address is in a network

Actions:
* set-capability: sets a capability
* extend-attribute: append value to a list attibute

Helper method NodeInfo.replace_field is added to simplify writing
similar action plugins.

Implements: blueprint rules
Change-Id: I7e47b3500624df1f2cb15445d05e1c9bca6dc9ae
2015-09-18 17:42:42 +02:00
Dmitry Tantsur eb9b3da67a Add introspection rules support
This patch introduces a simple JSON-based DSL to run on introspected
data. Conditions and actions are provided via new plugin entry points.

This patch is missing PUT operation on a rule, this can be added later.

Also not all planned conditions and actions are added in this patch,
will also follow up.

Implements: blueprint rules
Change-Id: If4d17b5f1462d03879cb4c2ff4e5cb3ea364b697
2015-09-14 14:56:09 +02:00