Nir Soffer has posted comments on this change. Change subject: netinfo: Replace misused asserts with InvalidConfiguration ......................................................................
Patch Set 2: Code-Review-1 (2 comments) Last version contains a regression, but previous version need a a fix too. http://gerrit.ovirt.org/#/c/34361/2/lib/vdsm/netinfo.py File lib/vdsm/netinfo.py: Line 859: for port in ports: Line 860: if port in self.vlans: Line 861: if vlan is not None: Line 862: raise InvalidConfiguration( Line 863: "Unexpected vlan: %s, expected: None" % vlan) This is very bad change - if vlan is a tuple or a list with one item, we will get the single item in %s. If there are multiple items, this assert will raise, hiding the original error. >>> v = ("single value",) >>> "%s" % (v,) "('single value',)" >>> "%s" % v 'single value' >>> mv = ('value 1', 'value 2') >>> "%s" % (mv,) "('value 1', 'value 2')" >>> "%s" % mv Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: not all arguments converted during string formatting Feel free to revert this change :-) Line 864: nic = getVlanDevice(port) Line 865: vlan = getVlanID(port) Line 866: if self.vlans[port]['iface'] != nic: Line 867: raise InvalidConfiguration( Line 870: port = nic Line 871: if port in self.bondings: Line 872: if bonding is not None: Line 873: raise InvalidConfiguration( Line 874: "Unexpected bonding: %s, expected: None" % bonding) Now I see that I used the same bad format - bonding must be (bonding,) Line 875: bonding = port Line 876: lnics += self.bondings[bonding]['slaves'] Line 877: elif port in self.nics: Line 878: lnics.append(port) -- To view, visit http://gerrit.ovirt.org/34361 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I99ee49aa7e2364f57112e2452e3eab3940b6b00a Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer <nsof...@redhat.com> Gerrit-Reviewer: Antoni Segura Puimedon <asegu...@redhat.com> Gerrit-Reviewer: Dan Kenigsberg <dan...@redhat.com> Gerrit-Reviewer: Nir Soffer <nsof...@redhat.com> Gerrit-Reviewer: Ondřej Svoboda <osvob...@redhat.com> Gerrit-Reviewer: Saggi Mizrahi <smizr...@redhat.com> Gerrit-Reviewer: automat...@ovirt.org Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches