Petr Horáček has uploaded a new change for review.
Change subject: tests: network: when using bonding, attach at least 2 slaves
......................................................................
tests: network: when using bonding, attach at least 2 slaves
In some tests we attach just one slave to a bonding, it works
with native linux bonding, but does not allow us to use existing
for OVS bonding.
Change-Id: I1763bc3409aa7da91dcd2e3b21dd8540870138ef
Signed-off-by: Petr Horacek <phoracek(a)redhat.com>
---
M tests/functional/networkTests.py
1 file changed, 34 insertions(+), 26 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/40/41840/1
diff --git a/tests/functional/networkTests.py b/tests/functional/networkTests.py
index 5702580..352c7c6 100644
--- a/tests/functional/networkTests.py
+++ b/tests/functional/networkTests.py
@@ -585,7 +585,7 @@
@cleanupNet
@permutations([[True], [False]])
def testFailWithInvalidBondingName(self, bridged):
- with dummyIf(1) as nics:
+ with dummyIf(2) as nics:
invalid_bond_names = ('bond', 'bonda', 'bond0a',
'jamesbond007')
for bond_name in invalid_bond_names:
status, msg = self.vdsm_net.addNetwork(NETWORK_NAME,
@@ -690,7 +690,7 @@
VLAN_COUNT = 5
NET_VLANS = [(NETWORK_NAME + str(index), str(index))
for index in range(VLAN_COUNT)]
- with dummyIf(1) as nics:
+ with dummyIf(2) as nics:
firstVlan, firstVlanId = NET_VLANS[0]
status, msg = self.vdsm_net.addNetwork(firstVlan, vlan=firstVlanId,
bond=BONDING_NAME,
@@ -719,7 +719,7 @@
@cleanupNet
@permutations([[True], [False]])
def testAddNetworkVlanBond(self, bridged):
- with dummyIf(1) as nics:
+ with dummyIf(2) as nics:
vlan_id = '42'
status, msg = self.vdsm_net.addNetwork(NETWORK_NAME,
vlan=vlan_id,
@@ -759,7 +759,7 @@
@permutations([[True], [False]])
def testDelNetworkWithMTU(self, bridged):
MTU = '1234'
- with dummyIf(1) as nics:
+ with dummyIf(2) as nics:
status, msg = self.vdsm_net.addNetwork(NETWORK_NAME, vlan=VLAN_ID,
bond=BONDING_NAME,
nics=nics,
@@ -1334,7 +1334,7 @@
@cleanupNet
def testDelNetworkBondAccumulation(self):
- with dummyIf(1) as nics:
+ with dummyIf(2) as nics:
for bigBond in ('bond555', 'bond666', 'bond777'):
status, msg = self.vdsm_net.addNetwork(NETWORK_NAME, VLAN_ID,
bigBond, nics)
@@ -1352,15 +1352,15 @@
@cleanupNet
@permutations([[True], [False]])
def testSetupNetworksResizeBond(self, bridged):
- with dummyIf(3) as nics:
+ with dummyIf(4) as nics:
with self.vdsm_net.pinger():
- bondings = {BONDING_NAME: dict(nics=nics[:1],
+ bondings = {BONDING_NAME: dict(nics=nics[:2],
bridged=bridged)}
status, msg = self.vdsm_net.setupNetworks({}, bondings, {})
self.assertEquals(status, SUCCESS, msg)
- self.assertBondExists(BONDING_NAME, nics=nics[:1])
+ self.assertBondExists(BONDING_NAME, nics=nics[:2])
# Increase bond size
bondings[BONDING_NAME]['nics'] = nics
@@ -1372,14 +1372,14 @@
# Reduce bond size
REQMODE_BROADCAST = '3'
- bondings[BONDING_NAME]['nics'] = nics[:2]
+ bondings[BONDING_NAME]['nics'] = nics[:3]
bondings[BONDING_NAME]['options'] = ('mode=%s' %
REQMODE_BROADCAST)
status, msg = self.vdsm_net.setupNetworks({}, bondings, {})
self.assertEquals(status, SUCCESS, msg)
- self.assertBondExists(BONDING_NAME, nics[:2],
+ self.assertBondExists(BONDING_NAME, nics[:3],
bondings[BONDING_NAME]['options'])
bondings = {BONDING_NAME: dict(remove=True)}
@@ -2079,7 +2079,7 @@
@permutations([[True], [False]])
@cleanupNet
def testSetupNetworksEmergencyDevicesCleanupVlanOverwrite(self, bridged):
- with dummyIf(1) as nics:
+ with dummyIf(2) as nics:
nic, = nics
network = {NETWORK_NAME: {'vlan': VLAN_ID, 'bridged':
bridged,
'nic': nic}}
@@ -2104,7 +2104,7 @@
@permutations([[True], [False]])
@cleanupNet
def testSetupNetworksEmergencyDevicesCleanupBondOverwrite(self, bridged):
- with dummyIf(1) as nics:
+ with dummyIf(2) as nics:
nic, = nics
network = {NETWORK_NAME: {'bridged': bridged,
'bonding': BONDING_NAME}}
@@ -2232,7 +2232,7 @@
@cleanupNet
def testSetupNetworksRemoveSlavelessBond(self):
- with dummyIf(1) as nics:
+ with dummyIf(2) as nics:
status, msg = self.vdsm_net.setupNetworks(
{NETWORK_NAME:
{'bonding': BONDING_NAME, 'bridged': False}},
@@ -2241,9 +2241,9 @@
self.assertNetworkExists(NETWORK_NAME)
self.assertBondExists(BONDING_NAME, nics)
- nic, = nics
with open(BONDING_SLAVES % BONDING_NAME, 'w') as f:
- f.write('-%s\n' % nic)
+ for nic in nics:
+ f.write('-%s\n' % nic)
status, msg = self.vdsm_net.setupNetworks(
{NETWORK_NAME: {'remove': True}},
@@ -2281,19 +2281,20 @@
raise SkipTest(
"with ifcfg persistence, vdsm-restore-net-config "
"doesn't restore in-kernel state")
- with dummyIf(1) as (nic, ):
+ with dummyIf(2) as nics:
with open(BONDING_MASTERS, 'w') as bonds:
bonds.write('+%s\n' % BONDING_NAME)
try:
with open(BONDING_SLAVES % BONDING_NAME, 'w') as f:
- f.write('+%s\n' % nic)
+ for nic in nics:
+ f.write('+%s\n' % nic)
status, msg = self.vdsm_net.setupNetworks(
{NETWORK_NAME:
{'bonding': BONDING_NAME, 'bridged': False}},
- {BONDING_NAME: {'nics': [nic]}}, NOCHK)
+ {BONDING_NAME: {'nics': nics}}, NOCHK)
self.assertEqual(status, SUCCESS, msg)
self.assertNetworkExists(NETWORK_NAME)
- self.assertBondExists(BONDING_NAME, [nic])
+ self.assertBondExists(BONDING_NAME, nics)
finally:
with open(BONDING_MASTERS, 'w') as bonds:
bonds.write('-%s\n' % BONDING_NAME)
@@ -2302,27 +2303,34 @@
self.vdsm_net.restoreNetConfig()
self.assertNetworkExists(NETWORK_NAME)
- self.assertBondExists(BONDING_NAME, [nic])
+ self.assertBondExists(BONDING_NAME, nics)
status, msg = self.vdsm_net.setupNetworks(
{NETWORK_NAME: {'remove': True}},
{BONDING_NAME: {'remove': True}}, NOCHK)
self.assertEqual(status, SUCCESS, msg)
self.assertNetworkDoesntExist(NETWORK_NAME)
- self.assertBondDoesntExist(BONDING_NAME, [nic])
+ self.assertBondDoesntExist(BONDING_NAME, nics)
self.vdsm_net.save_config()
@cleanupNet
@ValidateRunningAsRoot
def test_setupNetworks_on_external_vlaned_bond(self):
- with dummyIf(1) as (nic, ):
- with open(NET_CONF_PREF + nic, 'w') as f:
+ with dummyIf(2) as nics:
+ with open(NET_CONF_PREF + nics[0], 'w') as f:
f.write("""DEVICE=%s
MASTER=%s
SLAVE=yes
ONBOOT=yes
MTU=1500
-NM_CONTROLLED=no""" % (nic, BONDING_NAME))
+NM_CONTROLLED=no""" % (nics[0], BONDING_NAME))
+ with open(NET_CONF_PREF + nics[1], 'w') as f:
+ f.write("""DEVICE=%s
+MASTER=%s
+SLAVE=yes
+ONBOOT=yes
+MTU=1500
+NM_CONTROLLED=no""" % (nics[1], BONDING_NAME))
with open(NET_CONF_PREF + BONDING_NAME, 'w') as f:
f.write("""DEVICE=%s
BONDING_OPTS='mode=802.3ad miimon=150'
@@ -2354,7 +2362,7 @@
self.vdsm_net.restoreNetConfig()
self.assertNetworkExists(NETWORK_NAME)
- self.assertBondExists(BONDING_NAME, [nic])
+ self.assertBondExists(BONDING_NAME, nics)
self.assertVlanExists(BONDING_NAME + '.' + VLAN_ID)
status, msg = self.vdsm_net.setupNetworks(
@@ -2362,5 +2370,5 @@
{BONDING_NAME: {'remove': True}}, NOCHK)
self.assertEqual(status, SUCCESS, msg)
self.assertNetworkDoesntExist(NETWORK_NAME)
- self.assertBondDoesntExist(BONDING_NAME, [nic])
+ self.assertBondDoesntExist(BONDING_NAME, nics)
self.vdsm_net.save_config()
--
To view, visit
https://gerrit.ovirt.org/41840
To unsubscribe, visit
https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1763bc3409aa7da91dcd2e3b21dd8540870138ef
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Petr Horáček <phoracek(a)redhat.com>