Change in vdsm[master]: net: remove business logic out of CachingNetInfo
phoracek at redhat.com
phoracek at redhat.com
Wed Dec 23 15:10:00 UTC 2015
Petr Horáček has posted comments on this change.
Change subject: net: remove business logic out of CachingNetInfo
......................................................................
Patch Set 6: Code-Review-1
(4 comments)
https://gerrit.ovirt.org/#/c/50000/6/lib/vdsm/netinfo/__init__.py
File lib/vdsm/netinfo/__init__.py:
Line 139: return info
Line 140:
Line 141:
Line 142: def ifaceUsed(iface):
Line 143: """Lightweight implementation of bool(netinfo.misc.ifaceUsers()) that does
netinfo.misc.iface_users
Line 144: not require a NetInfo object."""
Line 145: if os.path.exists(os.path.join(NET_PATH, iface, 'brport')): # Is it a port
Line 146: return True
Line 147: for linkDict in nl_link.iter_links():
Line 203: if netdict['bridged'] and iface in netdict['ports']:
Line 204: return bridge
Line 205:
Line 206:
Line 207: def _bridged_networks_and_vlans_for_iface(iface, nets):
why is this still private?
Line 208: """ Returns tuples of (bridge, vlan) connected to nic/bond """
Line 209: for network, netdict in six.iteritems(nets):
Line 210: if netdict['bridged']:
Line 211: for interface in netdict['ports']:
Line 214: elif interface.startswith(iface + '.'):
Line 215: yield (network, vlans.vlan_id(interface))
Line 216:
Line 217:
Line 218: def _bridgeless_networks_and_vlans_for_iface(iface, nets):
and this
Line 219: """ Returns tuples of (network, vlan) connected to nic/bond """
Line 220: for network, netdict in six.iteritems(nets):
Line 221: if not netdict['bridged']:
Line 222: if iface == netdict['iface']:
https://gerrit.ovirt.org/#/c/50000/6/lib/vdsm/network/models.py
File lib/vdsm/network/models.py:
Line 81: _netinfo = CachingNetInfo()
Line 82: if name not in _netinfo.nics:
Line 83: raise ConfigNetworkError(ne.ERR_BAD_NIC, 'unknown nic: %s' % name)
Line 84:
Line 85: if misc.iface_users(name, _netinfo.networks, _netinfo.bondings,
imho we should import misc as netinfo_misc or import just iface_users function. using some misc seems confusing to me, but i would not fight for it
Line 86: _netinfo.vlans):
Line 87: mtu = max(mtu, mtus.getMtu(name))
Line 88:
Line 89: super(Nic, self).__init__(name, configurator, ipv4, ipv6, blockingdhcp,
--
To view, visit https://gerrit.ovirt.org/50000
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I1bae19df6721c7559e8eeac1db590026b401f76b
Gerrit-PatchSet: 6
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Ido Barkan <ibarkan at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Edward Haas <edwardh 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: gerrit-hooks <automation at ovirt.org>
Gerrit-HasComments: Yes
More information about the vdsm-patches
mailing list