Change in vdsm[master]: netinfo: Error out if we failed to change a bond's mode

osvoboda at redhat.com osvoboda at redhat.com
Mon Sep 8 17:46:35 UTC 2014


Ondřej Svoboda has uploaded a new change for review.

Change subject: netinfo: Error out if we failed to change a bond's mode
......................................................................

netinfo: Error out if we failed to change a bond's mode

This is currently caused by NetworkManager (even with a 'server'
configuration). Please see BZ 1136843.

Also check for the failure in a unit test.

Change-Id: I6c29bd5aee13cd6f0be1ab7f308b5432f264215c
Signed-off-by: Ondřej Svoboda <osvoboda at redhat.com>
---
M lib/vdsm/netinfo.py
M tests/netinfoTests.py
2 files changed, 6 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/57/32657/1

diff --git a/lib/vdsm/netinfo.py b/lib/vdsm/netinfo.py
index 6864871..0f95d0b 100644
--- a/lib/vdsm/netinfo.py
+++ b/lib/vdsm/netinfo.py
@@ -473,6 +473,9 @@
             mode = str(mode)
             rc, _, err = execCmd([teeCmd, BONDING_OPT % (bondName, 'mode')],
                                  data=mode, sudo=True)
+            if rc:
+                raise RuntimeError('Changing a bond\'s mode failed, is '
+                                   'NetworkManager running?', '\n'.join(err))
 
             # only read non-empty options
             opts[mode] = dict(((opt, val) for (opt, val) in
diff --git a/tests/netinfoTests.py b/tests/netinfoTests.py
index 810e3dc..456b7ca 100644
--- a/tests/netinfoTests.py
+++ b/tests/netinfoTests.py
@@ -334,8 +334,9 @@
             try:
                 self.assertEqual(_getBondingOptions(bondName), {})
 
-                with open(BONDING_OPT % (bondName, 'miimon'), 'w') as opt:
-                    opt.write(INTERVAL)
+                with self.assertNotRaises():
+                    with open(BONDING_OPT % (bondName, 'miimon'), 'w') as opt:
+                        opt.write(INTERVAL)
 
                 self.assertEqual(_getBondingOptions(bondName),
                                  {'miimon': INTERVAL})


-- 
To view, visit http://gerrit.ovirt.org/32657
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6c29bd5aee13cd6f0be1ab7f308b5432f264215c
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ondřej Svoboda <osvoboda at redhat.com>


More information about the vdsm-patches mailing list