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.
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)
Reviewed: https:/ /review. opendev. org/c/openstack /nova/+ /760984 /opendev. org/openstack/ nova/commit/ da91b19d8be3b9c ad8f713a3218a08 e2d50238c8
Committed: https:/
Submitter: "Zuul (22348)"
Branch: stable/stein
commit da91b19d8be3b9c ad8f713a3218a08 e2d50238c8
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 aef8066f7c9705e 87610cad887bf8e (refactor nova-manage deleted_ rows) and change ce5db9ffd125b59 fffbfedf4a6843d (nova-manage db deleted_ rows is not multi-cell aware) are not in Stein.
I9725f752f8
archive_
Id16c3d91d9
archive_
Change-Id: Ie62d3566230aa3 e2786d129adbb2e 3570b06e4c6 395ae8fe4a7a2f4 16a7aeb03a) 24a101c4c69cab6 e71e1ac781) 5ae9d59397882ac 844852043e) 03768979312aea4 d10cf85cda)
(cherry picked from commit 1c256cf774693e2
(cherry picked from commit 09784db62fcd011
(cherry picked from commit 79df36fecf8c8be
(cherry picked from commit e3bb6119cf2d0a5