Change in vdsm[master]: netinfo: stop using getVlanID() in network.api

osvoboda at redhat.com osvoboda at redhat.com
Mon Sep 28 20:27:14 UTC 2015


Ondřej Svoboda has posted comments on this change.

Change subject: netinfo: stop using getVlanID() in network.api
......................................................................


Patch Set 3: Code-Review-1

(1 comment)

A try-except is not necessary here.

https://gerrit.ovirt.org/#/c/46741/3/vdsm/network/api.py
File vdsm/network/api.py:

Line 155: IndexError
Should be KeyError -- but I am going to revert to not caring about this error because it cannot happen:

The only caller to pass 'vlan' parameter to _objectivizeNetwork is _delNetwork. But it passes the 'vlan_id' parameter at the same time, both obtained from _netinfo.getNicsVlanAndBondingForNetwork.

Since _netinfo is shared between _delNetwork and _objectivizeNetwork it is guaranteed that a VLAN is found in _netinfo.vlans iff it was reported by _netinfo.getNicsVlanAndBondingForNetwork.

I don't want to simplify the assignment to 'tag' further now; but if we assume that a VLAN name is known exactly when its tag is, then it also cannot happen that 'vlan is not None and vlan_id is None', therefore the following would suffice:

    topNetDev = Vlan(topNetDev, vlan_id, configurator, mtu=mtu, name=vlan)

If I am right, there are two ways to change the code: to add an assertion on "vlan_id is not None" or to add a comment.


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ic473f3fbb0d7add34dca338d2b02f4d4d9ed47b0
Gerrit-PatchSet: 3
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ondřej Svoboda <osvoboda at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Ido Barkan <ibarkan at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Ondřej Svoboda <osvoboda at redhat.com>
Gerrit-Reviewer: Petr Horáček <phoracek at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-HasComments: Yes


More information about the vdsm-patches mailing list