Resolves: rhbz#1038827
---
blivet/fcoe.py | 20 ++++++++++++++++----
blivet/util.py | 3 +++
2 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/blivet/fcoe.py b/blivet/fcoe.py
index 4bbd8c3..38fea91 100644
--- a/blivet/fcoe.py
+++ b/blivet/fcoe.py
@@ -104,6 +104,10 @@ class fcoe(object):
self.lldpadStarted = True
def addSan(self, nic, dcb=False, auto_vlan=True):
+ """Activates FCoE SANs attached to interface specified by nic.
+
+ Returns error message, or empty string if succeeded.
+ """
if not has_fcoe():
raise IOError, _("FCoE not available")
@@ -112,26 +116,34 @@ class fcoe(object):
util.run_program(["ip", "link", "set", nic,
"up"])
+ rc = 0
+ error_msg = ""
if dcb:
self._startLldpad()
util.run_program(["dcbtool", "sc", nic, "dcb",
"on"])
util.run_program(["dcbtool", "sc", nic,
"app:fcoe",
"e:1", "a:1",
"w:1"])
- util.run_program(["fipvlan", "-c", "-s",
"-f",
+ rc, out = util.run_program_and_capture_output(["fipvlan",
"-c", "-s", "-f",
"-fcoe", nic])
else:
if auto_vlan:
# certain network configrations require the VLAN layer module:
util.run_program(["modprobe", "8021q"])
- util.run_program(["fipvlan", '-c', '-s',
'-f',
+ rc, out = util.run_program_and_capture_output(["fipvlan",
'-c', '-s', '-f',
"-fcoe", nic])
else:
f = open("/sys/module/libfcoe/parameters/create",
"w")
f.write(nic)
f.close()
- self._stabilize()
- self.nics.append((nic, dcb, auto_vlan))
+ if rc == 0:
+ self._stabilize()
+ self.nics.append((nic, dcb, auto_vlan))
+ else:
+ log.debug("Activating FCoE SAN failed: %s %s" % (rc, out))
+ error_msg = out
+
+ return error_msg
def write(self, ROOT_PATH):
if not self.nics:
diff --git a/blivet/util.py b/blivet/util.py
index a9efa34..d43b252 100644
--- a/blivet/util.py
+++ b/blivet/util.py
@@ -58,6 +58,9 @@ def run_program(*args, **kwargs):
def capture_output(*args, **kwargs):
return _run_program(*args, **kwargs)[1]
+def run_program_and_capture_output(*args, **kwargs):
+ return _run_program(*args, **kwargs)
+
def mount(device, mountpoint, fstype, options=None):
if options is None:
options = "defaults"
--
1.7.11.7