Francesco Romani has posted comments on this change. Change subject: Introduction for caching the parsed domain XML ......................................................................
Patch Set 24: (2 comments) some possible improvements I'd like to implement, probably better in follow up patches once this is in. http://gerrit.ovirt.org/#/c/17694/24/vdsm/virt/domain_descriptor.py File vdsm/virt/domain_descriptor.py: Line 40: @property Line 41: def dom(self): Line 42: return self._dom Line 43: Line 44: def firstElementByTagName(self, tagName): according to git grep, this can be made private Line 45: elements = self._dom.childNodes[0].getElementsByTagName(tagName) Line 46: return elements[0] if elements else None Line 47: Line 48: @property Line 49: def devices(self): Line 50: return self._devices Line 51: Line 52: def getDeviceElements(self, tagName): Line 53: return self._devices.getElementsByTagName(tagName) Since we need another round of review due to the big rebase being made, I'd like to propose a new API here. My rationale is 1 since this is new module, have an API more_pep8_friendly and goAwayFromCamelCase 2 add more convenience methods, possibly merging helpers currently in vmxml.py 3 abstract from the minidom API, in not-so-distant future we want to move to cElementTree for performance and nicer API. What about replacing the two above with @property def all_devices(self): return self._devices def devices(self, type): # klass? dev_type? kind? return self._devices.getElementsByTagName(type) - of course this will not address #3 above Line 54: Line 55: @property Line 56: def devicesHash(self): -- To view, visit http://gerrit.ovirt.org/17694 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I7e106b2f2d3f4160d4e882f1a2880cb1b52fbb22 Gerrit-PatchSet: 24 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Vinzenz Feenstra <[email protected]> Gerrit-Reviewer: Antoni Segura Puimedon <[email protected]> Gerrit-Reviewer: Dan Kenigsberg <[email protected]> Gerrit-Reviewer: Ewoud Kohl van Wijngaarden <[email protected]> Gerrit-Reviewer: Federico Simoncelli <[email protected]> Gerrit-Reviewer: Francesco Romani <[email protected]> Gerrit-Reviewer: Martin Sivák <[email protected]> Gerrit-Reviewer: Michal Skrivanek <[email protected]> Gerrit-Reviewer: Nir Soffer <[email protected]> Gerrit-Reviewer: Peter V. Saveliev <[email protected]> Gerrit-Reviewer: Vinzenz Feenstra <[email protected]> Gerrit-Reviewer: [email protected] Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
