Eduardo 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
preve
Your suggested change only makes the code hard to follow.
The new code can be only one line then clearly is no use for a function here.
May be will be a case for unifying makeVG() and makeLV() but IMHO will make the code
arcane without real gains.
_attr2NamedTuple() purpose was to deal with this attributes dynamically. After years of
use we have no deal with strings like this except this two specific points.
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(a)redhat.com>
Gerrit-Reviewer: Antoni Segura Puimedon <asegurap(a)redhat.com>
Gerrit-Reviewer: Barak Azulay <bazulay(a)redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken(a)redhat.com>
Gerrit-Reviewer: Eduardo <ewarszaw(a)redhat.com>
Gerrit-Reviewer: Federico Simoncelli <fsimonce(a)redhat.com>
Gerrit-Reviewer: Francesco Romani <fromani(a)redhat.com>
Gerrit-Reviewer: Itamar Heim <iheim(a)redhat.com>
Gerrit-Reviewer: Meital Bourvine <mbourvin(a)redhat.com>
Gerrit-Reviewer: Meital bourvine <meitalbourvine(a)gmail.com>
Gerrit-Reviewer: Nir Soffer <nsoffer(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