summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xnova/virt/libvirt/utils.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/nova/virt/libvirt/utils.py b/nova/virt/libvirt/utils.py
index fc73c2759..96f84c194 100755
--- a/nova/virt/libvirt/utils.py
+++ b/nova/virt/libvirt/utils.py
@@ -20,6 +20,7 @@
# License for the specific language governing permissions and limitations
# under the License.
+import errno
import os
from lxml import etree
@@ -59,13 +60,23 @@ def get_iscsi_initiator():
def get_fc_hbas():
"""Get the Fibre Channel HBA information."""
+ out = None
try:
out, err = execute('systool', '-c', 'fc_host', '-v',
run_as_root=True)
except exception.ProcessExecutionError as exc:
+ # This handles the case where rootwrap is used
+ # and systool is not installed
+ # 96 = nova.cmd.rootwrap.RC_NOEXECFOUND:
if exc.exit_code == 96:
LOG.warn(_("systool is not installed"))
return []
+ except OSError as exc:
+ # This handles the case where rootwrap is NOT used
+ # and systool is not installed
+ if exc.errno == errno.ENOENT:
+ LOG.warn(_("systool is not installed"))
+ return []
if out is None:
raise RuntimeError(_("Cannot find any Fibre Channel HBAs"))