Antoni Segura Puimedon has uploaded a new change for review.
Change subject: Fix flake8 warnings for network code. ......................................................................
Fix flake8 warnings for network code.
This patch fixes flake8 complaints on the code related to networking and libvirtvm.
Change-Id: I59cd4d8bb41c1ce71b91b45ff7fe2f10f25eb577 Signed-off-by: Antoni S. Puimedon asegurap@redhat.com --- M tests/configNetworkTests.py M tests/libvirtvmTests.py M tests/tcTests.py M vdsm/configNetwork.py M vdsm/libvirtvm.py M vdsm/netinfo.py 6 files changed, 218 insertions(+), 235 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/46/9846/1
diff --git a/tests/configNetworkTests.py b/tests/configNetworkTests.py index 5f7cce4..07291db 100644 --- a/tests/configNetworkTests.py +++ b/tests/configNetworkTests.py @@ -189,37 +189,31 @@ @MonkeyPatch(netinfo, 'networks', _fakeNetworks) def testAddNetworkValidation(self): _netinfo = { - 'networks': { - 'fakent': {'iface': 'fakeint', 'bridged': False}, - 'fakebrnet': {'iface': 'fakebr', 'bridged': True, 'ports': - ['eth0', 'eth1']}, - 'fakebrnet1': {'iface': 'fakebr1', 'bridged': True, - 'ports': ['bond00']}, - 'fakebrnet2': {'iface': 'fakebr2', 'bridged': True, - 'ports': ['eth7.1']}, - 'fakebrnet3': {'iface': 'eth8', 'bridged': False} - }, - 'vlans': { - 'eth3.2': { - 'iface': 'eth3', - 'addr': '10.10.10.10', - 'netmask': '255.255.0.0', - 'mtu': 1500 - }, - 'eth7.1': { - 'iface': 'eth7', - 'addr': '192.168.100.1', - 'netmask': '255.255.255.0', - 'mtu': 1500 - } - }, - 'nics': ['eth0', 'eth1', 'eth2', 'eth3', 'eth4', 'eth5', - 'eth6', 'eth7', 'eth8', 'eth9', 'eth10'], - 'bondings': { - 'bond00': { - 'slaves': ['eth5', 'eth6'] - } - } + 'networks': { + 'fakent': {'iface': 'fakeint', 'bridged': False}, + 'fakebrnet': {'iface': 'fakebr', 'bridged': True, + 'ports': ['eth0', 'eth1']}, + 'fakebrnet1': {'iface': 'fakebr1', 'bridged': True, + 'ports': ['bond00']}, + 'fakebrnet2': {'iface': 'fakebr2', 'bridged': True, + 'ports': ['eth7.1']}, + 'fakebrnet3': {'iface': 'eth8', 'bridged': False} + }, + 'vlans': { + 'eth3.2': {'iface': 'eth3', + 'addr': '10.10.10.10', + 'netmask': '255.255.0.0', + 'mtu': 1500 + }, + 'eth7.1': {'iface': 'eth7', + 'addr': '192.168.100.1', + 'netmask': '255.255.255.0', + 'mtu': 1500 + } + }, + 'nics': ['eth0', 'eth1', 'eth2', 'eth3', 'eth4', 'eth5', 'eth6', + 'eth7', 'eth8', 'eth9', 'eth10'], + 'bondings': {'bond00': {'slaves': ['eth5', 'eth6']}} }
netinfoIns = netinfo.NetInfo(_netinfo) @@ -314,12 +308,11 @@ TestCaseBase.__init__(self, *args, **kwargs) self._tempdir = tempfile.mkdtemp() self._files = tuple((os.path.join(self._tempdir, bn), init, makeDirty) - for bn, init, makeDirty in - (('ifcfg-eth0', self.INITIAL_CONTENT, True), - ('ifcfg-eth1', None, True), - ('ifcfg-eth2', None, False), - ('ifcfg-eth3', self.INITIAL_CONTENT, False), - )) + for bn, init, makeDirty in + (('ifcfg-eth0', self.INITIAL_CONTENT, True), + ('ifcfg-eth1', None, True), + ('ifcfg-eth2', None, False), + ('ifcfg-eth3', self.INITIAL_CONTENT, False),))
def __del__(self): shutil.rmtree(self._tempdir) diff --git a/tests/libvirtvmTests.py b/tests/libvirtvmTests.py index 4ed7318..4bd3a77 100644 --- a/tests/libvirtvmTests.py +++ b/tests/libvirtvmTests.py @@ -43,7 +43,7 @@ else: elem = ET.fromstring(element.toprettyxml()) converted = re.sub(' />', '/>', - ET.tostring(elem.find("./%s" % path))) + ET.tostring(elem.find("./%s" % path))) self.assertEqual(re.sub('\n\s*', ' ', converted).strip(' '), re.sub('\n\s*', ' ', expectedXML).strip(' '))
@@ -370,7 +370,7 @@ vmConfs = [{}, {'custom': {'viodiskcache': 'writethrough'}}, {}]
for (devConf, xml, blockDev, vmConf) in \ - zip(devConfs, expectedXMLs, blockDevs, vmConfs): + zip(devConfs, expectedXMLs, blockDevs, vmConfs): drive = libvirtvm.Drive(vmConf, self.log, **devConf) # Patch Drive.blockDev to skip the block device checking. drive._blockDev = blockDev diff --git a/tests/tcTests.py b/tests/tcTests.py index dee8c5b..1983ea1 100644 --- a/tests/tcTests.py +++ b/tests/tcTests.py @@ -96,7 +96,7 @@ def addDevice(self): self._cloneDevice = open('/dev/net/tun', 'r+b') ifr = struct.pack('16sH', self.devName, self._IFF_TAP | - self._IFF_NO_PI) + self._IFF_NO_PI) fcntl.ioctl(self._cloneDevice, self._TUNSETIFF, ifr) self._ifUp()
@@ -106,7 +106,7 @@
def startListener(self, icmp): self._deviceListener = Process(target=_listenOnDevice, - args=(self._cloneDevice.fileno(), icmp)) + args=(self._cloneDevice.fileno(), icmp)) self._deviceListener.start()
def isListenerAlive(self): @@ -131,15 +131,15 @@ dev.addDevice() except: raise SkipTest("'brctl' has failed. Do you have bride-utils " - "installed?") + "installed?")
null = open("/dev/null", "a") try: check_call([EXT_TC, 'qdisc', 'add', 'dev', dev.devName, 'ingress'], - stderr=null) + stderr=null) except: raise SkipTest("'tc' has failed. Do you have Traffic Control kernel " - "modules installed?") + "modules installed?") finally: null.close() dev.delDevice() @@ -157,20 +157,20 @@ self._bridge.delDevice()
def _showQdisc(self): - popen = Popen([EXT_TC, "qdisc", "show", "dev", - self._bridge.devName], stdout=PIPE) + popen = Popen([EXT_TC, "qdisc", "show", "dev", self._bridge.devName], + stdout=PIPE) return popen.stdout.read()
def _addIngress(self): tc.qdisc_replace_ingress(self._bridge.devName) self.assertTrue("qdisc ingress" in self._showQdisc(), - "Could not add an ingress qdisc to the device.") + "Could not add an ingress qdisc to the device.")
def testToggleIngress(self): self._addIngress() tc.qdisc_del(self._bridge.devName, 'ingress') self.assertFalse("qdisc ingress" in self._showQdisc(), - "Could not remove an ingress qdisc from the device.") + "Could not remove an ingress qdisc from the device.")
def testQdiscsOfDevice(self): self._addIngress() @@ -185,15 +185,17 @@ def testTogglePromisc(self): tc.set_promisc(self._bridge.devName, True) self.assertTrue(ethtool.get_flags(self._bridge.devName) & - ethtool.IFF_PROMISC, "Could not enable promiscuous mode.") + ethtool.IFF_PROMISC, + "Could not enable promiscuous mode.")
tc.set_promisc(self._bridge.devName, False) self.assertFalse(ethtool.get_flags(self._bridge.devName) & - ethtool.IFF_PROMISC, "Could not disable promiscuous mode.") + ethtool.IFF_PROMISC, + "Could not disable promiscuous mode.")
def testException(self): self.assertRaises(tc.TrafficControlException, tc.qdisc_del, - self._bridge.devName + "A", 'ingress') + self._bridge.devName + "A", 'ingress')
class TestFilters(TestCaseBase): @@ -202,13 +204,13 @@ path = os.path.join(dirName, "tc_filter_show.out") out = file(path).read() PARSED_FILTERS = ( - tc.Filter(prio='49149', handle='803::800', - actions=[tc.MirredAction(target='tap1')]), - tc.Filter(prio='49150', handle='802::800', - actions=[tc.MirredAction(target='tap2')]), - tc.Filter(prio='49152', handle='800::800', - actions=[tc.MirredAction(target='target'), - tc.MirredAction(target='target2')])) + tc.Filter(prio='49149', handle='803::800', + actions=[tc.MirredAction(target='tap1')]), + tc.Filter(prio='49150', handle='802::800', + actions=[tc.MirredAction(target='tap2')]), + tc.Filter(prio='49152', handle='800::800', + actions=[tc.MirredAction(target='target'), + tc.MirredAction(target='target2')])) self.assertEqual(tuple(tc.filters('bridge', 'parent', out=out)), PARSED_FILTERS)
@@ -228,9 +230,9 @@
#just an echo request from 192.168.0.52 to 192.168.0.3 _ICMP = unhexlify("001cc0d044dc00215c4d4275080045000054000040004001b921c0a" - "80034c0a800030800dd200c1400016b52085000000000d7540500000000001011" - "12131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f30313" - "23334353637") + "80034c0a800030800dd200c1400016b52085000000000d754050000" + "000000101112131415161718191a1b1c1d1e1f20212223242526272" + "8292a2b2c2d2e2f3031323334353637")
_tap0 = _Tap() _tap1 = _Tap() @@ -274,12 +276,12 @@
def testMirroring(self): tc.setPortMirroring(self._bridge0.devName, self._bridge1.devName) - self.assertTrue(self._sendPing(), " Bridge received no mirrored ping " - "requests.") + self.assertTrue(self._sendPing(), "Bridge received no mirrored ping " + "requests.")
tc.unsetPortMirroring(self._bridge0.devName, self._bridge1.devName) - self.assertFalse(self._sendPing(), " Bridge received mirrored ping " - "requests, but mirroring is unset.") + self.assertFalse(self._sendPing(), "Bridge received mirrored ping " + "requests, but mirroring is unset.")
def testMirroringWithDistraction(self): "setting another mirror action should not obstract the first one" diff --git a/vdsm/configNetwork.py b/vdsm/configNetwork.py index 53debfa..4b0c9ce 100755 --- a/vdsm/configNetwork.py +++ b/vdsm/configNetwork.py @@ -192,9 +192,10 @@ <bridge name='%s'/></network>''' % (escape(netName), escape(network)) else: - netXml = '''<network><name>%s</name><forward mode='passthrough'> - <interface dev='%s'/></forward></network>''' % \ - (escape(netName), escape(iface)) + netXml = ( + '''<network><name>%s</name><forward mode='passthrough'>''' + '''<interface dev='%s'/></forward></network>''' % + (escape(netName), escape(iface))) if not skipBackup: self._networkBackup(network) self._createNetwork(netXml) @@ -265,8 +266,8 @@ content = cls.DELETED_HEADER + '\n' logging.debug("backing up network %s: %s", network, content)
- cls.writeBackupFile(netinfo.NET_LOGICALNET_CONF_BACK_DIR, - network, content) + cls.writeBackupFile(netinfo.NET_LOGICALNET_CONF_BACK_DIR, network, + content)
def restoreAtomicNetworkBackup(self): logging.info("Rolling back logical networks configuration " @@ -312,8 +313,8 @@ for confFile, content in self._backups.iteritems(): if content is None: utils.rmFile(confFile) - logging.debug( - 'Removing empty configuration backup %s', confFile) + logging.debug('Removing empty configuration backup %s', + confFile) else: open(confFile, 'w').write(content) logging.info('Restored %s', confFile) @@ -323,7 +324,7 @@ """ Persistently backup ifcfg-* config files """ if os.path.exists('/usr/libexec/ovirt-functions'): execCmd([constants.EXT_SH, '/usr/libexec/ovirt-functions', - 'unmount_config', filename]) + 'unmount_config', filename]) logging.debug("unmounted %s using ovirt", filename)
(dummy, basename) = os.path.split(filename) @@ -394,7 +395,7 @@ selinux.restorecon(fileName) except: logging.debug('ignoring restorecon error in case ' - 'SElinux is disabled', exc_info=True) + 'SElinux is disabled', exc_info=True)
def _createConfFile(self, conf, name, ipaddr=None, netmask=None, gateway=None, bootproto=None, mtu=None, onboot='yes', @@ -431,7 +432,8 @@ self.writeConfFile(self.NET_CONF_PREF + name, cfg)
def addBridge(self, name, ipaddr=None, netmask=None, mtu=None, - gateway=None, bootproto=None, delay='0', onboot='yes', **kwargs): + gateway=None, bootproto=None, delay='0', onboot='yes', + **kwargs): """ Create ifcfg-* file with proper fields for bridge """ conf = 'TYPE=Bridge\nDELAY=%s\n' % pipes.quote(delay) self._createConfFile(conf, name, ipaddr, netmask, gateway, @@ -484,8 +486,8 @@ onboot='yes', **kwargs): """ Create ifcfg-* file with proper fields for NIC """ _netinfo = netinfo.NetInfo() - hwaddr = _netinfo.nics[nic].get('permhwaddr') or \ - _netinfo.nics[nic]['hwaddr'] + hwaddr = (_netinfo.nics[nic].get('permhwaddr') or + _netinfo.nics[nic]['hwaddr'])
conf = 'HWADDR=%s\n' % pipes.quote(hwaddr) if bridge: @@ -727,11 +729,11 @@ key, value = option.split('=') if not os.path.exists( '/sys/class/net/%(bonding)s/bonding/%(key)s' % locals()): - raise ConfigNetworkError(ne.ERR_BAD_BONDING, - "%r is not a valid bonding option" % key) + raise ConfigNetworkError(ne.ERR_BAD_BONDING, '%r is not a ' + 'valid bonding option' % key) except ValueError: - raise ConfigNetworkError(ne.ERR_BAD_BONDING, - "Error parsing bonding options: %r" % bondingOptions) + raise ConfigNetworkError(ne.ERR_BAD_BONDING, 'Error parsing bonding ' + 'options: %r' % bondingOptions)
def validateVlanId(vlan): @@ -758,9 +760,9 @@ # is a non-VLANed network over our iface for (iface_net, iface_vlan) in ifaces: if iface_vlan is None: - raise ConfigNetworkError(ne.ERR_BAD_PARAMS, - "interface %r already member of network %r" % - (iface, iface_net)) + raise ConfigNetworkError(ne.ERR_BAD_PARAMS, 'interface %r ' + 'already member of network %r' % + (iface, iface_net))
ifaces_bridgeless = tuple(ni.getBridgelessNetworksAndVlansForIface(iface)) ifaces_bridged = tuple(ni.getBridgedNetworksAndVlansForIface(iface)) @@ -780,9 +782,8 @@ # Want to add non-VLANed bridged network, # check whether interface is empty elif ifaces_bridged or ifaces_bridgeless: - raise ConfigNetworkError(ne.ERR_BAD_PARAMS, - "interface %r already has networks" % - (iface)) + raise ConfigNetworkError(ne.ERR_BAD_PARAMS, 'interface %r already ' + 'has networks' % (iface))
def _addNetworkValidation(_netinfo, network, vlan, bonding, nics, ipaddr, @@ -794,8 +795,8 @@ if bonding and implicitBonding: pass elif (vlan or bonding) and not nics: - raise ConfigNetworkError(ne.ERR_BAD_PARAMS, - 'vlan/bonding definition requires nics. got: %r' % (nics,)) + raise ConfigNetworkError(ne.ERR_BAD_PARAMS, 'vlan/bonding definition ' + 'requires nics. got: %r' % (nics,))
# Check bridge if bridged: @@ -811,8 +812,8 @@ # Check ip, netmask, gateway if ipaddr: if not netmask: - raise ConfigNetworkError(ne.ERR_BAD_ADDR, - "Must specify netmask to configure ip for network") + raise ConfigNetworkError(ne.ERR_BAD_ADDR, 'Must specify netmask to' + ' configure ip for network') validateIpAddress(ipaddr) validateNetmask(netmask) if gateway: @@ -820,7 +821,7 @@ else: if netmask or gateway: raise ConfigNetworkError(ne.ERR_BAD_ADDR, - "Specified netmask or gateway but not ip") + 'Specified netmask or gateway but not ip')
# Check bonding if bonding: @@ -831,10 +832,10 @@ _validateInterNetworkCompatibility(_netinfo, vlan, bonding, bridged) elif bondingOptions: raise ConfigNetworkError(ne.ERR_BAD_BONDING, - "Bonding options specified without bonding") + 'Bonding options specified without bonding') elif len(nics) > 1: raise ConfigNetworkError(ne.ERR_BAD_BONDING, - "Multiple nics require a bonding device") + 'Multiple nics require a bonding device')
# Check nics for nic in nics: @@ -846,21 +847,21 @@ bondingForNics = _netinfo.getBondingForNic(nic) if bondingForNics and bondingForNics != bonding: raise ConfigNetworkError(ne.ERR_USED_NIC, - "nic %s already enslaved to %s" % - (nic, bondingForNics)) + 'nic %s already enslaved to %s' % + (nic, bondingForNics))
# Make sure nics don't used by vlans if bond requested if bonding: vlansForNic = tuple(_netinfo.getVlansForIface(nic)) if vlansForNic: raise ConfigNetworkError(ne.ERR_USED_NIC, - "nic %s already used by vlans %s" % - (nic, vlansForNic)) + 'nic %s already used by vlans %s' % + (nic, vlansForNic)) networksForNic = tuple(_netinfo.getNetworksForIface(nic)) if networksForNic: raise ConfigNetworkError(ne.ERR_USED_NIC, - "nic %s already used by networks %s" % - (nic, networksForNic)) + 'nic %s already used by networks %s' % + (nic, networksForNic)) else: _validateInterNetworkCompatibility(_netinfo, vlan, nic, bridged)
@@ -888,10 +889,11 @@ # Validation if not utils.tobool(force): logging.debug('validating network...') - _addNetworkValidation(_netinfo, network=network, - vlan=vlan, bonding=bonding, nics=nics, ipaddr=ipaddr, - netmask=netmask, gateway=gateway, bondingOptions=bondingOptions, - bridged=bridged, **options) + _addNetworkValidation(_netinfo, network=network, vlan=vlan, + bonding=bonding, nics=nics, ipaddr=ipaddr, + netmask=netmask, gateway=gateway, + bondingOptions=bondingOptions, bridged=bridged, + **options)
logging.info("Adding network %s with vlan=%s, bonding=%s, nics=%s," " bondingOptions=%s, mtu=%s, bridged=%s, options=%s", @@ -961,10 +963,9 @@
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) + 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: @@ -1003,8 +1004,8 @@ pass
if brifs: - raise ConfigNetworkError(ne.ERR_USED_BRIDGE, - 'bridge %s has interfaces %s connected' % (bridge, brifs)) + raise ConfigNetworkError(ne.ERR_USED_BRIDGE, 'bridge %s has interfaces' + ' %s connected' % (bridge, brifs))
def showNetwork(network): @@ -1052,9 +1053,9 @@ if network in netinfo.bridges(): configWriter.removeBridge(network) else: - raise ConfigNetworkError(ne.ERR_BAD_BRIDGE, - "Cannot delete network %r: It doesn't exist " - "in the system" % network) + raise ConfigNetworkError(ne.ERR_BAD_BRIDGE, "Cannot delete network" + " %r: It doesn't exist in the system" % + network)
if vlan: configWriter.removeVlan(vlan, bonding or nics[0]) @@ -1071,9 +1072,9 @@ if bonding: validateBondingName(bonding) if set(nics) != set(_netinfo.bondings[bonding]["slaves"]): - raise ConfigNetworkError(ne.ERR_BAD_NIC, - "delNetwork: %s are not all nics enslaved to %s" % - (nics, bonding)) + raise ConfigNetworkError(ne.ERR_BAD_NIC, 'delNetwork: %s are ' + 'not all nics enslaved to %s' % + (nics, bonding)) if vlan: validateVlanId(vlan) if bridged: @@ -1085,8 +1086,8 @@ # We need to gather NetInfo again to refresh networks info from libvirt. # The deleted bridge should never be up at this stage. if network in netinfo.NetInfo().networks: - raise ConfigNetworkError(ne.ERR_USED_BRIDGE, - "delNetwork: bridge %s still exists" % network) + raise ConfigNetworkError(ne.ERR_USED_BRIDGE, 'delNetwork: bridge %s ' + 'still exists' % network)
if network and bridged: configWriter.removeBridge(network) @@ -1163,8 +1164,8 @@ for network, networkAttrs in networks.iteritems(): if networkAttrs.get('remove', False): if set(networkAttrs) - set(['remove']): - raise ConfigNetworkError(ne.ERR_BAD_PARAMS, - "Cannot specify any attribute when removing") + raise ConfigNetworkError(ne.ERR_BAD_PARAMS, 'Cannot specify ' + 'any attribute when removing')
for bonding, bondingAttrs in bondings.iteritems(): validateBondingName(bonding) @@ -1173,8 +1174,8 @@
if bondingAttrs.get('remove', False): if bonding not in _netinfo.bondings: - raise ConfigNetworkError(ne.ERR_BAD_BONDING, - 'Cannot remove bonding %s: Doesn't exist' % bonding) + raise ConfigNetworkError(ne.ERR_BAD_BONDING, "Cannot remove " + "bonding %s: Doesn't exist" % bonding) continue
nics = bondingAttrs.get('nics', None) @@ -1348,7 +1349,7 @@ if bondings.get(d['bonding']): d['nics'] = bondings[d['bonding']]['nics'] d['bondingOptions'] = \ - bondings[d['bonding']].get('options', None) + bondings[d['bonding']].get('options', None) # we create a new bond if network in networksAdded: netsWithNewBonds.add(network) @@ -1357,7 +1358,7 @@ d['nics'] = _ni.bondings[d['bonding']]['slaves'] d['bondingOptions'] = \ _ni.bondings[d['bonding']]['cfg'].get( - 'BONDING_OPTS', None) + 'BONDING_OPTS', None) else: d['nics'] = [d.pop('nic')] d['force'] = force diff --git a/vdsm/libvirtvm.py b/vdsm/libvirtvm.py index 219e382..6063a84 100644 --- a/vdsm/libvirtvm.py +++ b/vdsm/libvirtvm.py @@ -86,36 +86,34 @@ self._vm = vm
self.highWrite = ( - utils.AdvancedStatsFunction( - self._highWrite, - config.getint('vars', 'vm_watermark_interval'))) + utils.AdvancedStatsFunction( + self._highWrite, + config.getint('vars', 'vm_watermark_interval'))) self.updateVolumes = ( - utils.AdvancedStatsFunction( - self._updateVolumes, - config.getint('irs', 'vol_size_sample_interval'))) + utils.AdvancedStatsFunction( + self._updateVolumes, + config.getint('irs', 'vol_size_sample_interval')))
self.sampleCpu = ( - utils.AdvancedStatsFunction( - self._sampleCpu, - config.getint('vars', 'vm_sample_cpu_interval'), - config.getint('vars', 'vm_sample_cpu_window'))) + utils.AdvancedStatsFunction( + self._sampleCpu, + config.getint('vars', 'vm_sample_cpu_interval'), + config.getint('vars', 'vm_sample_cpu_window'))) self.sampleDisk = ( - utils.AdvancedStatsFunction( - self._sampleDisk, - config.getint('vars', 'vm_sample_disk_interval'), - config.getint('vars', 'vm_sample_disk_window'))) + utils.AdvancedStatsFunction( + self._sampleDisk, + config.getint('vars', 'vm_sample_disk_interval'), + config.getint('vars', 'vm_sample_disk_window'))) self.sampleDiskLatency = ( - utils.AdvancedStatsFunction( - self._sampleDiskLatency, - config.getint('vars', - 'vm_sample_disk_latency_interval'), - config.getint('vars', - 'vm_sample_disk_latency_window'))) + utils.AdvancedStatsFunction( + self._sampleDiskLatency, + config.getint('vars', 'vm_sample_disk_latency_interval'), + config.getint('vars', 'vm_sample_disk_latency_window'))) self.sampleNet = ( - utils.AdvancedStatsFunction( - self._sampleNet, - config.getint('vars', 'vm_sample_net_interval'), - config.getint('vars', 'vm_sample_net_window'))) + utils.AdvancedStatsFunction( + self._sampleNet, + config.getint('vars', 'vm_sample_net_interval'), + config.getint('vars', 'vm_sample_net_window')))
self.addStatsFunction( self.highWrite, self.updateVolumes, self.sampleCpu, @@ -149,8 +147,9 @@
for vmDrive in self._vm._devices[vm.DISK_DEVICES]: if vmDrive.device == 'disk' and vmDrive.isVdsmImage(): - volSize = self._vm.cif.irs.getVolumeSize(vmDrive.domainID, - vmDrive.poolID, vmDrive.imageID, vmDrive.volumeID) + volSize = self._vm.cif.irs.getVolumeSize( + vmDrive.domainID, vmDrive.poolID, vmDrive.imageID, + vmDrive.volumeID)
if volSize['status']['code'] != 0: continue @@ -276,10 +275,10 @@ def _avgLatencyCalc(sData, eData): readLatency = (0 if not (eData['rd_operations'] - sData['rd_operations']) - else (eData['rd_total_times'] - - sData['rd_total_times']) / - (eData['rd_operations'] - - sData['rd_operations'])) + else (eData['rd_total_times'] - + sData['rd_total_times']) / + (eData['rd_operations'] - + sData['rd_operations'])) writeLatency = (0 if not (eData['wr_operations'] - sData['wr_operations']) else (eData['wr_total_times'] - @@ -430,10 +429,9 @@ dataProgress = calculateProgress(dataRemaining, dataTotal) memProgress = calculateProgress(memRemaining, memTotal)
- self._vm.log.info( - 'Migration Progress: %s seconds elapsed, ' - '%s%% of data processed, %s%% of mem processed' - % (timeElapsed / 1000, dataProgress, memProgress)) + self._vm.log.info('Migration Progress: %s seconds elapsed, %s%% of' + 'data processed, %s%% of mem processed' % + (timeElapsed / 1000, dataProgress, memProgress))
def stop(self): self._vm.log.debug('stopping migration monitor thread') @@ -501,7 +499,7 @@ self._vm._dom.migrateToURI2( duri, muri, None, libvirt.VIR_MIGRATE_LIVE | - libvirt.VIR_MIGRATE_PEER2PEER, + libvirt.VIR_MIGRATE_PEER2PEER, None, maxBandwidth) finally: t.cancel() @@ -714,7 +712,7 @@ """ if utils.tobool(self.conf.get('acpiEnable', 'true')): self.dom.appendChild(self.doc.createElement('features')) \ - .appendChild(self.doc.createElement('acpi')) + .appendChild(self.doc.createElement('acpi'))
def appendCpu(self): """ @@ -864,7 +862,7 @@ listen = self.doc.createElement('listen') listen.setAttribute('type', 'network') listen.setAttribute('network', netinfo.LIBVIRT_NET_PREFIX + - self.conf.get('displayNetwork')) + self.conf.get('displayNetwork')) graphics.appendChild(listen) else: graphics.setAttribute('listen', '0') @@ -1099,8 +1097,7 @@ for the next LV extension. """ return (self.volExtensionChunk + - ((self.apparentsize + constants.MEGAB - 1) / - constants.MEGAB)) + ((self.apparentsize + constants.MEGAB - 1) / constants.MEGAB))
@property def blockDev(self): @@ -1203,9 +1200,8 @@ diskelem.appendChild(driver) elif self.device == 'floppy': if (self.path and - not utils.getUserPermissions( - constants.QEMU_PROCESS_USER, - self.path)['write']): + not utils.getUserPermissions(constants.QEMU_PROCESS_USER, + self.path)['write']): diskelem.appendChild(doc.createElement('readonly'))
return diskelem @@ -1337,13 +1333,12 @@ domxml.appendFeatures() domxml.appendCpu() if utils.tobool(self.conf.get('vmchannel', 'true')): - domxml._appendAgentDevice( - self._guestSocketFile.decode('utf-8'), - _VMCHANNEL_DEVICE_NAME) + domxml._appendAgentDevice(self._guestSocketFile.decode('utf-8'), + _VMCHANNEL_DEVICE_NAME) if utils.tobool(self.conf.get('qgaEnable', 'true')): domxml._appendAgentDevice( - self._qemuguestSocketFile.decode('utf-8'), - _QEMU_GA_DEVICE_NAME) + self._qemuguestSocketFile.decode('utf-8'), + _QEMU_GA_DEVICE_NAME) domxml.appendInput() domxml.appendGraphics()
@@ -1421,9 +1416,8 @@ # So, run it after you have this info self._initVmStats() self.guestAgent = guestIF.GuestAgent( - self._guestSocketFile, - self.cif.channelListener, self.log, - connect=utils.tobool(self.conf.get('vmchannel', 'true'))) + self._guestSocketFile, self.cif.channelListener, self.log, + connect=utils.tobool(self.conf.get('vmchannel', 'true')))
self._guestCpuRunning = (self._dom.info()[0] == libvirt.VIR_DOMAIN_RUNNING) @@ -1503,8 +1497,8 @@ self.log.debug(domxml) if 'recover' in self.conf: self._dom = NotifyingVirDomain( - self._connection.lookupByUUIDString(self.id), - self._timeoutExperienced) + self._connection.lookupByUUIDString(self.id), + self._timeoutExperienced) # Reinitialize the merge statuses self._checkMerge() elif 'restoreState' in self.conf: @@ -1517,8 +1511,8 @@ self.cif.teardownVolumePath(self.conf['restoreState'])
self._dom = NotifyingVirDomain( - self._connection.lookupByUUIDString(self.id), - self._timeoutExperienced) + self._connection.lookupByUUIDString(self.id), + self._timeoutExperienced) else: flags = libvirt.VIR_DOMAIN_NONE if 'launchPaused' in self.conf: @@ -1526,8 +1520,8 @@ self.conf['pauseCode'] = 'NOERR' del self.conf['launchPaused'] self._dom = NotifyingVirDomain( - self._connection.createXML(domxml, flags), - self._timeoutExperienced) + self._connection.createXML(domxml, flags), + self._timeoutExperienced) if self._dom.UUIDString() != self.id: raise Exception('libvirt bug 603494') hooks.after_vm_start(self._dom.XMLDesc(0), self.conf) @@ -1578,7 +1572,7 @@ # In any case we need below rollback for all kind of failures. except Exception, e: self.log.error("setPortMirroring for network %s failed", - network, exc_info=True) + network, exc_info=True) nicParams['portMirroring'] = mirroredNetworks self.hotunplugNic({'nic': nicParams}) return {'status': @@ -1887,8 +1881,8 @@ # Would fail if migration isn't successful, # or restart vdsm if connection to libvirt was lost self._dom = NotifyingVirDomain( - self._connection.lookupByUUIDString(self.id), - self._timeoutExperienced) + self._connection.lookupByUUIDString(self.id), + self._timeoutExperienced) except Exception, e: # Improve description of exception if not self._incomingMigrationFinished.isSet(): @@ -2067,7 +2061,7 @@
try: newDrives[vmDevName]["path"] = \ - self.cif.prepareVolumePath(newDrives[vmDevName]) + self.cif.prepareVolumePath(newDrives[vmDevName]) except Exception: _rollbackDrives(newDrives) self.log.error("Unable to prepare the volume path " @@ -2211,9 +2205,8 @@
def mergeStatus(self): def _filterInternalInfo(mergeStatus): - return dict( - (k, v) for k, v in mergeStatus.iteritems() - if k not in ("path", "basePath")) + return dict((k, v) for k, v in mergeStatus.iteritems() + if k not in ("path", "basePath"))
mergeStatus = [_filterInternalInfo(x) for x in self.conf.get('liveMerge', [])] @@ -2440,8 +2433,7 @@
try: self._dom.updateDeviceFlags( - diskelem.toxml(), - libvirt.VIR_DOMAIN_DEVICE_MODIFY_FORCE) + diskelem.toxml(), libvirt.VIR_DOMAIN_DEVICE_MODIFY_FORCE) except: self.log.debug("updateDeviceFlags failed", exc_info=True) self.cif.teardownVolumePath(drivespec) @@ -2454,7 +2446,7 @@
def setTicket(self, otp, seconds, connAct, params): graphics = _domParseStr(self._dom.XMLDesc(0)).childNodes[0]. \ - getElementsByTagName('graphics')[0] + getElementsByTagName('graphics')[0] graphics.setAttribute('passwd', otp) if int(seconds) > 0: validto = time.strftime('%Y-%m-%dT%H:%M:%S', @@ -2470,14 +2462,13 @@ def _reviveTicket(self, newlife): """Revive an existing ticket, if it has expired or about to expire""" graphics = _domParseStr( - self._dom.XMLDesc(libvirt.VIR_DOMAIN_XML_SECURE)). \ - childNodes[0].getElementsByTagName('graphics')[0] + self._dom.XMLDesc(libvirt.VIR_DOMAIN_XML_SECURE)). \ + childNodes[0].getElementsByTagName('graphics')[0] validto = max(time.strptime(graphics.getAttribute('passwdValidTo'), '%Y-%m-%dT%H:%M:%S'), time.gmtime(time.time() + newlife)) graphics.setAttribute( - 'passwdValidTo', - time.strftime('%Y-%m-%dT%H:%M:%S', validto)) + 'passwdValidTo', time.strftime('%Y-%m-%dT%H:%M:%S', validto)) graphics.setAttribute('connected', 'keep') self._dom.updateDeviceFlags(graphics.toxml(), 0)
@@ -2528,7 +2519,7 @@ def _getUnderlyingVmInfo(self): self._lastXMLDesc = self._dom.XMLDesc(0) devxml = _domParseStr(self._lastXMLDesc).childNodes[0]. \ - getElementsByTagName('devices')[0] + getElementsByTagName('devices')[0] self._devXmlHash = str(hash(devxml.toxml()))
return self._lastXMLDesc @@ -2580,7 +2571,7 @@ if self._dom: try: self._dom.destroyFlags( - libvirt.VIR_DOMAIN_DESTROY_GRACEFUL) + libvirt.VIR_DOMAIN_DESTROY_GRACEFUL) except libvirt.libvirtError, e: if (e.get_error_code() == libvirt.VIR_ERR_OPERATION_FAILED): @@ -2640,7 +2631,7 @@ def _getBalloonInfo(self): for dev in self.conf['devices']: if dev['type'] == vm.BALLOON_DEVICES and \ - dev['specParams']['model'] != 'none': + dev['specParams']['model'] != 'none': max_mem = int(self.conf.get('memSize')) * 1024 cur_mem = dev.get('target', max_mem) return {'balloon_max': max_mem, 'balloon_cur': cur_mem} @@ -2671,7 +2662,7 @@ else: for dev in self.conf['devices']: if dev['type'] == vm.BALLOON_DEVICES and \ - dev['specParams']['model'] != 'none': + dev['specParams']['model'] != 'none': dev['target'] = target # persist the target value to make it consistent after recovery self.saveState() @@ -2707,7 +2698,7 @@ return False
devsxml = _domParseStr(self._lastXMLDesc).childNodes[0]. \ - getElementsByTagName('devices')[0] + getElementsByTagName('devices')[0]
for x in devsxml.childNodes: # Ignore empty nodes and devices without address @@ -2732,8 +2723,8 @@ Obtain controller devices info from libvirt. """ ctrlsxml = _domParseStr(self._lastXMLDesc).childNodes[0]. \ - getElementsByTagName('devices')[0]. \ - getElementsByTagName('controller') + getElementsByTagName('devices')[0]. \ + getElementsByTagName('controller') for x in ctrlsxml: # Ignore controller devices without address if not x.getElementsByTagName('address'): @@ -2779,8 +2770,8 @@ Obtain balloon device info from libvirt. """ balloonxml = _domParseStr(self._lastXMLDesc).childNodes[0]. \ - getElementsByTagName('devices')[0]. \ - getElementsByTagName('memballoon') + getElementsByTagName('devices')[0]. \ + getElementsByTagName('memballoon') for x in balloonxml: # Ignore balloon devices without address. if not x.getElementsByTagName('address'): @@ -2805,8 +2796,8 @@ Obtain watchdog device info from libvirt. """ watchdogxml = _domParseStr(self._lastXMLDesc).childNodes[0]. \ - getElementsByTagName('devices')[0]. \ - getElementsByTagName('watchdog') + getElementsByTagName('devices')[0]. \ + getElementsByTagName('watchdog') for x in watchdogxml:
# PCI watchdog has "address" different from ISA watchdog @@ -2830,8 +2821,7 @@ Obtain video devices info from libvirt. """ videosxml = _domParseStr(self._lastXMLDesc).childNodes[0]. \ - getElementsByTagName('devices')[0]. \ - getElementsByTagName('video') + getElementsByTagName('devices')[0].getElementsByTagName('video') for x in videosxml: alias = x.getElementsByTagName('alias')[0].getAttribute('name') # Get video card address @@ -2859,8 +2849,7 @@ Obtain sound devices info from libvirt. """ soundsxml = _domParseStr(self._lastXMLDesc).childNodes[0]. \ - getElementsByTagName('devices')[0]. \ - getElementsByTagName('sound') + getElementsByTagName('devices')[0].getElementsByTagName('sound') for x in soundsxml: alias = x.getElementsByTagName('alias')[0].getAttribute('name') # Get sound card address @@ -2888,8 +2877,7 @@ Obtain block devices info from libvirt. """ disksxml = _domParseStr(self._lastXMLDesc).childNodes[0]. \ - getElementsByTagName('devices')[0]. \ - getElementsByTagName('disk') + getElementsByTagName('devices')[0].getElementsByTagName('disk') # FIXME! We need to gather as much info as possible from the libvirt. # In the future we can return this real data to management instead of # vm's conf @@ -2954,7 +2942,7 @@ Obtain display port info from libvirt. """ graphics = _domParseStr(self._lastXMLDesc).childNodes[0]. \ - getElementsByTagName('graphics')[0] + getElementsByTagName('graphics')[0] port = graphics.getAttribute('port') if port: self.conf['displayPort'] = port @@ -2968,8 +2956,8 @@ """ # TODO use xpath instead of parseString (here and elsewhere) ifsxml = _domParseStr(self._lastXMLDesc).childNodes[0]. \ - getElementsByTagName('devices')[0]. \ - getElementsByTagName('interface') + getElementsByTagName('devices')[0]. \ + getElementsByTagName('interface') for x in ifsxml: devType = x.getAttribute('type') name = x.getElementsByTagName('target')[0].getAttribute('dev') @@ -3065,8 +3053,7 @@ self.log.debug('migration destination: waiting for VM creation') self._vmCreationEvent.wait() prepareTimeout = self._loadCorrectedTimeout( - config.getint('vars', 'migration_listener_timeout'), - doubler=5) + config.getint('vars', 'migration_listener_timeout'), doubler=5) self.log.debug('migration destination: waiting %ss ' 'for path preparation', prepareTimeout) self._pathsPreparedEvent.wait(prepareTimeout) diff --git a/vdsm/netinfo.py b/vdsm/netinfo.py index e2959e4..4935994 100644 --- a/vdsm/netinfo.py +++ b/vdsm/netinfo.py @@ -110,7 +110,7 @@
def slaves(bonding): return [b.split('/')[-1].split('_', 1)[-1] for b in - glob.glob('/sys/class/net/' + bonding + '/slave_*')] + glob.glob('/sys/class/net/' + bonding + '/slave_*')]
def ports(bridge): @@ -295,8 +295,8 @@ devname = netname try: d['networks'][netname] = {'ports': ports(devname), - 'stp': bridge_stp_state(devname), - 'cfg': getIfaceCfg(devname), } + 'stp': bridge_stp_state(devname), + 'cfg': getIfaceCfg(devname), } except OSError, e: # If the bridge reported by libvirt does not exist anymore, do # not report it, as this already assures that the bridge is not @@ -317,13 +317,13 @@ d['networks'][netname]['interface'] = devname
try: - d['networks'][netname].update({ - 'iface': devname, - 'bridged': nets[netname]['bridged'], - 'addr': getaddr(devname), - 'netmask': getnetmask(devname), - 'gateway': routes.get(devname, '0.0.0.0'), - 'mtu': getMtu(devname), }) + d['networks'][netname].update( + {'iface': devname, + 'bridged': nets[netname]['bridged'], + 'addr': getaddr(devname), + 'netmask': getnetmask(devname), + 'gateway': routes.get(devname, '0.0.0.0'), + 'mtu': getMtu(devname), }) except OSError, e: if e.errno == errno.ENOENT: logging.info('Obtaining info for net %s.', devname, @@ -352,25 +352,25 @@ 'mtu': getMtu(nic), 'cfg': getIfaceCfg(nic), }) - for nic in nics()]) + for nic in nics()]) paddr = permAddr() for nic, nd in d['nics'].iteritems(): if paddr.get(nic): nd['permhwaddr'] = paddr[nic] d['bondings'] = dict([(bond, {'slaves': slaves(bond), - 'addr': getaddr(bond), - 'netmask': getnetmask(bond), - 'hwaddr': gethwaddr(bond), - 'cfg': getIfaceCfg(bond), - 'mtu': getMtu(bond)}) - for bond in bondings()]) + 'addr': getaddr(bond), + 'netmask': getnetmask(bond), + 'hwaddr': gethwaddr(bond), + 'cfg': getIfaceCfg(bond), + 'mtu': getMtu(bond)}) + for bond in bondings()]) d['vlans'] = dict([(vlan, {'iface': vlan.split('.')[0], 'addr': getaddr(vlan), 'netmask': getnetmask(vlan), 'mtu': getMtu(vlan), 'cfg': getIfaceCfg(vlan), }) - for vlan in vlans()]) + for vlan in vlans()]) return d
@@ -513,4 +513,4 @@ :rtype: List """ return [netname for (netname, net) in networks().iteritems() - if not 'bridge' in net] + if not 'bridge' in net]
-- To view, visit http://gerrit.ovirt.org/9846 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange Gerrit-Change-Id: I59cd4d8bb41c1ce71b91b45ff7fe2f10f25eb577 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: Fix flake8 warnings for network code. ......................................................................
Patch Set 1:
Build Started http://jenkins.ovirt.org/job/vdsm_unit_tests_manual_gerrit/325/ (1/2)
-- To view, visit http://gerrit.ovirt.org/9846 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I59cd4d8bb41c1ce71b91b45ff7fe2f10f25eb577 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: Fix flake8 warnings for network code. ......................................................................
Patch Set 1:
Build Started http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/291/ (2/2)
-- To view, visit http://gerrit.ovirt.org/9846 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I59cd4d8bb41c1ce71b91b45ff7fe2f10f25eb577 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: Fix flake8 warnings for network code. ......................................................................
Patch Set 1:
Build Successful
http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/291/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_manual_gerrit/325/ : SUCCESS
-- To view, visit http://gerrit.ovirt.org/9846 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I59cd4d8bb41c1ce71b91b45ff7fe2f10f25eb577 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Antoni Segura Puimedon asegurap@redhat.com Gerrit-Reviewer: oVirt Jenkins CI Server
ShaoHe Feng has posted comments on this change.
Change subject: Fix flake8 warnings for network code. ......................................................................
Patch Set 1: I would prefer that you didn't submit this
toni, can you add these file to the PEP8_WHITELIST of Makefile.am?
-- To view, visit http://gerrit.ovirt.org/9846 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I59cd4d8bb41c1ce71b91b45ff7fe2f10f25eb577 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: ShaoHe Feng shaohef@linux.vnet.ibm.com Gerrit-Reviewer: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
ShaoHe Feng has posted comments on this change.
Change subject: Fix flake8 warnings for network code. ......................................................................
Patch Set 1: (1 inline comment)
the comment is not related with pep8
.................................................... File vdsm/configNetwork.py Line 795: if bonding and implicitBonding: Line 796: pass Line 797: elif (vlan or bonding) and not nics: Line 798: raise ConfigNetworkError(ne.ERR_BAD_PARAMS, 'vlan/bonding definition ' Line 799: 'requires nics. got: %r' % (nics,)) why tuple (nics, ), only one argument? yes, it is not related with pep8. just puzzle about it. Line 800: Line 801: # Check bridge Line 802: if bridged: Line 803: validateBridgeName(network)
-- To view, visit http://gerrit.ovirt.org/9846 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I59cd4d8bb41c1ce71b91b45ff7fe2f10f25eb577 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: ShaoHe Feng shaohef@linux.vnet.ibm.com Gerrit-Reviewer: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
Antoni Segura Puimedon has posted comments on this change.
Change subject: Fix flake8 warnings for network code. ......................................................................
Patch Set 1: (1 inline comment)
I'll check that and add these files to the pep8 whitelist.
.................................................... File vdsm/configNetwork.py Line 795: if bonding and implicitBonding: Line 796: pass Line 797: elif (vlan or bonding) and not nics: Line 798: raise ConfigNetworkError(ne.ERR_BAD_PARAMS, 'vlan/bonding definition ' Line 799: 'requires nics. got: %r' % (nics,)) I don't know, I'll check. Line 800: Line 801: # Check bridge Line 802: if bridged: Line 803: validateBridgeName(network)
-- To view, visit http://gerrit.ovirt.org/9846 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I59cd4d8bb41c1ce71b91b45ff7fe2f10f25eb577 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: ShaoHe Feng shaohef@linux.vnet.ibm.com Gerrit-Reviewer: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
Antoni Segura Puimedon has posted comments on this change.
Change subject: Fix flake8 warnings for network code. ......................................................................
Patch Set 1: (1 inline comment)
@ShaoHef Feng Makefile.am contains: tests and vdsm/*.py in the PEP8_WHITELIST, so no need to include these files explicitly.
As for the nics thing. I commented it inline
.................................................... File vdsm/configNetwork.py Line 795: if bonding and implicitBonding: Line 796: pass Line 797: elif (vlan or bonding) and not nics: Line 798: raise ConfigNetworkError(ne.ERR_BAD_PARAMS, 'vlan/bonding definition ' Line 799: 'requires nics. got: %r' % (nics,)) nics is a tuple, if you don't pass it in this form you get a TypeError. Line 800: Line 801: # Check bridge Line 802: if bridged: Line 803: validateBridgeName(network)
-- To view, visit http://gerrit.ovirt.org/9846 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I59cd4d8bb41c1ce71b91b45ff7fe2f10f25eb577 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: ShaoHe Feng shaohef@linux.vnet.ibm.com Gerrit-Reviewer: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: Fix flake8 warnings for network code. ......................................................................
Patch Set 2:
Build Started http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/302/ (1/2)
-- To view, visit http://gerrit.ovirt.org/9846 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I59cd4d8bb41c1ce71b91b45ff7fe2f10f25eb577 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: ShaoHe Feng shaohef@linux.vnet.ibm.com Gerrit-Reviewer: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: Fix flake8 warnings for network code. ......................................................................
Patch Set 2:
Build Started http://jenkins.ovirt.org/job/vdsm_unit_tests_manual_gerrit/336/ (2/2)
-- To view, visit http://gerrit.ovirt.org/9846 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I59cd4d8bb41c1ce71b91b45ff7fe2f10f25eb577 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: ShaoHe Feng shaohef@linux.vnet.ibm.com Gerrit-Reviewer: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
Antoni Segura Puimedon has posted comments on this change.
Change subject: Fix flake8 warnings for network code. ......................................................................
Patch Set 2: Verified
Output of pydiff verification: gitpydiff HEAD checking tests/configNetworkTests.py checking tests/libvirtvmTests.py checking tests/tcTests.py 2 difference(s) first file: tests/tcTests.py second file: /tmp/pydiff/tests/tcTests.py
((277, ' Bridge received no mirrored ping requests.'), (279, 'Bridge received no mirrored ping requests.'))
((281, ' Bridge received mirrored ping requests, but mirroring is unset.'), (283, 'Bridge received mirrored ping requests, but mirroring is unset.'))
checking vdsm/configNetwork.py 1 difference(s) first file: vdsm/configNetwork.py second file: /tmp/pydiff/vdsm/configNetwork.py
((196, "<network><name>%s</name><forward mode='passthrough'>\n <interface dev='%s'/></forward></network>"), (196, "<network><name>%s</name><forward mode='passthrough'><interface dev='%s'/></forward></network>"))
checking vdsm/libvirtvm.py checking vdsm/netinfo.py
As you can see, I corrected a couple of texts.
-- To view, visit http://gerrit.ovirt.org/9846 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I59cd4d8bb41c1ce71b91b45ff7fe2f10f25eb577 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: ShaoHe Feng shaohef@linux.vnet.ibm.com Gerrit-Reviewer: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
oVirt Jenkins CI Server has posted comments on this change.
Change subject: Fix flake8 warnings for network code. ......................................................................
Patch Set 2:
Build Successful
http://jenkins.ovirt.org/job/vdsm_pep8_gerrit/302/ : SUCCESS
http://jenkins.ovirt.org/job/vdsm_unit_tests_manual_gerrit/336/ : SUCCESS
-- To view, visit http://gerrit.ovirt.org/9846 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I59cd4d8bb41c1ce71b91b45ff7fe2f10f25eb577 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: ShaoHe Feng shaohef@linux.vnet.ibm.com Gerrit-Reviewer: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
Dan Kenigsberg has posted comments on this change.
Change subject: Fix flake8 warnings for network code. ......................................................................
Patch Set 2: Looks good to me, approved
(1 inline comment)
.................................................... File vdsm/configNetwork.py Line 187: def createLibvirtNetwork(self, network, bridged=True, iface=None, Line 188: skipBackup=False): Line 189: netName = netinfo.LIBVIRT_NET_PREFIX + network Line 190: if bridged: Line 191: netXml = '''<network><name>%s</name><forward mode='bridge'/> no idea why you kept this, and changed the other branch.
but this is not really urgent. Line 192: <bridge name='%s'/></network>''' % (escape(netName), Line 193: escape(network)) Line 194: else: Line 195: netXml = (
-- To view, visit http://gerrit.ovirt.org/9846 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment Gerrit-Change-Id: I59cd4d8bb41c1ce71b91b45ff7fe2f10f25eb577 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: ShaoHe Feng shaohef@linux.vnet.ibm.com Gerrit-Reviewer: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
Dan Kenigsberg has submitted this change and it was merged.
Change subject: Fix flake8 warnings for network code. ......................................................................
Fix flake8 warnings for network code.
This patch fixes flake8 complaints on the code related to networking and libvirtvm.
Change-Id: I59cd4d8bb41c1ce71b91b45ff7fe2f10f25eb577 Signed-off-by: Antoni S. Puimedon asegurap@redhat.com --- M tests/configNetworkTests.py M tests/libvirtvmTests.py M tests/tcTests.py M vdsm/configNetwork.py M vdsm/libvirtvm.py M vdsm/netinfo.py 6 files changed, 218 insertions(+), 235 deletions(-)
Approvals: Antoni Segura Puimedon: Verified Dan Kenigsberg: Looks good to me, approved
-- To view, visit http://gerrit.ovirt.org/9846 To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: merged Gerrit-Change-Id: I59cd4d8bb41c1ce71b91b45ff7fe2f10f25eb577 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: ShaoHe Feng shaohef@linux.vnet.ibm.com Gerrit-Reviewer: Zhou Zheng Sheng zhshzhou@linux.vnet.ibm.com Gerrit-Reviewer: oVirt Jenkins CI Server
vdsm-patches@lists.fedorahosted.org