summaryrefslogtreecommitdiff
path: root/nova/virt/xenapi_conn.py
diff options
context:
space:
mode:
authorBrian Lamar <brian.lamar@rackspace.com>2012-02-28 16:09:28 -0500
committerBrian Lamar <brian.lamar@rackspace.com>2012-02-28 17:10:12 -0500
commit315a45a35bd577129a49c4c3b08a1319f7d2e9a6 (patch)
treedd8c3943c2420af07c5983e632d2be65a3beea72 /nova/virt/xenapi_conn.py
parente5ad06a8be11041f271cb9f727deb109e0413410 (diff)
downloadnova-315a45a35bd577129a49c4c3b08a1319f7d2e9a6.tar.gz
Fix issue starting nova-compute w/ XenServer
In a fresh-install environment, nova-compute will fail to start due to missing record in compute_nodes table. I have moved the db update to be included in the update_available_resources function. Fixes bug 942893 Change-Id: I4b4f6a493ef0bbe81224c7408d0985e14fa9f1bc
Diffstat (limited to 'nova/virt/xenapi_conn.py')
-rw-r--r--nova/virt/xenapi_conn.py19
1 files changed, 1 insertions, 18 deletions
diff --git a/nova/virt/xenapi_conn.py b/nova/virt/xenapi_conn.py
index 6fae558b5d..5467ee2bcc 100644
--- a/nova/virt/xenapi_conn.py
+++ b/nova/virt/xenapi_conn.py
@@ -181,8 +181,6 @@ class XenAPIConnection(driver.ComputeDriver):
self._initiator = None
self._pool = pool.ResourcePool(self._session)
- self._capture_dom0_hostname()
-
@property
def host_state(self):
if not self._host_state:
@@ -196,22 +194,6 @@ class XenAPIConnection(driver.ComputeDriver):
#e.g. to do session logout?
pass
- def _capture_dom0_hostname(self):
- """Find dom0's hostname and log it to the DB."""
- ctxt = context.get_admin_context()
- service = db.service_get_by_host_and_topic(ctxt, FLAGS.host, "compute")
-
- try:
- compute_node = db.compute_node_get_for_service(ctxt, service["id"])
- except TypeError:
- return
-
- host_stats = self.get_host_stats()
-
- db.compute_node_update(ctxt, compute_node["id"],
- {"hypervisor_hostname": host_stats["host_hostname"]},
- auto_adjust=False)
-
def list_instances(self):
"""List VM instances"""
return self._vmops.list_instances()
@@ -429,6 +411,7 @@ class XenAPIConnection(driver.ComputeDriver):
'local_gb_used': used_disk_gb,
'hypervisor_type': 'xen',
'hypervisor_version': 0,
+ 'hypervisor_hostname': host_stats['host_hostname'],
'service_id': service_ref['id'],
'cpu_info': host_stats['host_cpu_info']['cpu_count']}