Hunt Xu has posted comments on this change.

Change subject: tc: set/unset promisc when it's really needed
......................................................................


Patch Set 1: (1 inline comment)

....................................................
File vdsm/tc.py
Line 178: 
Line 179: def set_promisc(dev, on=True):
Line 180:     flags = ethtool.get_flags(dev)
Line 181: 
Line 182:     if bool(flags & ethtool.IFF_PROMISC) ^ on:
The bool casting is not for 'if' but for the '^'. 'flags & ethtool.IFF_PROMISC' 
would yield either 0 or ethtool.IFF_PROMISC which is an integer 256. When doing 
xor between an integer and a boolean, python treats True as 1 and False as 0. 
Thus '256 ^ True' produces '257' which is also True while we are expecting a 
False.
Line 183:         if on:
Line 184:             flags |= ethtool.IFF_PROMISC
Line 185:         else:
Line 186:             flags &= ~ethtool.IFF_PROMISC


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

Gerrit-MessageType: comment
Gerrit-Change-Id: I7d38e2f13a059ea916892ab8247509e2e0b612e2
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Hunt Xu <[email protected]>
Gerrit-Reviewer: Antoni Segura Puimedon <[email protected]>
Gerrit-Reviewer: Antoni Segura Puimedon <[email protected]>
Gerrit-Reviewer: Dan Kenigsberg <[email protected]>
Gerrit-Reviewer: Hunt Xu <[email protected]>
Gerrit-Reviewer: Mark Wu <[email protected]>
Gerrit-Reviewer: Shahar Havivi <[email protected]>
Gerrit-Reviewer: oVirt Jenkins CI Server
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to