[blivet:master 3/3] Distinguish among desired MD*Device constructors in newMDArray().
David Lehman
dlehman at redhat.com
Fri Dec 12 20:35:25 UTC 2014
On 12/12/2014 12:35 PM, mulhern wrote:
> Signed-off-by: mulhern <amulhern at redhat.com>
> ---
> blivet/__init__.py | 16 ++++++++++++++--
> 1 file changed, 14 insertions(+), 2 deletions(-)
This one should be totally unnecessary since we do not (nor do we plan
to) support creation of containers or fwraid arrays.
David
>
> diff --git a/blivet/__init__.py b/blivet/__init__.py
> index 210d3c6..8cf9351 100644
> --- a/blivet/__init__.py
> +++ b/blivet/__init__.py
> @@ -67,13 +67,14 @@ from pykickstart.constants import AUTOPART_TYPE_LVM, CLEARPART_TYPE_ALL, CLEARPA
>
> from .storage_log import log_exception_info, log_method_call
> from .errors import DeviceError, DirtyFSError, FSResizeError, FSTabTypeMismatchError, UnknownSourceDeviceError, StorageError, UnrecognizedFSTabEntryError
> -from .devices import BTRFSDevice, BTRFSSubVolumeDevice, BTRFSVolumeDevice, DirectoryDevice, FileDevice, LVMLogicalVolumeDevice, LVMThinLogicalVolumeDevice, LVMThinPoolDevice, LVMVolumeGroupDevice, MDRaidArrayDevice, NetworkStorageDevice, NFSDevice, NoDevice, OpticalDevice, PartitionDevice, TmpFSDevice, devicePathToName
> +from .devices import BTRFSDevice, BTRFSSubVolumeDevice, BTRFSVolumeDevice, DirectoryDevice, FileDevice, LVMLogicalVolumeDevice, LVMThinLogicalVolumeDevice, LVMThinPoolDevice, LVMVolumeGroupDevice, MDBiosRaidArrayDevice, MDContainerDevice, MDRaidArrayDevice, NetworkStorageDevice, NFSDevice, NoDevice, OpticalDevice, PartitionDevice, TmpFSDevice, devicePathToName
> from .devicetree import DeviceTree
> from .deviceaction import ActionCreateDevice, ActionCreateFormat, ActionDestroyDevice, ActionDestroyFormat, ActionResizeDevice, ActionResizeFormat
> from .formats import getFormat
> from .formats import get_device_format_class
> from .formats import get_default_filesystem_type
> from . import devicefactory
> +from .devicelibs import raid
> from .devicelibs.dm import name_from_dm_node
> from .devicelibs.crypto import generateBackupPassphrase
> from .devicelibs.edd import get_edd_dict
> @@ -1063,7 +1064,18 @@ class Blivet(object):
> swap=swap,
> mountpoint=mountpoint)
>
> - return MDRaidArrayDevice(name, *args, **kwargs)
> +
> + device_type = MDRaidArrayDevice
> +
> + level = kwargs.get("level", None)
> + if level is not None and raid.getRaidLevel(level) is raid.Container:
> + device_type = MDContainerDevice
> +
> + parents = kwargs.get("parents", None)
> + if parents is not None and parents[0].type == "mdcontainer":
> + device_type = MDBiosRaidArrayDevice
> +
> + return device_type(name, *args, **kwargs)
>
> def newVG(self, *args, **kwargs):
> """ Return a new LVMVolumeGroupDevice instance.
>
More information about the anaconda-patches
mailing list