summaryrefslogtreecommitdiffstats
path: root/nova/db
diff options
context:
space:
mode:
authorKei Masumoto <masumotok@nttdata.co.jp>2011-08-15 20:31:43 +0000
committerTarmac <>2011-08-15 20:31:43 +0000
commitea53d0f37a4f478ffbe18516f99ca26192117e80 (patch)
tree3a56196e11ead6af9ead0eb13a345f6c7e63dcf8 /nova/db
parenta18d8597c2fb52d77b8b827f2c440787b1165150 (diff)
parent7393a114f421f1b54019099777fea34a09a80737 (diff)
downloadnova-ea53d0f37a4f478ffbe18516f99ca26192117e80.tar.gz
nova-ea53d0f37a4f478ffbe18516f99ca26192117e80.tar.xz
nova-ea53d0f37a4f478ffbe18516f99ca26192117e80.zip
Adding kvm-block-migration feature.
I wrote some description the below URL. I hope it may help for reviewing. <http://etherpad.openstack.org/kvm-block-migration>
Diffstat (limited to 'nova/db')
-rw-r--r--nova/db/api.py21
-rw-r--r--nova/db/sqlalchemy/api.py39
-rw-r--r--nova/db/sqlalchemy/models.py16
3 files changed, 8 insertions, 68 deletions
diff --git a/nova/db/api.py b/nova/db/api.py
index 0f2218752..b9ea8757c 100644
--- a/nova/db/api.py
+++ b/nova/db/api.py
@@ -570,27 +570,6 @@ def instance_add_security_group(context, instance_id, security_group_id):
security_group_id)
-def instance_get_vcpu_sum_by_host_and_project(context, hostname, proj_id):
- """Get instances.vcpus by host and project."""
- return IMPL.instance_get_vcpu_sum_by_host_and_project(context,
- hostname,
- proj_id)
-
-
-def instance_get_memory_sum_by_host_and_project(context, hostname, proj_id):
- """Get amount of memory by host and project."""
- return IMPL.instance_get_memory_sum_by_host_and_project(context,
- hostname,
- proj_id)
-
-
-def instance_get_disk_sum_by_host_and_project(context, hostname, proj_id):
- """Get total amount of disk by host and project."""
- return IMPL.instance_get_disk_sum_by_host_and_project(context,
- hostname,
- proj_id)
-
-
def instance_action_create(context, values):
"""Create an instance action from the values dictionary."""
return IMPL.instance_action_create(context, values)
diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py
index e5d35a20b..57a4370d8 100644
--- a/nova/db/sqlalchemy/api.py
+++ b/nova/db/sqlalchemy/api.py
@@ -1483,45 +1483,6 @@ def instance_add_security_group(context, instance_id, security_group_id):
@require_context
-def instance_get_vcpu_sum_by_host_and_project(context, hostname, proj_id):
- session = get_session()
- result = session.query(models.Instance).\
- filter_by(host=hostname).\
- filter_by(project_id=proj_id).\
- filter_by(deleted=False).\
- value(func.sum(models.Instance.vcpus))
- if not result:
- return 0
- return result
-
-
-@require_context
-def instance_get_memory_sum_by_host_and_project(context, hostname, proj_id):
- session = get_session()
- result = session.query(models.Instance).\
- filter_by(host=hostname).\
- filter_by(project_id=proj_id).\
- filter_by(deleted=False).\
- value(func.sum(models.Instance.memory_mb))
- if not result:
- return 0
- return result
-
-
-@require_context
-def instance_get_disk_sum_by_host_and_project(context, hostname, proj_id):
- session = get_session()
- result = session.query(models.Instance).\
- filter_by(host=hostname).\
- filter_by(project_id=proj_id).\
- filter_by(deleted=False).\
- value(func.sum(models.Instance.local_gb))
- if not result:
- return 0
- return result
-
-
-@require_context
def instance_action_create(context, values):
"""Create an instance action from the values dictionary."""
action_ref = models.InstanceActions()
diff --git a/nova/db/sqlalchemy/models.py b/nova/db/sqlalchemy/models.py
index 64b1bd5cd..f2a4680b0 100644
--- a/nova/db/sqlalchemy/models.py
+++ b/nova/db/sqlalchemy/models.py
@@ -127,14 +127,14 @@ class ComputeNode(BASE, NovaBase):
'ComputeNode.service_id == Service.id,'
'ComputeNode.deleted == False)')
- vcpus = Column(Integer, nullable=True)
- memory_mb = Column(Integer, nullable=True)
- local_gb = Column(Integer, nullable=True)
- vcpus_used = Column(Integer, nullable=True)
- memory_mb_used = Column(Integer, nullable=True)
- local_gb_used = Column(Integer, nullable=True)
- hypervisor_type = Column(Text, nullable=True)
- hypervisor_version = Column(Integer, nullable=True)
+ vcpus = Column(Integer)
+ memory_mb = Column(Integer)
+ local_gb = Column(Integer)
+ vcpus_used = Column(Integer)
+ memory_mb_used = Column(Integer)
+ local_gb_used = Column(Integer)
+ hypervisor_type = Column(Text)
+ hypervisor_version = Column(Integer)
# Note(masumotok): Expected Strings example:
#