Comment 13 for bug 1899541

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

Reviewed: https://review.opendev.org/c/openstack/nova/+/760984
Committed: https://opendev.org/openstack/nova/commit/da91b19d8be3b9cad8f713a3218a08e2d50238c8
Submitter: "Zuul (22348)"
Branch: stable/stein

commit da91b19d8be3b9cad8f713a3218a08e2d50238c8
Author: melanie witt <email address hidden>
Date: Mon Oct 12 22:27:52 2020 +0000

    Prevent archiving of pci_devices records because of 'instance_uuid'

    Currently in the archive_deleted_rows code, we will attempt to clean up
    "residue" of deleted instance records by assuming any table with a
    'instance_uuid' column represents data tied to an instance's lifecycle
    and delete such records.

    This behavior poses a problem in the case where an instance has a PCI
    device allocated and someone deletes the instance. The 'instance_uuid'
    column in the pci_devices table is used to track the allocation
    association of a PCI with an instance. There is a small time window
    during which the instance record has been deleted but the PCI device
    has not yet been freed from a database record perspective as PCI
    devices are freed during the _complete_deletion method in the compute
    manager as part of the resource tracker update call.

    Records in the pci_devices table are anyway not related to the
    lifecycle of instances so they should not be considered residue to
    clean up if an instance is deleted. This adds a condition to avoid
    archiving pci_devices on the basis of an instance association.

    Closes-Bug: #1899541

    Conflicts:
        nova/db/sqlalchemy/api.py
        nova/tests/functional/db/test_archive.py

    NOTE(melwitt): The conflicts are because change
    I9725f752f8aef8066f7c9705e87610cad887bf8e (refactor nova-manage
    archive_deleted_rows) and change
    Id16c3d91d9ce5db9ffd125b59fffbfedf4a6843d (nova-manage db
    archive_deleted_rows is not multi-cell aware) are not in Stein.

    Change-Id: Ie62d3566230aa3e2786d129adbb2e3570b06e4c6
    (cherry picked from commit 1c256cf774693e2395ae8fe4a7a2f416a7aeb03a)
    (cherry picked from commit 09784db62fcd01124a101c4c69cab6e71e1ac781)
    (cherry picked from commit 79df36fecf8c8be5ae9d59397882ac844852043e)
    (cherry picked from commit e3bb6119cf2d0a503768979312aea4d10cf85cda)