summaryrefslogtreecommitdiffstats
path: root/nova/virt
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2012-02-22 03:42:30 +0000
committerGerrit Code Review <review@openstack.org>2012-02-22 03:42:30 +0000
commitefc00f89f704110ce4393ea1a70fc934d08f4e09 (patch)
tree050da9d9d525be80f004d70ee7b76647badc6788 /nova/virt
parent6b3e1b09b28a10e69480cd84d3a1109350cacfa4 (diff)
parent8d758d4dbe194b4608af34c3ca6520d620d3cdc3 (diff)
downloadnova-efc00f89f704110ce4393ea1a70fc934d08f4e09.tar.gz
nova-efc00f89f704110ce4393ea1a70fc934d08f4e09.tar.xz
nova-efc00f89f704110ce4393ea1a70fc934d08f4e09.zip
Merge "Scheduler notifications added."
Diffstat (limited to 'nova/virt')
-rw-r--r--nova/virt/fake.py31
1 files changed, 30 insertions, 1 deletions
diff --git a/nova/virt/fake.py b/nova/virt/fake.py
index 53a1ea4c9..ba2d6dae7 100644
--- a/nova/virt/fake.py
+++ b/nova/virt/fake.py
@@ -242,7 +242,36 @@ class FakeConnection(driver.ComputeDriver):
pass
def update_available_resource(self, ctxt, host):
- pass
+ """Updates compute manager resource info on ComputeNode table.
+
+ Since we don't have a real hypervisor, pretend we have lots of
+ disk and ram.
+ """
+
+ try:
+ service_ref = db.service_get_all_compute_by_host(ctxt, host)[0]
+ except exception.NotFound:
+ raise exception.ComputeServiceUnavailable(host=host)
+
+ # Updating host information
+ dic = {'vcpus': 1,
+ 'memory_mb': 4096,
+ 'local_gb': 1028,
+ 'vcpus_used': 0,
+ 'memory_mb_used': 0,
+ 'local_gb_used': 0,
+ 'hypervisor_type': 'fake',
+ 'hypervisor_version': '1.0',
+ 'service_id': service_ref['id'],
+ 'cpu_info': '?'}
+
+ compute_node_ref = service_ref['compute_node']
+ if not compute_node_ref:
+ LOG.info(_('Compute_service record created for %s ') % host)
+ db.compute_node_create(ctxt, dic)
+ else:
+ LOG.info(_('Compute_service record updated for %s ') % host)
+ db.compute_node_update(ctxt, compute_node_ref[0]['id'], dic)
def compare_cpu(self, xml):
"""This method is supported only by libvirt."""