Nir Soffer has posted comments on this change.
Change subject: json-rpc: Protocol detection
......................................................................
Patch Set 33:
(1 comment)
http://gerrit.ovirt.org/#/c/26300/33/vdsm/protocolDetector.py
File vdsm/protocolDetector.py:
Line 178: self.log.warning("Unable to read data")
Line 179: self._remove_connection(client_socket)
Line 180: client_socket.close()
Line 181: return
Line 182:
> Good catch. You found a fix of asyncore bug that we found. There was an iss
I think that we do need it here, as I could reproduce it once or twice by accessing vdsm from engine running on a remote machine. This is probably not a typical setup, but there is no reason that it will fail.
Line 183: self._remove_connection(client_socket)
Line 184: try:
Line 185: handler = self.detect_protocol(data)
Line 186: except _CannotDetectProtocol:
--
To view, visit http://gerrit.ovirt.org/26300
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Id739a40e2b37dcc175137ec91cd5ec166ad24a75
Gerrit-PatchSet: 33
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Piotr Kliczewski <piotr.kliczewski(a)gmail.com>
Gerrit-Reviewer: Barak Azulay <bazulay(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Liron Ar <laravot(a)redhat.com>
Gerrit-Reviewer: Michal Skrivanek <michal.skrivanek(a)redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer(a)redhat.com>
Gerrit-Reviewer: Piotr Kliczewski <piotr.kliczewski(a)gmail.com>
Gerrit-Reviewer: Saggi Mizrahi <smizrahi(a)redhat.com>
Gerrit-Reviewer: Vinzenz Feenstra <vfeenstr(a)redhat.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei(a)redhat.com>
Gerrit-Reviewer: Yeela Kaplan <ykaplan(a)redhat.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
Francesco Romani has posted comments on this change.
Change subject: vm: Collect vm numa node runtime pin information
......................................................................
Patch Set 3:
(4 comments)
Looks OK, adding a few comments to improve it even further.
http://gerrit.ovirt.org/#/c/28134/3/lib/vdsm/config.py.in
File lib/vdsm/config.py.in:
Line 171: ('vm_sample_balloon_window', '2', None),
Line 172:
Line 173: ('vm_sample_vcpu_pin_interval', '2',
Line 174: 'How often should we sample each vcpu runtime pinning to '
Line 175: 'which physical cpu core.'),
Still not sure we need to sample so frequently. Is cpu pinning supposed to change that fast?
Line 176:
Line 177: ('vm_sample_vcpu_pin_window', '2', None),
Line 178:
Line 179: ('trust_store_path', '@TRUSTSTORE@',
http://gerrit.ovirt.org/#/c/28134/3/vdsm/supervdsmServer
File vdsm/supervdsmServer:
Line 175: pidFile = "/var/run/libvirt/qemu/%s.pid" % vmName
Line 176: return open(pidFile).read()
Line 177:
Line 178: def _getVcpuPid(self, vmName):
Line 179: runFile = "/var/run/libvirt/qemu/%s.xml" % vmName
I don't like hardcoded paths but I guess we don't really have alternatives here. Do we?
(Yep I see this pattern it is used elsewhere in this very file, room for future work of course.)
Line 180: runInfo = xml.dom.minidom.parse(runFile)
Line 181: vCpus = runInfo.getElementsByTagName('vcpus')[0]
Line 182: vCpuSet = vCpus.getElementsByTagName('vcpu')
Line 183: vCpuPids = {}
Line 192: vCpuMemMaps = {}
Line 193: for vCpuIndex, vCpuPid in vCpuPids.iteritems():
Line 194: numaMapsFile = "/proc/%s/task/%s/numa_maps" % (vmPid, vCpuPid)
Line 195: if os.path.exists(numaMapsFile):
Line 196: with open(numaMapsFile, 'r') as f:
TL;DR: this code is good enough already
I'm not a fan of the
if os.path exists(a_file):
with open(a_file)
I'd rather prefer to do
try
with open(a_file)
except IOError
# something...
or, in pythonic words, I generally prefer EAFP instead of LBYL: http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html#eafp-…
Line 197: mappingNodes = map(
Line 198: int, re.findall('N(\d+)=\d+', f.read()))
Line 199: vCpuMemMaps[vCpuIndex] = list(set(mappingNodes))
Line 200: return vCpuMemMaps
http://gerrit.ovirt.org/#/c/28134/3/vdsm/virt/vm.py
File vdsm/virt/vm.py:
Line 489: vCpuMemoryMapping[vCpu])
Line 490: vmNumaNodeRuntimeMap = dict([(k, list(set(v))) for k, v in
Line 491: vmNumaNodeRuntimeMap.iteritems()])
Line 492: if vmNumaNodeRuntimeMap:
Line 493: stats['vNodeRuntimeInfo'] = vmNumaNodeRuntimeMap
Thanks for the improvements in this function.
It is possible to go the extra (final) mile and split it in a few helper methods?
For some reasons I find this code unexpectedly dense.
Line 494:
Line 495: def get(self):
Line 496: stats = {}
Line 497:
--
To view, visit http://gerrit.ovirt.org/28134
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I20eac3b633efa5f81157f021515425b0c9e15d8f
Gerrit-PatchSet: 3
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Xiaolei Shi <xiao-lei.shi(a)hp.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Martin Sivák <msivak(a)redhat.com>
Gerrit-Reviewer: Xiaolei Shi <xiao-lei.shi(a)hp.com>
Gerrit-Reviewer: automation(a)ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes