node.instance_uuid can not be replaced by JSON PATCH "add" operator

Bug #1310843 reported by aeva black
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ironic
Triaged
Low
Unassigned

Bug Description

The RFC for a JSON PATCH operation specifies that the "add" operator should also replace existing values. This works for most of Ironic's API. However, it is prevented from working on the node.instance_uuid property by this section in db.sqlalchemy.api

https://github.com/openstack/ironic/blob/master/ironic/db/sqlalchemy/api.py#L373

    def update_node(self, node_id, values):
...
            # Prevent instance_uuid overwriting
            if values.get("instance_uuid") and ref.instance_uuid:
                raise exception.NodeAssociated(node=node_id,
                                instance=ref.instance_uuid)

The reason for this is clear: prevent a race whereby two nova-compute agents might try to associate the same node to different Nova instances, by serializing this process at Ironic's database (on a per-node level, not globally).

However, this is not obvious from the API itself, or from our API documentation.

We should document that the node.instance_uuid property does not adhere to the JSON PATCH RFC spec.

aeva black (tenbrae)
Changed in ironic:
importance: Undecided → Low
status: New → Triaged
Anusha (anusha-iiitm)
Changed in ironic:
assignee: nobody → Anusha (anusha-iiitm)
Anusha (anusha-iiitm)
Changed in ironic:
assignee: Anusha (anusha-iiitm) → nobody
Polly Zhou (polly-zhou)
Changed in ironic:
assignee: nobody → Polly Zhou (polly-zhou)
Polly Zhou (polly-zhou)
Changed in ironic:
assignee: Polly Zhou (polly-zhou) → nobody
Dmitry Tantsur (divius)
tags: added: documentation low-hanging-fruit
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.