Catch OSError as well to return a better error message

When neither tgt nor linux-io are available, we only get error
message like 'No such file or directory', this situation should
be detected and return a better error instead.

Change-Id: I334717a1a8a728aa6da6024ff9fc6d817399a41f
Closes-Bug: #1540958
This commit is contained in:
Zhenguo Niu 2016-02-22 14:56:34 +08:00
parent 3bcda73ca0
commit c716293cbf

View File

@ -35,7 +35,7 @@ LOG = log.getLogger(__name__)
def _execute(cmd, error_msg, **kwargs):
try:
stdout, stderr = utils.execute(*cmd, **kwargs)
except processutils.ProcessExecutionError as e:
except (processutils.ProcessExecutionError, OSError) as e:
LOG.error(error_msg)
raise errors.ISCSICommandError(error_msg, e.exit_code,
e.stdout, e.stderr)