From 56a6e3cf1ec0e454077fc612c9b80e61d98d07f2 Mon Sep 17 00:00:00 2001 From: Devananda van der Veen Date: Wed, 12 Jun 2013 18:35:34 -0700 Subject: Revert "Fix local variable 'root_uuid' ref before assign" This reverts commit 30bc1ef250f0230a9a1f562cd51b0f57d4a35912, which fixed a NameError but introduced a new bug in the deploy process that could cause silent failures in a deploy. Instead, we should log a more descriptive error and allow the exception to be raised. Change-Id: I0221984ce4f7c406990315ef820d9ce63fc6e015 --- nova/cmd/baremetal_deploy_helper.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/nova/cmd/baremetal_deploy_helper.py b/nova/cmd/baremetal_deploy_helper.py index 539d5b517..8586e6e59 100644 --- a/nova/cmd/baremetal_deploy_helper.py +++ b/nova/cmd/baremetal_deploy_helper.py @@ -32,6 +32,7 @@ from wsgiref import simple_server from nova import config from nova import context as nova_context +from nova.openstack.common import excutils from nova.openstack.common import log as logging from nova.openstack.common import processutils from nova import utils @@ -186,7 +187,12 @@ def work_on_disk(dev, root_mb, swap_mb, image_path): return dd(image_path, root_part) mkswap(swap_part) - root_uuid = block_uuid(root_part) + + try: + root_uuid = block_uuid(root_part) + except processutils.ProcessExecutionError as err: + with excutils.save_and_reraise_exception(): + LOG.error("Failed to detect root device UUID.") return root_uuid @@ -201,14 +207,15 @@ def deploy(address, port, iqn, lun, image_path, pxe_config_path, login_iscsi(address, port, iqn) try: root_uuid = work_on_disk(dev, root_mb, swap_mb, image_path) - switch_pxe_config(pxe_config_path, root_uuid) except processutils.ProcessExecutionError as err: - # Log output if there was a error - LOG.error("Cmd : %s" % err.cmd) - LOG.error("StdOut : %s" % err.stdout) - LOG.error("StdErr : %s" % err.stderr) + with excutils.save_and_reraise_exception(): + # Log output if there was a error + LOG.error("Cmd : %s" % err.cmd) + LOG.error("StdOut : %s" % err.stdout) + LOG.error("StdErr : %s" % err.stderr) finally: logout_iscsi(address, port, iqn) + switch_pxe_config(pxe_config_path, root_uuid) # Ensure the node started netcat on the port after POST the request. time.sleep(3) notify(address, 10000) -- cgit