[blivet:master] Factoring out MDRaidArrayDevice functionality

David Lehman dlehman at redhat.com
Thu Nov 6 16:26:22 UTC 2014


On 10/14/2014 03:54 PM, mulhern wrote:
> The question is, do the two subclasses make any kind of sense?
>
> Also, assuming they do, what is the best solution to making sure
> that the correct class gets constructed in the correct situation?
> Would it be reasonable to go about this by defining __new__() in
> MDRaidArrayDevice and using that method to select the appropriate subclass?
> The appropriate subclass is decided by
> a) RAID level
> b) type of parent
>
> mulhern (1):
>    Factor out MDRaidArrayDevice w/ type in ("mdcontainer",
>      "mdbiosraidarray")
>
>   blivet/devicelibs/mdraid.py                      |   2 +-
>   blivet/devices/__init__.py                       |   2 +-
>   blivet/devices/container.py                      |  18 +--
>   blivet/devices/md.py                             | 189 +++++++++++++++--------
>   tests/devicelibs_test/mdraid_interrogate_test.py |   4 +-
>   tests/devicelibs_test/mdraid_test.py             |   1 -
>   tests/devices_test.py                            |  16 +-
>   7 files changed, 141 insertions(+), 91 deletions(-)
>

This is exactly what I had in mind. I don't think any magic is required 
to force/help users pick the right class. I would just add some checks 
in the normal md class to make sure it isn't used for a container or 
fwraid array and then make sure we're using the right classes in DeviceTree.

David


More information about the anaconda-patches mailing list