summaryrefslogtreecommitdiff
path: root/ironic/conductor/manager.py
diff options
context:
space:
mode:
authorDmitry Tantsur <dtantsur@protonmail.com>2020-07-07 12:37:08 +0200
committerDmitry Tantsur <dtantsur@protonmail.com>2020-07-07 12:37:57 +0200
commit53325881527467891044618685e942c660e65a0b (patch)
tree421018e268fa68a27367f9c5bdb7115135e863f0 /ironic/conductor/manager.py
parent3c47122f363756911f066f8cf8ecb0b1cac1335b (diff)
downloadironic-53325881527467891044618685e942c660e65a0b.tar.gz
Allow deleting nodes with a broken driver
The only reason we need a driver is to stop serial console. Only try to load the driver in this case. Change-Id: I5a4e0a40659042087b7a466baae0a8c3dc136211
Diffstat (limited to 'ironic/conductor/manager.py')
-rw-r--r--ironic/conductor/manager.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/ironic/conductor/manager.py b/ironic/conductor/manager.py
index 8f226f089..e641a8d34 100644
--- a/ironic/conductor/manager.py
+++ b/ironic/conductor/manager.py
@@ -1988,6 +1988,7 @@ class ConductorManager(base_manager.BaseConductorManager):
# we would disallow it otherwise. That's done for recovering hopelessly
# broken nodes (e.g. with broken BMC).
with task_manager.acquire(context, node_id,
+ load_driver=False,
purpose='node deletion') as task:
node = task.node
if not node.maintenance and node.instance_uuid is not None:
@@ -2022,6 +2023,17 @@ class ConductorManager(base_manager.BaseConductorManager):
if node.console_enabled:
notify_utils.emit_console_notification(
task, 'console_set', fields.NotificationStatus.START)
+
+ try:
+ task.load_driver()
+ except Exception:
+ with excutils.save_and_reraise_exception():
+ LOG.exception('Could not load the driver for node %s '
+ 'to shut down its console', node.uuid)
+ notify_utils.emit_console_notification(
+ task, 'console_set',
+ fields.NotificationStatus.ERROR)
+
try:
task.driver.console.stop_console(task)
except Exception as err: