summaryrefslogtreecommitdiff
path: root/ironic/drivers
diff options
context:
space:
mode:
authorPavlo Shchelokovskyy <pshchelokovskyy@mirantis.com>2016-08-23 21:33:01 +0300
committerPavlo Shchelokovskyy <pshchelokovskyy@mirantis.com>2016-08-29 18:10:53 +0300
commitbb62f256f7aa55c292ebeae73ca25a4a9f0ec8c0 (patch)
tree8d3d9ab94f6f96b86c985329a1c2f22d46a29f4f /ironic/drivers
parent46dc3959e35400dbadad1bf2ed3733ee44e77dc5 (diff)
downloadironic-bb62f256f7aa55c292ebeae73ca25a4a9f0ec8c0.tar.gz
Allow suppressing ramdisk logs collection
A third-party deployment driver that is not IPA-based may still use 'set_failed_state' method from 'deploy_utils', but currently this will result in an ERROR-level log entry, unnecessary worrying the operator. Allow calls to this method to suppress IPA-based ramdisk logs collection even when it is enabled in config. Change-Id: I4d9fe0382c012d6a00826812752ffe65b5a98ea3
Diffstat (limited to 'ironic/drivers')
-rw-r--r--ironic/drivers/modules/deploy_utils.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/ironic/drivers/modules/deploy_utils.py b/ironic/drivers/modules/deploy_utils.py
index 9b5dc0c71..230646ab9 100644
--- a/ironic/drivers/modules/deploy_utils.py
+++ b/ironic/drivers/modules/deploy_utils.py
@@ -463,7 +463,7 @@ def fetch_images(ctx, cache, images_info, force_raw=True):
cache.fetch_image(href, path, ctx=ctx, force_raw=force_raw)
-def set_failed_state(task, msg):
+def set_failed_state(task, msg, collect_logs=True):
"""Sets the deploy status as failed with relevant messages.
This method sets the deployment as fail with the given message.
@@ -472,10 +472,15 @@ def set_failed_state(task, msg):
:param task: a TaskManager instance containing the node to act on.
:param msg: the message to set in last_error of the node.
+ :param collect_logs: boolean indicating whether to attempt collect
+ logs from IPA-based ramdisk. Defaults to True.
+ Actual log collection is also affected by
+ CONF.agent.deploy_logs_collect config option.
"""
node = task.node
- if CONF.agent.deploy_logs_collect in ('on_failure', 'always'):
+ if (collect_logs and
+ CONF.agent.deploy_logs_collect in ('on_failure', 'always')):
driver_utils.collect_ramdisk_logs(node)
try: