Antoni Segura Puimedon has uploaded a new change for review.
Change subject: NetReload: Moved addNetwork logic to the configurator ......................................................................
NetReload: Moved addNetwork logic to the configurator
This change starts moving the logic of configNetwork API endpoints towards the configurators.
configureBridge, configureVlan, configureBond and configureNic after this patch have to take care of the underlying devices explicitly in the configurator module. However, the underlying device handling will be abstracted to the network models in a future patch. Thus, the code of configureBond for IfcfgConfigurator is gonna be something like:
self.configWriter.addBonding(params) for slave in bond.slaves: slave.configure(params)
Change-Id: I877eddc07a17f0bdd376df7bab8b19ffe52f72ba Signed-off-by: Antoni S. Puimedon asegurap@redhat.com --- M vdsm/configNetwork.py M vdsm/ifcfgConfigurator.py 2 files changed, 120 insertions(+), 73 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/68/13268/1
diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py index ff18629..0defdd4 100755 --- a/vdsm/configNetwork.py +++ b/vdsm/configNetwork.py @@ -38,6 +38,7 @@ from ifcfgConfigurator import ifup from ifcfgConfigurator import ifdown from ifcfgConfigurator import ConfigWriter +from ifcfgConfigurator import IfcfgConfigurator
CONNECTIVITY_TIMEOUT_DEFAULT = 4 MAX_VLAN_ID = 4094 @@ -275,7 +276,6 @@ raise ConfigNetworkError(ne.ERR_BAD_PARAMS, 'Both PREFIX and NETMASK supplied')
- # Validation if not utils.tobool(force): logging.debug('validating network...') _addNetworkValidation(_netinfo, network=network, vlan=vlan, @@ -291,14 +291,10 @@
if configWriter is None: configWriter = ConfigWriter() + configurator = IfcfgConfigurator(configWriter)
- prevmtu = None - if mtu: - prevmtu = configWriter.getMaxMtu(nics, mtu) - - nic = nics[0] if nics else None - iface = bonding or nic - blockingDhcp = utils.tobool(options.get('blockingdhcp')) + async = utils.tobool(options.get('blockingdhcp')) and \ + options.get('bootproto') == 'dhcp'
# take down nics that need to be changed vlanedIfaces = [v['iface'] for v in _netinfo.vlans.values()] @@ -308,70 +304,20 @@ ifdown(nic)
if bridged: - configWriter.addBridge(network, ipaddr=ipaddr, netmask=netmask, - mtu=mtu, gateway=gateway, **options) - ifdown(network) - # We need to define (if requested) ip, mask & gateway on ifcfg-* - # only on most top device according to following order: - # bridge -> vlan -> bond -> nic - # For lower level devices we should ignore it. - # reset ip, netmask, gateway and bootproto for lower level devices - bridgeBootproto = options.get('bootproto') - ipaddr = netmask = gateway = options['bootproto'] = None - - # For VLAN we should attach bridge only to the VLAN device - # rather than to underlying NICs or bond - brName = network if bridged else None - bridgeForNic = None if vlan else brName - - # We want to create config files (ifcfg-*) in top-down order - # (bridge->vlan->bond->nic) to be able to handle IP/NETMASK - # correctly for bridgeless networks - if vlan: - # don't ifup VLAN interface here, it should be done last, - # after the bond and nic up - configWriter.addVlan(vlan, iface, network=brName, - mtu=mtu, bridged=bridged, - ipaddr=ipaddr, netmask=netmask, - gateway=gateway, **options) - iface += '.' + vlan - vlanBootproto = options.get('bootproto') - # reset ip, netmask, gateway and bootproto for lower level devices - ipaddr = netmask = gateway = options['bootproto'] = None - - # First we need to prepare all conf files - if bonding: - configWriter.addBonding(bonding, bridge=bridgeForNic, - bondingOptions=bondingOptions, - mtu=max(prevmtu, mtu), - ipaddr=ipaddr, netmask=netmask, - gateway=gateway, **options) - bondBootproto = options.get('bootproto') - # reset ip, netmask, gateway and bootproto for lower level devices - ipaddr = netmask = gateway = options['bootproto'] = None - - for nic in nics: - configWriter.addNic(nic, bonding=bonding, - bridge=bridgeForNic if not bonding else None, - mtu=max(prevmtu, mtu), ipaddr=ipaddr, - netmask=netmask, gateway=gateway, **options) - - # Now we can run ifup for all interfaces - if bonding: - ifup(bonding, bondBootproto == 'dhcp' and not blockingDhcp) - else: - for nic in nics: - ifup(nic, options.get('bootproto') == 'dhcp' and not blockingDhcp) - - # Now we can ifup VLAN interface, because bond and nic already up - if vlan: - ifup(iface, vlanBootproto == 'dhcp' and not blockingDhcp) - - if bridged: - ifup(network, bridgeBootproto == 'dhcp' and not blockingDhcp) - - # add libvirt network - configWriter.createLibvirtNetwork(network, bridged, iface) + configurator.configureBridge(network, vlan, bonding, nics, ipaddr, + netmask, mtu, gateway, bondingOptions, + async, **options) + elif vlan: + configurator.configureVlan(network, vlan, None, bonding, nics, + ipaddr, netmask, mtu, gateway, + bondingOptions, async, **options) + elif bonding: + configurator.configureBond(network, bonding, nics, ipaddr, netmask, + mtu, gateway, None, bondingOptions, async, + **options) + elif nics: + configurator.configureNic(network, nics[0], None, bonding, ipaddr, + netmask, mtu, gateway, async, **options)
def assertBridgeClean(bridge, vlan, bonding, nics): diff --git a/vdsm/ifcfgConfigurator.py b/vdsm/ifcfgConfigurator.py index 5723185..288730c 100644 --- a/vdsm/ifcfgConfigurator.py +++ b/vdsm/ifcfgConfigurator.py @@ -43,7 +43,108 @@
class IfcfgConfigurator(object): # TODO: Do all the configWriter interaction from here. - pass + def __init__(self, configWriter=None): + self.configWriter = configWriter + self.libvirtAdded = [] + + def begin(self): + if self.configWriter is None: + self.configWriter = ConfigWriter() + self.libvirtAdded = [] + + def rollback(self): + if self.configWriter: + self.configWriter.restoreBackups() + # TODO: Add a try except with logging, but not raising. + for network in self.libvirtAdded: + self.configWriter.removeLibvirtNetwork(network) + + self.configWriter = None + + def commit(self): + if self.configWriter: + self.configWriter = None + self.libvirtAdded = [] + + def configureBridge(self, network, vlan=None, bonding=None, nics=None, + ipaddr=None, netmask=None, mtu=None, gateway=None, + bondingOptions=None, async=False, **options): + self.configWriter.addBridge(network, ipaddr=ipaddr, netmask=netmask, + mtu=mtu, gateway=gateway, **options) + ifdown(network) + options['bootproto'] = None + if vlan: + iface = self.configureVlan(None, vlan, bridge=network, + bonding=bonding, nics=nics, mtu=mtu, + bondingOptions=bondingOptions, + **options) + elif bonding: + iface = self.configureBond(None, bonding, nics, bridge=network, + bondingOptions=bondingOptions, mtu=mtu, + **options) + elif nics: + mtu = self.configWriter.getMaxMtu(nics, mtu) + for nic in nics: + iface = self.configureNic(None, nic, bridge=network, mtu=mtu, + **options) + else: + iface = None + ifup(network, async) + self.configWriter.createLibvirtNetwork(network, True, iface) + + def configureVlan(self, network, vlan, bridge=None, bonding=None, + nics=None, ipaddr=None, netmask=None, mtu=None, + gateway=None, bondingOptions=None, async=False, + **options): + iface = (bonding or nics[0]) + self.configWriter.addVlan(vlan, iface, network=bridge, mtu=mtu, + bridged=bridge is not None, ipaddr=ipaddr, + netmask=netmask, gateway=gateway, **options) + iface += '.' + vlan + options['bootproto'] = None + if bonding: + self.configureBond(None, bonding, nics, bridge=None, + bondingOptions=bondingOptions, mtu=mtu, + **options) + elif nics: + mtu = self.configWriter.getMaxMtu(nics, mtu) + for nic in nics: + self.configureNic(None, nic, bridge=None, mtu=mtu, **options) + ifup(iface, async) + if network: + self.configWriter.createLibvirtNetwork(network, False, iface) + return iface + + def configureBond(self, network, bonding=None, nics=None, ipaddr=None, + netmask=None, mtu=None, gateway=None, bridge=None, + bondingOptions=None, async=False, **options): + mtu = self.configWriter.getMaxMtu(nics, mtu) + self.configWriter.addBonding(bonding, bridge=bridge, + bondingOptions=bondingOptions, + mtu=mtu, ipaddr=ipaddr, + netmask=netmask, gateway=gateway, + **options) + options['bootproto'] = None + for nic in nics: + self.configureNic(None, nic, bonding=bonding, mtu=mtu, **options) + + ifup(bonding, async) + if network: + self.configWriter.createLibvirtNetwork(network, False, bonding) + return bonding + + def configureNic(self, network, nic, bridge=None, bonding=None, + ipaddr=None, netmask=None, mtu=None, gateway=None, + async=False, **options): + self.configWriter.addNic(nic, bonding=bonding, bridge=bridge, mtu=mtu, + ipaddr=ipaddr, netmask=netmask, + gateway=gateway, **options) + if not bonding: + ifup(nic, async) + + if network: + self.configWriter.createLibvirtNetwork(network, False, nic) + return nic
class ConfigWriter(object):
-- To view, visit http://gerrit.ovirt.org/13268 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange Gerrit-Change-Id: I877eddc07a17f0bdd376df7bab8b19ffe52f72ba Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Antoni Segura Puimedon asegurap@redhat.com
oVirt Jenkins CI Server has posted comments on this change.
Change subject: NetReload: Moved addNetwork logic to the configurator ......................................................................
Patch Set 1:
Build Started http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/1741/ (1/2)
-- To view, visit http://gerrit.ovirt.org/13268 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I877eddc07a17f0bdd376df7bab8b19ffe52f72ba Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: NetReload: Moved addNetwork logic to the configurator ......................................................................
Patch Set 1:
Build Started http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/1691/ (2/2)
-- To view, visit http://gerrit.ovirt.org/13268 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I877eddc07a17f0bdd376df7bab8b19ffe52f72ba Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: NetReload: Moved addNetwork logic to the configurator ......................................................................
Patch Set 1:
Build Successful
http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/1691/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/1741/ : SUCCESS
-- To view, visit http://gerrit.ovirt.org/13268 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I877eddc07a17f0bdd376df7bab8b19ffe52f72ba Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Mark Wu wudxw@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
Antoni Segura Puimedon has posted comments on this change.
Change subject: NetReload: Moved addNetwork logic to the configurator ......................................................................
Patch Set 1: Verified
-- To view, visit http://gerrit.ovirt.org/13268 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I877eddc07a17f0bdd376df7bab8b19ffe52f72ba Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Mark Wu wudxw@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: NetReload: Moved addNetwork logic to the configurator ......................................................................
Patch Set 2:
Build Started http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/1801/ (1/2)
-- To view, visit http://gerrit.ovirt.org/13268 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I877eddc07a17f0bdd376df7bab8b19ffe52f72ba Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Mark Wu wudxw@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: NetReload: Moved addNetwork logic to the configurator ......................................................................
Patch Set 2:
Build Started http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/1750/ (2/2)
-- To view, visit http://gerrit.ovirt.org/13268 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I877eddc07a17f0bdd376df7bab8b19ffe52f72ba Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Mark Wu wudxw@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: NetReload: Moved addNetwork logic to the configurator ......................................................................
Patch Set 2:
Build Successful
http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/1750/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/1801/ : SUCCESS
-- To view, visit http://gerrit.ovirt.org/13268 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I877eddc07a17f0bdd376df7bab8b19ffe52f72ba Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Mark Wu wudxw@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
Mark Wu has posted comments on this change.
Change subject: NetReload: Moved addNetwork logic to the configurator ......................................................................
Patch Set 2:
@Antoni, This patch was rebased unintentionally when I update http://gerrit.ovirt.org/#/c/11358/. I am sorry for that. I will continue to review this patch.
-- To view, visit http://gerrit.ovirt.org/13268 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I877eddc07a17f0bdd376df7bab8b19ffe52f72ba Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Mark Wu wudxw@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: NetReload: Moved addNetwork logic to the configurator ......................................................................
Patch Set 3:
Build Started http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/1868/ (1/2)
-- To view, visit http://gerrit.ovirt.org/13268 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I877eddc07a17f0bdd376df7bab8b19ffe52f72ba Gerrit-PatchSet: 3 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Mark Wu wudxw@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: NetReload: Moved addNetwork logic to the configurator ......................................................................
Patch Set 3:
Build Started http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/1919/ (2/2)
-- To view, visit http://gerrit.ovirt.org/13268 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I877eddc07a17f0bdd376df7bab8b19ffe52f72ba Gerrit-PatchSet: 3 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Mark Wu wudxw@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: NetReload: Moved addNetwork logic to the configurator ......................................................................
Patch Set 3:
Build Successful
http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/1868/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/1919/ : SUCCESS
-- To view, visit http://gerrit.ovirt.org/13268 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I877eddc07a17f0bdd376df7bab8b19ffe52f72ba Gerrit-PatchSet: 3 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Mark Wu wudxw@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
Dan Kenigsberg has posted comments on this change.
Change subject: NetReload: Moved addNetwork logic to the configurator ......................................................................
Patch Set 3: I would prefer that you didn't submit this
(6 inline comments)
.................................................... Commit Message Line 12: configureBridge, configureVlan, configureBond and configureNic Line 13: after this patch have to take care of the underlying devices Line 14: explicitly in the configurator module. However, the underlying Line 15: device handling will be abstracted to the network models in a Line 16: future patch. Thus, the code of configureBond for IfcfgConfigurator IfcfgConfigurator was renamed. Line 17: is gonna be something like: Line 18: Line 19: self.configWriter.addBonding(params) Line 20: for slave in bond.slaves:
.................................................... File vdsm/configNetwork.py Line 292: if configWriter is None: Line 293: configWriter = ConfigWriter() Line 294: configurator = Ifcfg(configWriter) Line 295: Line 296: async = utils.tobool(options.get('blockingdhcp')) and \ double negation confuses me.
if we have 'dhcp' and 'blockingdhcp', we need to be synchronous, and not do the nasty async hack. Line 297: options.get('bootproto') == 'dhcp' Line 298: Line 299: # take down nics that need to be changed Line 300: vlanedIfaces = [v['iface'] for v in _netinfo.vlans.values()]
.................................................... File vdsm/netconf/ifcfg.py Line 41: class Ifcfg(object): Line 42: # TODO: Do all the configWriter interaction from here. Line 43: def __init__(self, configWriter=None): Line 44: self.configWriter = configWriter Line 45: self.libvirtAdded = [] should it be public? does the order matter? I suspect
self._libvirtAdded = set()
would be better. Line 46: Line 47: def begin(self): Line 48: if self.configWriter is None: Line 49: self.configWriter = ConfigWriter()
Line 51: Line 52: def rollback(self): Line 53: if self.configWriter: Line 54: self.configWriter.restoreBackups() Line 55: # TODO: Add a try except with logging, but not raising. Sorry, I lack the context to understand this TODO. Would you elaborate? Line 56: for network in self.libvirtAdded: Line 57: self.configWriter.removeLibvirtNetwork(network) Line 58: Line 59: self.configWriter = None
Line 111: if network: Line 112: self.configWriter.createLibvirtNetwork(network, False, iface) Line 113: return iface Line 114: Line 115: def configureBond(self, network, bonding=None, nics=None, ipaddr=None, bonding=None ? who would want such a default? Line 116: netmask=None, mtu=None, gateway=None, bridge=None, Line 117: bondingOptions=None, async=False, **options): Line 118: mtu = self.configWriter.getMaxMtu(nics, mtu) Line 119: self.configWriter.addBonding(bonding, bridge=bridge,
Line 120: bondingOptions=bondingOptions, Line 121: mtu=mtu, ipaddr=ipaddr, Line 122: netmask=netmask, gateway=gateway, Line 123: **options) Line 124: options['bootproto'] = None wouldn't it be prettier to make bootproto a named argument? I do see why it should be hidden in **options. Line 125: for nic in nics: Line 126: self.configureNic(None, nic, bonding=bonding, mtu=mtu, **options) Line 127: Line 128: ifup(bonding, async)
-- To view, visit http://gerrit.ovirt.org/13268 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I877eddc07a17f0bdd376df7bab8b19ffe52f72ba Gerrit-PatchSet: 3 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Mark Wu wudxw@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: NetReload: Moved addNetwork logic to the configurator ......................................................................
Patch Set 4:
Build Started http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/1990/ (1/2)
-- To view, visit http://gerrit.ovirt.org/13268 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I877eddc07a17f0bdd376df7bab8b19ffe52f72ba Gerrit-PatchSet: 4 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Mark Wu wudxw@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: NetReload: Moved addNetwork logic to the configurator ......................................................................
Patch Set 4:
Build Started http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/1934/ (2/2)
-- To view, visit http://gerrit.ovirt.org/13268 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I877eddc07a17f0bdd376df7bab8b19ffe52f72ba Gerrit-PatchSet: 4 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Mark Wu wudxw@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: NetReload: Moved addNetwork logic to the configurator ......................................................................
Patch Set 4:
Build Successful
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/1990/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/1934/ : SUCCESS
-- To view, visit http://gerrit.ovirt.org/13268 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I877eddc07a17f0bdd376df7bab8b19ffe52f72ba Gerrit-PatchSet: 4 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Mark Wu wudxw@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: NetReload: Moved addNetwork logic to the configurator ......................................................................
Patch Set 5:
Build Started http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/1935/ (1/2)
-- To view, visit http://gerrit.ovirt.org/13268 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I877eddc07a17f0bdd376df7bab8b19ffe52f72ba Gerrit-PatchSet: 5 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Mark Wu wudxw@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: NetReload: Moved addNetwork logic to the configurator ......................................................................
Patch Set 5:
Build Started http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/1991/ (2/2)
-- To view, visit http://gerrit.ovirt.org/13268 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I877eddc07a17f0bdd376df7bab8b19ffe52f72ba Gerrit-PatchSet: 5 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Mark Wu wudxw@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
Antoni Segura Puimedon has posted comments on this change.
Change subject: NetReload: Moved addNetwork logic to the configurator ......................................................................
Patch Set 3: (6 inline comments)
.................................................... Commit Message Line 12: configureBridge, configureVlan, configureBond and configureNic Line 13: after this patch have to take care of the underlying devices Line 14: explicitly in the configurator module. However, the underlying Line 15: device handling will be abstracted to the network models in a Line 16: future patch. Thus, the code of configureBond for IfcfgConfigurator Done Line 17: is gonna be something like: Line 18: Line 19: self.configWriter.addBonding(params) Line 20: for slave in bond.slaves:
.................................................... File vdsm/configNetwork.py Line 292: if configWriter is None: Line 293: configWriter = ConfigWriter() Line 294: configurator = Ifcfg(configWriter) Line 295: Line 296: async = utils.tobool(options.get('blockingdhcp')) and \ Done Line 297: options.get('bootproto') == 'dhcp' Line 298: Line 299: # take down nics that need to be changed Line 300: vlanedIfaces = [v['iface'] for v in _netinfo.vlans.values()]
.................................................... File vdsm/netconf/ifcfg.py Line 41: class Ifcfg(object): Line 42: # TODO: Do all the configWriter interaction from here. Line 43: def __init__(self, configWriter=None): Line 44: self.configWriter = configWriter Line 45: self.libvirtAdded = [] Done Line 46: Line 47: def begin(self): Line 48: if self.configWriter is None: Line 49: self.configWriter = ConfigWriter()
Line 51: Line 52: def rollback(self): Line 53: if self.configWriter: Line 54: self.configWriter.restoreBackups() Line 55: # TODO: Add a try except with logging, but not raising. Simply to log errors in removing the added networks. Will update the message. Line 56: for network in self.libvirtAdded: Line 57: self.configWriter.removeLibvirtNetwork(network) Line 58: Line 59: self.configWriter = None
Line 111: if network: Line 112: self.configWriter.createLibvirtNetwork(network, False, iface) Line 113: return iface Line 114: Line 115: def configureBond(self, network, bonding=None, nics=None, ipaddr=None, Done Line 116: netmask=None, mtu=None, gateway=None, bridge=None, Line 117: bondingOptions=None, async=False, **options): Line 118: mtu = self.configWriter.getMaxMtu(nics, mtu) Line 119: self.configWriter.addBonding(bonding, bridge=bridge,
Line 120: bondingOptions=bondingOptions, Line 121: mtu=mtu, ipaddr=ipaddr, Line 122: netmask=netmask, gateway=gateway, Line 123: **options) Line 124: options['bootproto'] = None Done Line 125: for nic in nics: Line 126: self.configureNic(None, nic, bonding=bonding, mtu=mtu, **options) Line 127: Line 128: ifup(bonding, async)
-- To view, visit http://gerrit.ovirt.org/13268 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I877eddc07a17f0bdd376df7bab8b19ffe52f72ba Gerrit-PatchSet: 3 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Mark Wu wudxw@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: NetReload: Moved addNetwork logic to the configurator ......................................................................
Patch Set 5:
Build Successful
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/1991/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/1935/ : SUCCESS
-- To view, visit http://gerrit.ovirt.org/13268 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I877eddc07a17f0bdd376df7bab8b19ffe52f72ba Gerrit-PatchSet: 5 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Mark Wu wudxw@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
Dan Kenigsberg has posted comments on this change.
Change subject: NetReload: Moved addNetwork logic to the configurator ......................................................................
Patch Set 5: I would prefer that you didn't submit this
(1 inline comment)
a minor comment remains.
.................................................... File vdsm/netconf/ifcfg.py Line 116: if network: Line 117: self.configWriter.createLibvirtNetwork(network, False, iface) Line 118: return iface Line 119: Line 120: def configureBond(self, network, bonding, nics=None, ipaddr=None, nics=None is not a good default, too. I do not see it being used ever. Line 121: netmask=None, mtu=None, gateway=None, bridge=None, Line 122: bondingOptions=None, async=False, bootproto=None, Line 123: **options): Line 124: mtu = self.configWriter.getMaxMtu(nics, mtu)
-- To view, visit http://gerrit.ovirt.org/13268 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I877eddc07a17f0bdd376df7bab8b19ffe52f72ba Gerrit-PatchSet: 5 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Mark Wu wudxw@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
Antoni Segura Puimedon has posted comments on this change.
Change subject: NetReload: Moved addNetwork logic to the configurator ......................................................................
Patch Set 5: (1 inline comment)
.................................................... File vdsm/netconf/ifcfg.py Line 116: if network: Line 117: self.configWriter.createLibvirtNetwork(network, False, iface) Line 118: return iface Line 119: Line 120: def configureBond(self, network, bonding, nics=None, ipaddr=None, Done Line 121: netmask=None, mtu=None, gateway=None, bridge=None, Line 122: bondingOptions=None, async=False, bootproto=None, Line 123: **options): Line 124: mtu = self.configWriter.getMaxMtu(nics, mtu)
-- To view, visit http://gerrit.ovirt.org/13268 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I877eddc07a17f0bdd376df7bab8b19ffe52f72ba Gerrit-PatchSet: 5 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Mark Wu wudxw@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: NetReload: Moved addNetwork logic to the configurator ......................................................................
Patch Set 6:
Build Started http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/2008/ (1/2)
-- To view, visit http://gerrit.ovirt.org/13268 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I877eddc07a17f0bdd376df7bab8b19ffe52f72ba Gerrit-PatchSet: 6 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Mark Wu wudxw@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: NetReload: Moved addNetwork logic to the configurator ......................................................................
Patch Set 6:
Build Started http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/1952/ (2/2)
-- To view, visit http://gerrit.ovirt.org/13268 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I877eddc07a17f0bdd376df7bab8b19ffe52f72ba Gerrit-PatchSet: 6 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Mark Wu wudxw@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: NetReload: Moved addNetwork logic to the configurator ......................................................................
Patch Set 6:
Build Successful
http://jenkins.ovirt.org/job/vdsm_unit_tests_gerrit/2008/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/1952/ : SUCCESS
-- To view, visit http://gerrit.ovirt.org/13268 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I877eddc07a17f0bdd376df7bab8b19ffe52f72ba Gerrit-PatchSet: 6 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Mark Wu wudxw@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
Dan Kenigsberg has posted comments on this change.
Change subject: NetReload: Moved addNetwork logic to the configurator ......................................................................
Patch Set 6: Looks good to me, approved
Thanks!
-- To view, visit http://gerrit.ovirt.org/13268 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I877eddc07a17f0bdd376df7bab8b19ffe52f72ba Gerrit-PatchSet: 6 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Mark Wu wudxw@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
Antoni Segura Puimedon has posted comments on this change.
Change subject: NetReload: Moved addNetwork logic to the configurator ......................................................................
Patch Set 6: Verified
-- To view, visit http://gerrit.ovirt.org/13268 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I877eddc07a17f0bdd376df7bab8b19ffe52f72ba Gerrit-PatchSet: 6 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Mark Wu wudxw@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
Dan Kenigsberg has submitted this change and it was merged.
Change subject: NetReload: Moved addNetwork logic to the configurator ......................................................................
NetReload: Moved addNetwork logic to the configurator
This change starts moving the logic of configNetwork API endpoints towards the configurators.
configureBridge, configureVlan, configureBond and configureNic after this patch have to take care of the underlying devices explicitly in the configurator modules. However, the underlying device handling will be abstracted to the network models in a future patch. Thus, the code of configureBond for any configurator such as Ifcfg is gonna be something like:
self.configWriter.addBonding(params) for slave in bond.slaves: slave.configure(params)
Change-Id: I877eddc07a17f0bdd376df7bab8b19ffe52f72ba Signed-off-by: Antoni S. Puimedon asegurap@redhat.com --- M vdsm/configNetwork.py M vdsm/netconf/ifcfg.py 2 files changed, 128 insertions(+), 74 deletions(-)
Approvals: Antoni Segura Puimedon: Verified Dan Kenigsberg: Looks good to me, approved
-- To view, visit http://gerrit.ovirt.org/13268 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: merged Gerrit-Change-Id: I877eddc07a17f0bdd376df7bab8b19ffe52f72ba Gerrit-PatchSet: 6 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: Dan Kenigsberg danken@redhat.com Gerrit-Reviewer: Mark Wu wudxw@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
vdsm-patches@lists.fedorahosted.org