diff options
author | Jenkins <jenkins@review.openstack.org> | 2013-04-30 22:29:51 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2013-04-30 22:29:51 +0000 |
commit | dccbcc84a922d16eb230491e2a4d486fdb19b40f (patch) | |
tree | af190a893159e2ff27d647e2ee8f1e25eb25fed4 | |
parent | 85f1f074b24c1f7eb7ab93f7d7bdb9cdffaeed35 (diff) | |
parent | 001961ed495a33cc944407888a2797f8a600e091 (diff) | |
download | nova-dccbcc84a922d16eb230491e2a4d486fdb19b40f.tar.gz nova-dccbcc84a922d16eb230491e2a4d486fdb19b40f.tar.xz nova-dccbcc84a922d16eb230491e2a4d486fdb19b40f.zip |
Merge "Fix attach when running as root without sysfsutils"
-rwxr-xr-x | nova/virt/libvirt/utils.py | 11 |
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")) |