Change in vdsm[master]: Advertise aggregator ID in bonding interfaces

danken at redhat.com danken at redhat.com
Fri Feb 12 20:51:56 UTC 2016


Dan Kenigsberg has posted comments on this change.

Change subject: Advertise aggregator ID in bonding interfaces
......................................................................


Patch Set 12: Code-Review-1

(12 comments)

https://gerrit.ovirt.org/#/c/53100/12/lib/vdsm/netinfo/bonding.py
File lib/vdsm/netinfo/bonding.py:

Line 43: BONDED_NIC
I think that

 BONDING_SLAVE_OPT = '/sys/class/net/%s/bonding_slave/%s'

fits better to what we currently have.


Line 71: "
let's use single quotes


Line 77: agg_info
better use the term agg_id, for consistency with the other function.


Line 78: agg_info
I believe it should be numeric (but please verify in the spec)

  int(agg_info)


Line 82: os.path.join(
os.path.join has a single arg; no need to call the function.


https://gerrit.ovirt.org/#/c/53100/12/tests/functional/networkTests.py
File tests/functional/networkTests.py:

Line 2824:             self.assertEqual(status, SUCCESS, msg)
Line 2825:             self.assertBondExists('bond0', nics1)
Line 2826:             self.assertBondExists('bond1', nics0)
Line 2827: 
Line 2828:     @permutations([[{}], [{'options': 'mode=4 lacp_rate=1 miimon=100'}]])
I was misunderstood.
the test would be more explicit and readable with

 @permutations([['mode=0'], [['mode=4 lacp_rate=1 miimon=100']])
Line 2829:     @cleanupNet
Line 2830:     @ValidateRunningAsRoot
Line 2831:     def test_bond_mode4_caps_aggregator_id(self, bond_options):
Line 2832:         with dummyIf(3) as nics:


Line 2827: 
Line 2828:     @permutations([[{}], [{'options': 'mode=4 lacp_rate=1 miimon=100'}]])
Line 2829:     @cleanupNet
Line 2830:     @ValidateRunningAsRoot
Line 2831:     def test_bond_mode4_caps_aggregator_id(self, bond_options):
still, using a double-veth test smells more realistic. if you have tried it, I'd love to see your code to run it myself.
Line 2832:         with dummyIf(3) as nics:
Line 2833:             bonding = {'nics': nics[:2]}
Line 2834:             bonding.update(bond_options)
Line 2835:             status, msg = self.setupNetworks(


Line 2836:                 {},
Line 2837:                 {BONDING_NAME: bonding},
Line 2838:                 NOCHK)
Line 2839:             self.assertEqual(status, SUCCESS, msg)
Line 2840:             self.assertBondExists(BONDING_NAME, nics[:2])
a newline here can help readability
Line 2841:             status, msg, info = self.vdsm_net.getVdsCapabilities()
Line 2842:             bond_info = info['bondings'][BONDING_NAME]
Line 2843:             bond_ag_id = bond_info.get('ad_aggregator_id')
Line 2844:             bond_par_mac = bond_info.get('ad_partner_mac')


Line 2843: bond_ag_id
used only in one of the branches. no need to assign it here.


Line 2849: None
is the value random?


Line 2850: None
can't you assert that it is all-zero?


Line 2852:                     self.assertNotEqual(ag_id, None)
Line 2853:             else:
Line 2854:                 self.assertNotIn('ad_aggregator_id', bond_info)
Line 2855:                 self.assertNotIn('ad_partner_mac', bond_info)
Line 2856:                 for ag_id in bonded_nics_ids:
for nic in nics[:2]:
  assertNotIn('ad_aggregator_id'. info["nics"][nic])

would be more precise.
Line 2857:                     self.assertEqual(ag_id, None)
Line 2858:             self.assertNotIn('ad_aggregator_id', not_bonded_nic)
Line 2859:             status, msg = self.setupNetworks(
Line 2860:                 {}, {BONDING_NAME: {'remove': True}}, NOCHK)


-- 
To view, visit https://gerrit.ovirt.org/53100
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I85267967c9cb1b0a626d91cb1953361ed4de727a
Gerrit-PatchSet: 12
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Sagi Shnaidman <sshnaidm at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Edward Haas <edwardh at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Petr Horáček <phoracek at redhat.com>
Gerrit-Reviewer: Sagi Shnaidman <sshnaidm at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list