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