diff options
| author | Trey Morris <trey.morris@rackspace.com> | 2010-12-28 23:55:58 -0600 |
|---|---|---|
| committer | Trey Morris <trey.morris@rackspace.com> | 2010-12-28 23:55:58 -0600 |
| commit | 8aea573bd2e44e152fb4ef1627640bab1818dede (patch) | |
| tree | 87c51a14f8e17f570aa0e473cf3200877df81ea9 /nova/db | |
| parent | 675ca7c5f38af0fa1150936e881482aa20fdaa45 (diff) | |
| download | nova-8aea573bd2e44e152fb4ef1627640bab1818dede.tar.gz nova-8aea573bd2e44e152fb4ef1627640bab1818dede.tar.xz nova-8aea573bd2e44e152fb4ef1627640bab1818dede.zip | |
initial lock functionality commit
Diffstat (limited to 'nova/db')
| -rw-r--r-- | nova/db/sqlalchemy/api.py | 22 | ||||
| -rw-r--r-- | nova/db/sqlalchemy/models.py | 2 |
2 files changed, 24 insertions, 0 deletions
diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py index 7e945e4cb..6d774b39c 100644 --- a/nova/db/sqlalchemy/api.py +++ b/nova/db/sqlalchemy/api.py @@ -856,6 +856,28 @@ def instance_action_create(context, values): return action_ref +@require_admin_context +def instance_set_lock(context, instance_id, lock): + """ + twiddle the locked bit in the db + lock is a boolean + + """ + db.instance_update(context, + instance_id, + {'locked': lock}) + + +#@require_admin_context +#def instance_is_locked(context, instance_id): +# """ +# return the boolean state of (instance with instance_id)'s lock +# +# """ +# instance_ref = instance_get(context, instance_id) +# return instance_ref['locked'] + + ################### diff --git a/nova/db/sqlalchemy/models.py b/nova/db/sqlalchemy/models.py index 693db8d23..830ef30a1 100644 --- a/nova/db/sqlalchemy/models.py +++ b/nova/db/sqlalchemy/models.py @@ -224,6 +224,8 @@ class Instance(BASE, NovaBase): display_name = Column(String(255)) display_description = Column(String(255)) + locked = Column(Boolean) + # TODO(vish): see Ewan's email about state improvements, probably # should be in a driver base class or some such # vmstate_state = running, halted, suspended, paused |
