More informative nova-scheduler log after NoValidHost is caught.

This patch adds a warning log entry for when a NoValidHost
exception causes a scheduling error. The NoValidHost
exception's message will be logged before reporting that
the machine went to error. Previously, all other exceptions
would show a stack trace. However, since the NoValidHost case
is skipped, a user may not understand why his/her machine
went to an ERROR state. This patch seeks to remove any
confusion.

Change-Id: I0f01b1095251f5c659fe010c7376f3f6bc56babe
Closes-Bug: 1336977
This commit is contained in:
Michael Turek 2014-08-04 19:04:04 +00:00
parent 6b844e3f45
commit 2aed787057
1 changed files with 6 additions and 2 deletions

View File

@ -27,7 +27,7 @@ from nova.compute import utils as compute_utils
from nova.compute import vm_states
from nova import db
from nova import exception
from nova.i18n import _
from nova.i18n import _, _LW
from nova import notifications
from nova.openstack.common import importutils
from nova.openstack.common import log as logging
@ -52,7 +52,11 @@ def handle_schedule_error(context, ex, instance_uuid, request_spec):
send notifications.
"""
if not isinstance(ex, exception.NoValidHost):
if isinstance(ex, exception.NoValidHost):
LOG.warning(_LW("NoValidHost exception with message: \'%s\'"),
ex.format_message().strip(),
instance_uuid=instance_uuid)
else:
LOG.exception(_("Exception during scheduler.run_instance"))
state = vm_states.ERROR.upper()
LOG.warning(_('Setting instance to %s state.'), state,