summaryrefslogtreecommitdiffstats
path: root/nova/db
diff options
context:
space:
mode:
authorMichael Gundlach <michael.gundlach@rackspace.com>2010-12-01 15:53:27 -0600
committerMichael Gundlach <michael.gundlach@rackspace.com>2010-12-01 15:53:27 -0600
commitf53f5880c08994d04a552a41ce6f88dfbd867946 (patch)
tree1a6c7bb4a9f187b48909eae576a0f682c739819f /nova/db
parentfdf0aa30a1127eb8311a599dfdad9653ac699154 (diff)
downloadnova-f53f5880c08994d04a552a41ce6f88dfbd867946.tar.gz
nova-f53f5880c08994d04a552a41ce6f88dfbd867946.tar.xz
nova-f53f5880c08994d04a552a41ce6f88dfbd867946.zip
Oops, internal_id isn't available until after a save. This code saves twice; if I moved it into the DB layer we could do it in one save. However, we're moving to one sqlite db per compute worker, so I'd rather have two saves in order to keep the logic in the right layer.
Diffstat (limited to 'nova/db')
-rw-r--r--nova/db/sqlalchemy/api.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py
index afa55fc03..dd9649054 100644
--- a/nova/db/sqlalchemy/api.py
+++ b/nova/db/sqlalchemy/api.py
@@ -530,6 +530,12 @@ def fixed_ip_update(context, address, values):
#functions between the two of them as well.
@require_context
def instance_create(context, values):
+ """Create a new Instance record in the database.
+
+ context - request context object
+ values - dict containing column values.
+ 'internal_id' is auto-generated and should not be specified.
+ """
instance_ref = models.Instance()
instance_ref.update(values)