Change in vdsm[master]: Avoid to recompile namedtuple ATTR classes in lvm.
nsoffer at redhat.com
nsoffer at redhat.com
Thu Mar 13 15:42:59 UTC 2014
Nir Soffer has posted comments on this change.
Change subject: Avoid to recompile namedtuple ATTR classes in lvm.
......................................................................
Patch Set 1:
(1 comment)
http://gerrit.ovirt.org/#/c/25678/1/vdsm/storage/lvm.py
File vdsm/storage/lvm.py:
Line 220: args[LV._fields.index("tags")] = tags
Line 221: # Convert attr string into named tuple fields.
Line 222: sAttr = args[LV._fields.index("attr")]
Line 223: attr_values = tuple(sAttr[:len(LV_ATTR._fields)])
Line 224: attrs = LV_ATTR(*attr_values)
This change introduce duplication that the _attr2NamedTupple function prevented.
We can instead fix the function like this:
def _attr2NamedTupple(attr, cls):
values = attr[:len(cls._fields)]
return cls(*values)
What do you think?
Line 225: args[LV._fields.index("attr")] = attrs
Line 226: # Add properties. Should be ordered as VG_PROPERTIES.
Line 227: args.append(attrs.permission == "w") # writable
Line 228: args.append(attrs.devopen == "o") # opened
--
To view, visit http://gerrit.ovirt.org/25678
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I66110a7f25fb5cfd80ddffe9a22e1cbac11de447
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Eduardo <ewarszaw at redhat.com>
Gerrit-Reviewer: Antoni Segura Puimedon <asegurap at redhat.com>
Gerrit-Reviewer: Barak Azulay <bazulay at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Federico Simoncelli <fsimonce at redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani at redhat.com>
Gerrit-Reviewer: Itamar Heim <iheim at redhat.com>
Gerrit-Reviewer: Meital Bourvine <mbourvin at redhat.com>
Gerrit-Reviewer: Meital bourvine <meitalbourvine at gmail.com>
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: Yeela Kaplan <ykaplan at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
More information about the vdsm-patches
mailing list