Nir Soffer has posted comments on this change. Change subject: vmDevices: add __slots__ to devices ......................................................................
Patch Set 4: (1 comment) http://gerrit.ovirt.org/#/c/21036/4/vdsm/vm.py File vdsm/vm.py: Line 1253: self.log.debug('Ignoring param (%s, %s) in %s', attr, value, Line 1254: self.__class__.__name__) Line 1255: pass Line 1256: self.conf = conf Line 1257: self._deviceXML = None > I'm not sure I understand correctly: we *should* fail if the required param We can do this in the same loop setting attributes: for attr in self.__slots__: setattr(self, attr, kwargs.get(attr)) But this is only partial solution - we want to fail *fast*, detecting the bad code calling us without the required parameter, and fix it. Creating an object with required attribute set to None means that we will fail sometimes in the future when trying to use None instead of the real value, or even worse behave incorrectly when the None value is similar to the required value, e.g. both are falsey. Line 1258: Line 1259: def __str__(self): Line 1260: attrs = [':'.join((a, str(getattr(self, a, None)))) for a in dir(self) Line 1261: if not a.startswith('__')] -- To view, visit http://gerrit.ovirt.org/21036 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I6e8dadabdd02d3b44606f215c4bc7b7e306a591a Gerrit-PatchSet: 4 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Martin Polednik <[email protected]> Gerrit-Reviewer: Federico Simoncelli <[email protected]> Gerrit-Reviewer: Francesco Romani <[email protected]> Gerrit-Reviewer: Martin Polednik <[email protected]> Gerrit-Reviewer: Michal Skrivanek <[email protected]> Gerrit-Reviewer: Nir Soffer <[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
