API to assign profiles to nodes

Registered by Dmitry Tantsur

As the result of advanced profile matching we need node capabilities updated with one profile. Previously, advanced matching could end up with several profiles stored in /properties/inspector-profiles.

API POST /v1/match?provide=true|false
Selects all nodes from ironic database and tries to assign profiles.

Request body:

 {
   "profiles": [
        {"profile": <PROFILE>,
         "count": 1,
         "required": true},
        {"profile: <PROFILE2>,
         "count": "*"}
    ]
 }

count being a number means matching exact number of nodes, count being "*" means all matching nodes that were not assigned a profile earlier (thus order matters). required=true (default is false) will make the process fail without doing anything, if no nodes matched this profile.

One profile can repeat several times, e.g.:

 {
   "profiles": [
        {"profile": compute,
         "count": 1,
         "required": true},
        {"profile: control,
         "count": 1,
         "required" true},
        {"profile": compute,
         "count": "*"},
    ]
 }

This will require one compute node, one control node, and will assign "compute" profile to all remaining nodes matching this profile.

If provide is true (default is false), matched nodes will be transitioned to "available" provision state.

Blueprint information

Status:
Complete
Approver:
Dmitry Tantsur
Priority:
Medium
Drafter:
Dmitry Tantsur
Direction:
Approved
Assignee:
None
Definition:
Obsolete
Series goal:
Accepted for liberty
Implementation:
Not started
Milestone target:
None
Completed by
Dmitry Tantsur

Related branches

Sprints

Whiteboard

dtantsur: this goes too close to scheduling. And as code itself is very simple, we can just do it in library.

(?)

Work Items

Dependency tree

* Blueprints in grey have been implemented.

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.