Antoni Segura Puimedon has posted comments on this change.
Change subject: Make libvirtvm.py PEP8 compliant
......................................................................
Patch Set 1: No score
(3 inline comments)
As Zhou Zheng Sheng said, there is a patch that is doing the same task, I
reviewed both to the best of my ability and I attach now some comments that
help clarify my earlier comments. I admit that I might be mistaken in my
interpretations so I will leave the score to 0 and hope that somebody will have
a more definitive knowledge about these points than I do.
....................................................
File vdsm/libvirtvm.py
Line 81: config.getint('vars',
'vm_sample_net_interval'),
Line 82: config.getint('vars',
'vm_sample_net_window'))
Line 83:
Line 84: self.addStatsFunction(self.highWrite, self.updateVolumes,
Line 85: self.sampleCpu, self.sampleDisk,
self.sampleDiskLatency,
note that in the example you pose there is no argument in the first line, thus
it is allowed as you show. I am under the understanding that it is not the case
when there are arguments in the line that opens the brackets.
Line 86: self.sampleNet)
Line 87:
Line 88: def _highWrite(self):
Line 89: if not self._vm._volumesPrepared:
Line 118: vmDrive.apparentsize =
int(volSize['apparentsize'])
Line 119:
Line 120: def _sampleCpu(self):
Line 121: state, maxMem, memory, nrVirtCpu, cpuTime =
self._vm._dom.info()
Line 122: return cpuTime / (1000 ** 3)
You are right about the spaces, I overlooked them, what caught my attentions
was the presence of unneeded parenthesis.
Line 123:
Line 124: def _sampleDisk(self):
Line 125: if not self._vm._volumesPrepared:
Line 126: # Avoid queries from storage during recovery process
Line 269: 'writeLatency': '0',
Line 270: 'flushLatency': '0'}
Line 271: try:
Line 272: (dLatency['readLatency'], dLatency['writeLatency'],
Line 273: dLatency['flushLatency']) =
_avgLatencyCalc(sInfo[dName],
It is a block, thus, I believe (although I could very well be mistaken), should
follow the rules of indentation inside parenthesis like the example in:
http://www.python.org/dev/peps/pep-0008/#maximum-line-length
Note:
- The alignment to beginning parenthesis in the if.
- The alignment in the raise ValueError statement (no multiples of four but
aligned to call beginning parenthesis).
Line 274: eInfo[dName])
Line 275: except (KeyError, TypeError):
Line 276: self._log.debug("Disk %s latency not available",
dName)
Line 277: else:
--
To view, visit http://gerrit.ovirt.org/7422
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I32570c2d1a2efa4a5446caa6d973a10b4c84d996
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Saggi Mizrahi <[email protected]>
Gerrit-Reviewer: Antoni Segura Puimedon <[email protected]>
Gerrit-Reviewer: Dan Kenigsberg <[email protected]>
Gerrit-Reviewer: Saggi Mizrahi <[email protected]>
Gerrit-Reviewer: Zhou Zheng Sheng <[email protected]>
Gerrit-Reviewer: oVirt Jenkins CI Server
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches