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 protected]> 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 -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to OpenStack Compute (nova). https://bugs.launchpad.net/bugs/1779635 Title: placement allows RP parent loop in PUT resource_providers/{uuid} Status in OpenStack Compute (nova): Fix Released 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. To manage notifications about this bug go to: https://bugs.launchpad.net/nova/+bug/1779635/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : [email protected] Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp

