Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
dims committed Aug 24, 2015
2 parents 03d2349 + d9fccbd commit ffe0353
Show file tree
Hide file tree
Showing 26 changed files with 19 additions and 10 deletions.
2 changes: 1 addition & 1 deletion ironic/api/controllers/v1/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ def _set_chassis_uuid(self, value):
except exception.ChassisNotFound as e:
# Change error code because 404 (NotFound) is inappropriate
# response for a POST request to create a Port
e.code = http_client.BAD_REQUEST # BadRequest
e.code = http_client.BAD_REQUEST
raise e
elif value == wtypes.Unset:
self._chassis_uuid = wtypes.Unset
Expand Down
2 changes: 2 additions & 0 deletions ironic/api/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ def after(self, state):
return

# Do nothing if there is no error.
# Status codes in the range 200 (OK) to 399 (400 = BAD_REQUEST) are not
# an error.
if (http_client.OK <= state.response.status_int <
http_client.BAD_REQUEST):
return
Expand Down
2 changes: 1 addition & 1 deletion ironic/common/exception.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ class NodeNotLocked(Invalid):
class NoFreeConductorWorker(TemporaryFailure):
message = _('Requested action cannot be performed due to lack of free '
'conductor workers.')
code = http_client.SERVICE_UNAVAILABLE # Service Unavailable (temporary).
code = http_client.SERVICE_UNAVAILABLE


class VendorPassthruException(IronicException):
Expand Down
8 changes: 4 additions & 4 deletions ironic/conductor/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -2049,7 +2049,7 @@ def handle_failure(e, task, logmsg, errmsg):
# NOTE(deva): there is no need to clear conductor_affinity
task.process_event('fail')
args = {'node': task.node.uuid, 'err': e}
LOG.warning(logmsg, args)
LOG.error(logmsg, args)
node.last_error = errmsg % e

try:
Expand All @@ -2060,7 +2060,7 @@ def handle_failure(e, task, logmsg, errmsg):
with excutils.save_and_reraise_exception():
handle_failure(
e, task,
_LW('Error while uploading the configdrive for '
_LE('Error while uploading the configdrive for '
'%(node)s to Swift'),
_('Failed to upload the configdrive to Swift. '
'Error: %s'))
Expand All @@ -2071,7 +2071,7 @@ def handle_failure(e, task, logmsg, errmsg):
with excutils.save_and_reraise_exception():
handle_failure(
e, task,
_LW('Error while preparing to deploy to node %(node)s: '
_LE('Error while preparing to deploy to node %(node)s: '
'%(err)s'),
_("Failed to prepare to deploy. Error: %s"))

Expand All @@ -2081,7 +2081,7 @@ def handle_failure(e, task, logmsg, errmsg):
with excutils.save_and_reraise_exception():
handle_failure(
e, task,
_LW('Error in deploy of node %(node)s: %(err)s'),
_LE('Error in deploy of node %(node)s: %(err)s'),
_("Failed to deploy. Error: %s"))

# Update conductor_affinity to reference this conductor's ID
Expand Down
5 changes: 4 additions & 1 deletion ironic/drivers/modules/irmc/management.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ def _get_sensors_data(task):
report = irmc_common.get_irmc_report(task.node)
sensor = scci.get_sensor_data(report)

except Exception as e:
except (exception.InvalidParameterValue,
exception.MissingParameterValue,
scci.SCCIInvalidInputError,
scci.SCCIClientError) as e:
LOG.error(_LE("SCCI get sensor data failed for node %(node_id)s "
"with the following error: %(error)s"),
{'node_id': task.node.uuid, 'error': e})
Expand Down
Empty file added ironic/tests/cmd/__init__.py
Empty file.
File renamed without changes.
Empty file added ironic/tests/common/__init__.py
Empty file.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
9 changes: 6 additions & 3 deletions ironic/tests/drivers/irmc/test_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,18 +281,21 @@ def test_management_interface_get_sensors_data_ipmitool_ok(

@mock.patch.object(irmc_common, 'get_irmc_report', spec_set=True,
autospec=True)
def test_management_interface_get_sensors_data_exception1(
def test_management_interface_get_sensors_data_exception(
self,
get_irmc_report_mock):
"""'FailedToGetSensorData Exception."""

get_irmc_report_mock.side_effect = iter([Exception("Report Error")])
get_irmc_report_mock.side_effect = exception.InvalidParameterValue(
"Fake Error")
irmc_management.scci.SCCIInvalidInputError = Exception
irmc_management.scci.SCCIClientError = Exception

with task_manager.acquire(self.context, self.node.uuid) as task:
task.node.driver_info['irmc_sensor_method'] = 'scci'
e = self.assertRaises(exception.FailedToGetSensorData,
self.driver.management.get_sensors_data,
task)
self.assertEqual("Failed to get sensor data for node 1be26c0b-" +
"03f2-4d2e-ae87-c02d7f33c123. Error: Report Error",
"03f2-4d2e-ae87-c02d7f33c123. Error: Fake Error",
str(e))
1 change: 1 addition & 0 deletions ironic/tests/drivers/third_party_driver_mock_specs.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
'MOUNT_FD',
'UNMOUNT_FD',
'SCCIClientError',
'SCCIInvalidInputError',
'get_share_type',
'get_client',
'get_report',
Expand Down

0 comments on commit ffe0353

Please sign in to comment.