Dan Kenigsberg has posted comments on this change.

Change subject: models: Reorder bonding options so the mode is applied first
......................................................................


Patch Set 1: Code-Review-1

(3 comments)

http://gerrit.ovirt.org/#/c/27572/1/tests/functional/networkTests.py
File tests/functional/networkTests.py:

Line 394:     @RequireDummyMod
Line 395:     @ValidateRunningAsRoot
Line 396:     def testReorderBondingOptions(self, bridged):
Line 397:         """
Line 398:         To be discussed.
Add a simple test that passes an out-of-order list of options and see that it 
works. Functional tests should not monkey-patch vdsm - they should use it as a 
black box.
Line 399:         """
Line 400:         with MonkeyPatchScope([(Bond, 'reorderOptions', lambda x: 
x)]):
Line 401:             pass
Line 402: 


http://gerrit.ovirt.org/#/c/27572/1/vdsm/network/models.py
File vdsm/network/models.py:

Line 302: 
Line 303:     @staticmethod
Line 304:     def reorderOptions(options):
Line 305:         'Orders the bonding mode first and the rest of options 
alphabetically.'
Line 306:         opts = dict((option.split('=', 1) for option in 
options.split(' ')))
multiple spaces are acceptable. use empty split().
Line 307: 
Line 308:         mode = opts.pop('mode', None)
Line 309:         opts = sorted(opts.iteritems())
Line 310:         if mode:


Line 305:         'Orders the bonding mode first and the rest of options 
alphabetically.'
Line 306:         opts = dict((option.split('=', 1) for option in 
options.split(' ')))
Line 307: 
Line 308:         mode = opts.pop('mode', None)
Line 309:         opts = sorted(opts.iteritems())
what's the benefit of the alphabetical sort?
Line 310:         if mode:
Line 311:             opts.insert(0, ('mode', mode))
Line 312: 
Line 313:         return ' '.join((opt + '=' + val for (opt, val) in opts))


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I61553c05b34f10d8e81c41fbfdbc448d8fe120a9
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ondřej Svoboda <osvob...@redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <dan...@redhat.com>
Gerrit-Reviewer: Ondřej Svoboda <osvob...@redhat.com>
Gerrit-Reviewer: automat...@ovirt.org
Gerrit-HasComments: Yes
_______________________________________________
vdsm-patches mailing list
vdsm-patches@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to