From 8437d947a6e94baf7aa53746ffd34aa5c0f521d9 Mon Sep 17 00:00:00 2001 From: Josh Kearney Date: Fri, 18 Mar 2011 15:34:50 -0500 Subject: Better errors when virt driver isn't loaded --- nova/compute/manager.py | 12 ++++++++++-- plugins/xenserver/xenapi/etc/xapi.d/plugins/glance | 3 +-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 92deca813..5b8e4dafb 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -39,6 +39,7 @@ import os import random import string import socket +import sys import tempfile import time import functools @@ -114,7 +115,13 @@ class ComputeManager(manager.Manager): # and redocument the module docstring if not compute_driver: compute_driver = FLAGS.compute_driver - self.driver = utils.import_object(compute_driver) + + try: + self.driver = utils.import_object(compute_driver) + except ImportError: + LOG.error("Unable to load the virtualization driver.") + sys.exit(1) + self.network_manager = utils.import_object(FLAGS.network_manager) self.volume_manager = utils.import_object(FLAGS.volume_manager) super(ComputeManager, self).__init__(*args, **kwargs) @@ -221,7 +228,8 @@ class ComputeManager(manager.Manager): instance_id, {'launched_at': now}) except Exception: # pylint: disable-msg=W0702 - LOG.exception(_("instance %s: Failed to spawn"), instance_id, + LOG.exception(_("Instance '%s' failed to spawn. Is virtualization" + "enabled in the BIOS?"), instance_id, context=context) self.db.instance_set_state(context, instance_id, diff --git a/plugins/xenserver/xenapi/etc/xapi.d/plugins/glance b/plugins/xenserver/xenapi/etc/xapi.d/plugins/glance index c996f6ef4..0a45f3873 100644 --- a/plugins/xenserver/xenapi/etc/xapi.d/plugins/glance +++ b/plugins/xenserver/xenapi/etc/xapi.d/plugins/glance @@ -216,8 +216,7 @@ def _upload_tarball(staging_path, image_id, glance_host, glance_port, os_type): 'x-image-meta-status': 'queued', 'x-image-meta-disk-format': 'vhd', 'x-image-meta-container-format': 'ovf', - 'x-image-meta-property-os-type': os_type - } + 'x-image-meta-property-os-type': os_type} for header, value in headers.iteritems(): conn.putheader(header, value) -- cgit From b3bb847e3dc20611c4a975d3c772256700b2d018 Mon Sep 17 00:00:00 2001 From: Josh Kearney Date: Mon, 21 Mar 2011 10:41:03 -0500 Subject: Added space --- nova/compute/manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nova/compute/manager.py b/nova/compute/manager.py index ff33597ce..576937cd8 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -229,7 +229,7 @@ class ComputeManager(manager.Manager): {'launched_at': now}) except Exception: # pylint: disable=W0702 LOG.exception(_("Instance '%s' failed to spawn. Is virtualization" - "enabled in the BIOS?"), instance_id, + " enabled in the BIOS?"), instance_id, context=context) self.db.instance_set_state(context, instance_id, -- cgit