From 2fa3f0b1df62217e8efa20d2b963e61b9659e3d5 Mon Sep 17 00:00:00 2001 From: Johannes Erdfelt Date: Tue, 14 Feb 2012 23:12:16 +0000 Subject: LOG.exception only works while in an exception handler It's also unnecessary to set exc_info to sys.exc_info since it does this for you Change-Id: Idd8844d18d4945c029f25dd70de7c842bd9a8305 --- nova/api/openstack/compute/servers.py | 4 ++-- nova/virt/vmwareapi/io_util.py | 4 ++-- nova/virt/vmwareapi/vmops.py | 2 +- nova/virt/xenapi/vm_utils.py | 3 +-- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/nova/api/openstack/compute/servers.py b/nova/api/openstack/compute/servers.py index a9d3a93a2..649566ec9 100644 --- a/nova/api/openstack/compute/servers.py +++ b/nova/api/openstack/compute/servers.py @@ -895,11 +895,11 @@ class Controller(wsgi.Controller): reboot_type = body['reboot']['type'].upper() if not valid_reboot_types.count(reboot_type): msg = _("Argument 'type' for reboot is not HARD or SOFT") - LOG.exception(msg) + LOG.error(msg) raise exc.HTTPBadRequest(explanation=msg) else: msg = _("Missing argument 'type' for reboot") - LOG.exception(msg) + LOG.error(msg) raise exc.HTTPBadRequest(explanation=msg) context = req.environ['nova.context'] diff --git a/nova/virt/vmwareapi/io_util.py b/nova/virt/vmwareapi/io_util.py index 30947fba8..6c7f7efd3 100644 --- a/nova/virt/vmwareapi/io_util.py +++ b/nova/virt/vmwareapi/io_util.py @@ -98,7 +98,7 @@ class GlanceWriteThread(object): self.stop() exc_msg = (_("Glance image %s is in killed state") % self.image_id) - LOG.exception(exc_msg) + LOG.error(exc_msg) self.done.send_exception(exception.Error(exc_msg)) elif image_status in ["saving", "queued"]: greenthread.sleep(GLANCE_POLL_INTERVAL) @@ -109,7 +109,7 @@ class GlanceWriteThread(object): "- %(state)s") % { "image_id": self.image_id, "state": image_status} - LOG.exception(exc_msg) + LOG.error(exc_msg) self.done.send_exception(exception.Error(exc_msg)) except Exception, exc: self.stop() diff --git a/nova/virt/vmwareapi/vmops.py b/nova/virt/vmwareapi/vmops.py index 2810b3b71..d613d7e02 100644 --- a/nova/virt/vmwareapi/vmops.py +++ b/nova/virt/vmwareapi/vmops.py @@ -123,7 +123,7 @@ class VMWareVMOps(object): if data_store_name is None: msg = _("Couldn't get a local Datastore reference") - LOG.exception(msg) + LOG.error(msg) raise exception.Error(msg) data_store_name = _get_datastore_ref() diff --git a/nova/virt/xenapi/vm_utils.py b/nova/virt/xenapi/vm_utils.py index 1c3470095..991c685d9 100644 --- a/nova/virt/xenapi/vm_utils.py +++ b/nova/virt/xenapi/vm_utils.py @@ -25,7 +25,6 @@ import json import os import pickle import re -import sys import tempfile import time import urllib @@ -856,7 +855,7 @@ class VMHelper(HelperBase): except (cls.XenAPI.Failure, IOError, OSError) as e: # We look for XenAPI and OS failures. LOG.exception(_("instance %s: Failed to fetch glance image"), - instance_id, exc_info=sys.exc_info()) + instance_id) e.args = e.args + ([dict(vdi_type=ImageType. to_string(image_type), vdi_uuid=vdi_uuid, -- cgit