From 315a45a35bd577129a49c4c3b08a1319f7d2e9a6 Mon Sep 17 00:00:00 2001 From: Brian Lamar Date: Tue, 28 Feb 2012 16:09:28 -0500 Subject: 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 --- nova/virt/xenapi_conn.py | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/nova/virt/xenapi_conn.py b/nova/virt/xenapi_conn.py index 6fae558b5..5467ee2bc 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']} -- cgit