summaryrefslogtreecommitdiff
path: root/ironic/db
diff options
context:
space:
mode:
authorDmitry Tantsur <divius.inside@gmail.com>2019-01-03 18:08:12 +0100
committerDmitry Tantsur <divius.inside@gmail.com>2019-01-31 13:01:09 +0100
commit96b9d9de071793a0993030cfeadea4280f3fdd75 (patch)
treef50597623dcb754b2ec6c5ea7809dcd69df6c8e4 /ironic/db
parent7794e29ed6027d5fcf7b8e8ffa46677bccddcb9b (diff)
downloadironic-96b9d9de071793a0993030cfeadea4280f3fdd75.tar.gz
Allocation API: conductor API (without HA and take over)
This change introduces the two RPC calls required for the allocation API: create_allocation and destroy_allocation. The nodes RPC is updated to: * Prevent instance_uuid deletion if a node has an allocation and is not in an updatable state. * Delete allocation when instance_uuid is deleted and the node is in an updatable state. * Delete allocation when a node is unprovisioned and instance_uuid is thus cleared. Change-Id: I45815727f970c3d7fe51bb78d8e162a374d12e04 Story: #2004341 Task: #27987
Diffstat (limited to 'ironic/db')
-rw-r--r--ironic/db/sqlalchemy/api.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/ironic/db/sqlalchemy/api.py b/ironic/db/sqlalchemy/api.py
index 3d7f8cb70..ff2b97668 100644
--- a/ironic/db/sqlalchemy/api.py
+++ b/ironic/db/sqlalchemy/api.py
@@ -1602,6 +1602,8 @@ class Connection(api.Connection):
"""
if not values.get('uuid'):
values['uuid'] = uuidutils.generate_uuid()
+ if not values.get('state'):
+ values['state'] = states.ALLOCATING
allocation = models.Allocation()
allocation.update(values)