Properly order node deletion from cache
In databases that actually support foreign keys (like MySQL), we need to delete everything linking to a node before deleting a node. Change-Id: I320d8547697c3c13b7acb2e3fee117347550e264 Closes-Bug: #1511187
This commit is contained in:
parent
11dd9451ef
commit
9c62b95ffa
@ -340,14 +340,12 @@ def _delete_node(uuid, session=None):
|
||||
"""Delete information about a node.
|
||||
|
||||
:param uuid: Ironic node UUID
|
||||
:param session: optional existing database session
|
||||
"""
|
||||
with db.ensure_transaction(session) as session:
|
||||
(db.model_query(db.Node, session=session).filter_by(uuid=uuid).
|
||||
delete())
|
||||
(db.model_query(db.Attribute, session=session).filter_by(uuid=uuid).
|
||||
delete(synchronize_session=False))
|
||||
(db.model_query(db.Option, session=session).filter_by(uuid=uuid).
|
||||
delete())
|
||||
for model in (db.Attribute, db.Option, db.Node):
|
||||
db.model_query(model,
|
||||
session=session).filter_by(uuid=uuid).delete()
|
||||
|
||||
|
||||
def active_macs():
|
||||
|
Loading…
Reference in New Issue
Block a user