Comment 14 for bug 1819923

Reviewed: https://review.opendev.org/637955
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=54dea2531c887f77e4b7a8e7edb978d8f1ccfe50
Submitter: Zuul
Branch: master

commit 54dea2531c887f77e4b7a8e7edb978d8f1ccfe50
Author: Balazs Gibizer <email address hidden>
Date: Mon Mar 18 17:24:01 2019 +0100

    nova-manage: heal port allocations

    Before I97f06d0ec34cbd75c182caaa686b8de5c777a576 it was possible to
    create servers with neutron ports which had resource_request (e.g. a
    port with QoS minimum bandwidth policy rule) without allocating the
    requested resources in placement. So there could be servers for which
    the allocation needs to be healed in placement.

    This patch extends the nova-manage heal_allocation CLI to create the
    missing port allocations in placement and update the port in neutron
    with the resource provider uuid that is used for the allocation.

    There are known limiations of this patch. It does not try to reimplement
    Placement's allocation candidate functionality. Therefore it cannot
    handle the situation when there is more than one RP in the compute
    tree which provides the required traits for a port. In this situation
    deciding which RP to use would require the in_tree allocation candidate
    support from placement which is not available yet and 2) information
    about which PCI PF an SRIOV port is allocated from its VF and which RP
    represents that PCI device in placement. This information is only
    available on the compute hosts.

    For the unsupported cases the command will fail gracefully. As soon as
    migration support for such servers are implemented in the blueprint
    support-move-ops-with-qos-ports the admin can heal the allocation of
    such servers by migrating them.

    During healing both placement and neutron need to be updated. If any of
    those updates fail the code tries to roll back the previous updates for
    the instance to make sure that the healing can be re-run later without
    issue. However if the rollback fails then the script will terminate with
    an error message pointing to documentation that describes how to
    recover from such a partially healed situation manually.

    Closes-Bug: #1819923
    Change-Id: I4b2b1688822eb2f0174df0c8c6c16d554781af85