From bd92b96fe3e2281e2007949ad822c0cb8d2c166c Mon Sep 17 00:00:00 2001 From: Anton Arefiev Date: Tue, 1 Mar 2016 14:49:36 +0200 Subject: [PATCH] Sync auto-discovery spec with impl Mentioning details was added in ipmlementation, but missing in spec, also fix some nits. Change-Id: Ic59e3206e2be6dc99e52feecfd129342d866c1b6 --- specs/ironic-node-auto-discovery.rst | 39 +++++++++++++++++++++------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/specs/ironic-node-auto-discovery.rst b/specs/ironic-node-auto-discovery.rst index de1749d..15359ac 100644 --- a/specs/ironic-node-auto-discovery.rst +++ b/specs/ironic-node-auto-discovery.rst @@ -10,15 +10,15 @@ Discover ironic nodes https://bugs.launchpad.net/ironic-inspector/+bug/1524753 -This spec proposes auto-discovery Ironic nodes feature. +This spec proposes auto-discovery of Ironic nodes feature. Problem description =================== A large network might consist of hundreds of servers. Keeping track of these -servers can be a time-consuming process. To simplify the addition of new -servers could be done with auto-discovery. Auto-discovery is a process through -which Ironic identifies a resource automatically so it's possible to manage it. +servers can be a time-consuming process. Auto-discovery could simplify the +addition of new servers into Ironic. It will identifies a resource +automatically so it's possible to manage it. For now, Ironic is unable to automatically detect nodes. Operators have to create nodes manually and provide driver info for them. @@ -26,10 +26,16 @@ Proposed change =============== Nodes that don't exist in the inspector node cache may still be booted and -return inspection information to process, ``node-not-found-hook`` allows to -handle that information. For discovery new implementation called -``enroll_node_not_found_hook`` should be specified. It will create a node -with ``fake`` driver. +return inspection information to process, the ``node-not-found-hook`` hook +is run by the inspector when it receives information from a node it can not +identify. For auto-discovery a new hook that will plugin at this point will +be written, called ``enroll``. + +The hook will enroll the unknown node into Ironic with the ``fake`` driver +(this driver is a configurable option, set ``enroll_node_driver`` in the +configuration file allows to change the Ironic driver). Also the ``enroll`` +hook will set the ``ipmi_address`` property on the new node, if its available +in the introspection data we received. To customize discovery, introspection rules will be used, it allows operators to control the discovery process. A simple rule to match all new nodes and @@ -62,9 +68,9 @@ enroll them in Ironic with the ``agent_ipmitool`` driver will looks like:: ] "conditions": [ - {'op': 'eq', 'field': 'node://driver_info/deploy_ramdisk', + {'op': 'eq', 'field': 'node://driver_info.deploy_ramdisk', 'multiple': 'all', 'value': None}, - {'op': 'eq', 'field': 'node://driver_info/deploy_kernel', + {'op': 'eq', 'field': 'node://driver_info.deploy_kernel', 'multiple': 'all', 'value': None} ] @@ -94,6 +100,19 @@ Rule changes: {data[ipmi_address]} - ``ipmi_address`` attribute from introspection data will be fetched. +All nodes discovered and enrolled via the ``enroll`` hook, will contain an +``auto_discovered`` flag in the introspection data, this flag makes it +possible to distinguish between manually enrolled nodes and auto-discovered +nodes in the introspection rules using the rule condition ``eq``:: + + "description": "Enroll auto-discovered nodes with fake driver", + "actions": [ + {'action': 'set-attribute', 'path': 'driver', 'value': 'fake'} + ] + "conditions": [ + {'op': 'eq', 'field': 'data://auto_discovered', 'value': True} + ] + Creating new actions will allow the node info to be consumed in different ways. Proposed approach is pretty flexible, so more sophisticated conditions and actions could be added here based on operators specifications.