diff options
| author | Devananda van der Veen <devananda.vdv@gmail.com> | 2013-06-12 18:35:34 -0700 |
|---|---|---|
| committer | Devananda van der Veen <devananda.vdv@gmail.com> | 2013-06-12 19:21:48 -0700 |
| commit | 56a6e3cf1ec0e454077fc612c9b80e61d98d07f2 (patch) | |
| tree | 5dc1a02a8243fe19ccf0bb3d3ec67ce0c0eb045e /nova/cmd | |
| parent | 3f2b22499d9e94ae3ac80786752223f43d24492b (diff) | |
| download | nova-56a6e3cf1ec0e454077fc612c9b80e61d98d07f2.tar.gz nova-56a6e3cf1ec0e454077fc612c9b80e61d98d07f2.tar.xz nova-56a6e3cf1ec0e454077fc612c9b80e61d98d07f2.zip | |
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
Diffstat (limited to 'nova/cmd')
| -rw-r--r-- | nova/cmd/baremetal_deploy_helper.py | 19 |
1 files 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) |
