Skip to content

Commit

Permalink
Fix issue starting nova-compute w/ XenServer
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Brian Lamar committed Feb 28, 2012
1 parent e5ad06a commit 315a45a
Showing 1 changed file with 1 addition and 18 deletions.
19 changes: 1 addition & 18 deletions nova/virt/xenapi_conn.py
Expand Up @@ -181,8 +181,6 @@ def __init__(self, url, user, pw):
self._initiator = None
self._pool = pool.ResourcePool(self._session)

self._capture_dom0_hostname()

@property
def host_state(self):
if not self._host_state:
Expand All @@ -196,22 +194,6 @@ def init_host(self, host):
#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()
Expand Down Expand Up @@ -429,6 +411,7 @@ def update_available_resource(self, ctxt, host):
'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']}

Expand Down

0 comments on commit 315a45a

Please sign in to comment.