placement allows RP parent loop in PUT resource_providers/{uuid}

Bug #1779635 reported by Balazs Gibizer
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Balazs Gibizer

Bug Description

Placement allows setting the parent_rp_uuid of an RP to itself. This leads to a trivial loop in the RP tree.

Version, current master:
stack@ubuntu:~/nova$ git log --oneline | head -n1
4ea64ca Merge "manage: Remove dead code"

To reproduce in devstack I used a not yet merged osc-placement patch adding support to api version 1.14.

Steps:

stack@ubuntu:~/osc-placement$ openstack --debug resource provider list --os-placement-api-version 1.14
+--------------------------------------+--------+------------+--------------------------------------+----------------------+
| uuid | name | generation | root_provider_uuid | parent_provider_uuid |
+--------------------------------------+--------+------------+--------------------------------------+----------------------+
| f4d95373-b15f-4dd9-94ed-f7908fe10dd1 | ubuntu | 1 | f4d95373-b15f-4dd9-94ed-f7908fe10dd1 | None |
+--------------------------------------+--------+------------+--------------------------------------+----------------------+

stack@ubuntu:~/osc-placement$ openstack --debug resource provider --os-placement-api-version 1.14 set f4d95373-b15f-4dd9-94ed-f7908fe10dd1 --name ubuntu --parent-provider-uuid f4d95373-b15f-4dd9-94ed-f7908fe10dd1

+----------------------+--------------------------------------+
| Field | Value |
+----------------------+--------------------------------------+
| uuid | f4d95373-b15f-4dd9-94ed-f7908fe10dd1 |
| name | ubuntu |
| generation | 1 |
| root_provider_uuid | f4d95373-b15f-4dd9-94ed-f7908fe10dd1 |
| parent_provider_uuid | f4d95373-b15f-4dd9-94ed-f7908fe10dd1 |
+----------------------+--------------------------------------+

stack@ubuntu:~/osc-placement$ openstack --debug resource provider list --os-placement-api-version 1.14
+--------------------------------------+--------+------------+--------------------------------------+--------------------------------------+
| uuid | name | generation | root_provider_uuid | parent_provider_uuid |
+--------------------------------------+--------+------------+--------------------------------------+--------------------------------------+
| f4d95373-b15f-4dd9-94ed-f7908fe10dd1 | ubuntu | 1 | f4d95373-b15f-4dd9-94ed-f7908fe10dd1 | f4d95373-b15f-4dd9-94ed-f7908fe10dd1 |
+--------------------------------------+--------+------------+--------------------------------------+--------------------------------------+

Full debug output with has been attached.

Tags: placement
Revision history for this message
Balazs Gibizer (balazs-gibizer) wrote :
tags: added: placement
Revision history for this message
Balazs Gibizer (balazs-gibizer) wrote :

If I try to create the loop at RP creation the placement rejects the request properly
stack@ubuntu:~/nova$ openstack resource provider create --os-placement-api-version 1.14 my-rp2 --uuid 711b5af9-3924-4047-b08d-14ca6a4c7539 --parent-provider-uuid 711b5af9-3924-4047-b08d-14ca6a4c7539
Unable to create resource provider "my-rp2", 711b5af9-3924-4047-b08d-14ca6a4c7539: Object action create failed because: parent provider UUID cannot be same as UUID. Please set parent provider UUID to None if there is no parent. (HTTP 400)

summary: - placement allows RP parent loop
+ placement allows RP parent loop in PUT resource_providers/{uuid}
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to nova (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/579508

Changed in nova:
status: New → Confirmed
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/579618

Changed in nova:
assignee: nobody → Balazs Gibizer (balazs-gibizer)
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to nova (master)

Reviewed: https://review.openstack.org/579508
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=16812e8979e6a58534b97d031c7d965c3a91f97f
Submitter: Zuul
Branch: master

commit 16812e8979e6a58534b97d031c7d965c3a91f97f
Author: Balazs Gibizer <email address hidden>
Date: Mon Jul 2 12:13:56 2018 +0200

    Regression test for bug 1779635

    This patch adds a test that shows that placement allows setting the
    parent of an RP to itself.

    Change-Id: Ie81de7bdd43bfdb2ba48996f79d41efc2d70c1cd
    Related-Bug: #1779635

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/579618
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=00b13a2e2fab6e9a9635c4df186269a16d9fbfbd
Submitter: Zuul
Branch: master

commit 00b13a2e2fab6e9a9635c4df186269a16d9fbfbd
Author: Balazs Gibizer <email address hidden>
Date: Mon Jul 2 15:21:17 2018 +0200

    Prevent updating an RP's parent to form a loop

    Placement had RP loop detection for RP creation but if an RP is created
    without a parent (e.g. root RP) then the parent can be set later with a
    PUT /resource_providers/{uuid} request by providing the UUID of the
    parent. In this code path the loop detection was missing from the
    validation. Moreover there are different loop cases for create than for
    set. For create the only possible loop is when the RP being created is
    points to itself as a parent. However when the parent is provided later
    in a PUT the RP being updated can have descendant RPs. Setting a parent
    to a descendant also creates a loop.

    This patch adds the missing check and returns HTTP 400 if loop is detected.

    Closes-Bug: #1779635
    Change-Id: I42c91f5f752f0a4fba8b1d95489fc3f87a1c5b6e

Changed in nova:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova 18.0.0.0b3

This issue was fixed in the openstack/nova 18.0.0.0b3 development milestone.

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.