Redfish: fix error formatting when mounting vmedia

Also add missing error into the message.

Change-Id: I9610add40afbb7beb30d375a3a455434f5446cc7
(cherry picked from commit f43587effd)
This commit is contained in:
Dmitry Tantsur 2024-04-29 14:10:09 +02:00
parent 5026e30797
commit 394ee3763b

View File

@ -224,7 +224,7 @@ def _insert_vmedia(task, managers, boot_url, boot_device):
if err_msgs:
exc_msg = ("All virtual media mount attempts failed. "
"Most recent error: ", err_msgs[-1])
"Most recent error: " + err_msgs[-1])
else:
exc_msg = 'No suitable virtual media device found'
raise exception.InvalidParameterValue(exc_msg)
@ -286,11 +286,11 @@ def _insert_vmedia_in_resource(task, resource, boot_url, boot_device,
# by CIMC vKVM - attempts to InsertMedia into those will result
# in BadRequestError. We catch the exception here so that we don't
# fail out and try the next available device instead, if available.
except sushy.exceptions.BadRequestError:
except sushy.exceptions.BadRequestError as exc:
err_msg = ("Inserting virtual media into %(boot_device)s "
"failed for node %(node)s, moving to next virtual "
"media device, if available",
{'node': task.node.uuid,
"media device, if available. %(exc)s" %
{'node': task.node.uuid, 'exc': exc,
'boot_device': boot_device})
err_msgs.append(err_msg)
LOG.warning(err_msg)