Exemplo n.º 1
0
def supported_raids():
    return {
        "btrfs volume":
        devicefactory.get_supported_raid_levels(
            devicefactory.DEVICE_TYPE_BTRFS),
        "mdraid":
        devicefactory.get_supported_raid_levels(devicefactory.DEVICE_TYPE_MD),
        "lvmlv":
        devicefactory.get_supported_raid_levels(devicefactory.DEVICE_TYPE_LVM)
    }
Exemplo n.º 2
0
def get_supported_raid_levels(device_type):
    """Get RAID levels for the specified device type.

    :param device_type: a type of the device
    :return: a list of RAID levels
    """
    return devicefactory.get_supported_raid_levels(device_type)
Exemplo n.º 3
0
def get_supported_raid_levels(device_type):
    """Get RAID levels supported for the given device type.

    It supports any RAID levels that it expects to support and that blivet
    supports for the given device type.

    Since anaconda only ever allows the user to choose RAID levels for
    device type DEVICE_TYPE_MD, hiding the RAID menu for all other device
    types, the function only returns a non-empty set for this device type.
    If this changes, then so should this function, but at this time it
    is not clear what RAID levels should be offered for other device types.

    :param int device_type: one of an enumeration of device types
    :return: a set of supported raid levels
    :rtype: a set of instances of blivet.devicelibs.raid.RAIDLevel
    """
    if device_type == devicefactory.DEVICE_TYPE_MD:
        supported = set(
            raid.RAIDLevels(
                ["raid0", "raid1", "raid4", "raid5", "raid6", "raid10"]))
    else:
        supported = set()

    return devicefactory.get_supported_raid_levels(device_type).intersection(
        supported)
Exemplo n.º 4
0
def containerRaidLevelsSupported(device_type):
    """ The raid levels anaconda supports for a container for this
        device_type.

        For LVM, anaconda supports LVM on RAID, but also allows no RAID.

        :param int device_type: one of an enumeration of device types
        :returns: a set of supported raid levels
        :rtype: a set of instances of blivet.devicelibs.raid.RAIDLevel
    """
    if device_type in (DEVICE_TYPE_LVM, DEVICE_TYPE_LVM_THINP):
        supported = set(raid.RAIDLevels(["raid0", "raid1", "raid4", "raid5", "raid6", "raid10"]))
        return get_supported_raid_levels(DEVICE_TYPE_MD).intersection(supported).union(set([None]))
    elif device_type == DEVICE_TYPE_BTRFS:
        supported = set(raid.RAIDLevels(["raid0", "raid1", "raid10", "single"]))
        return get_supported_raid_levels(DEVICE_TYPE_BTRFS).intersection(supported)
    return set()
Exemplo n.º 5
0
def containerRaidLevelsSupported(device_type):
    """ The raid levels anaconda supports for a container for this
        device_type.

        For LVM, anaconda supports LVM on RAID, but also allows no RAID.

        :param int device_type: one of an enumeration of device types
        :returns: a set of supported raid levels
        :rtype: a set of instances of blivet.devicelibs.raid.RAIDLevel
    """
    if device_type in (DEVICE_TYPE_LVM, DEVICE_TYPE_LVM_THINP):
        supported = set(
            raid.RAIDLevels(
                ["raid0", "raid1", "raid4", "raid5", "raid6", "raid10"]))
        return get_supported_raid_levels(DEVICE_TYPE_MD).intersection(
            supported).union(set([None]))
    elif device_type == DEVICE_TYPE_BTRFS:
        supported = set(raid.RAIDLevels(["raid0", "raid1", "raid10",
                                         "single"]))
        return get_supported_raid_levels(DEVICE_TYPE_BTRFS).intersection(
            supported)
    return set()
Exemplo n.º 6
0
def raidLevelsSupported(device_type):
    """ The raid levels anaconda supports for this device type.

        It supports any RAID levels that it expects to support and that blivet
        supports for the given device type.

        Since anaconda only ever allows the user to choose RAID levels for
        device type DEVICE_TYPE_MD, hiding the RAID menu for all other device
        types, the function only returns a non-empty set for this device type.
        If this changes, then so should this function, but at this time it
        is not clear what RAID levels should be offered for other device types.

        :param int device_type: one of an enumeration of device types
        :returns: a set of supported raid levels
        :rtype: a set of instances of blivet.devicelibs.raid.RAIDLevel
    """
    if device_type == DEVICE_TYPE_MD:
        supported = set(raid.RAIDLevels(["raid0", "raid1", "raid4", "raid5", "raid6", "raid10"]))
    else:
        supported = set()
    return get_supported_raid_levels(device_type).intersection(supported)
Exemplo n.º 7
0
def supported_raids():
    return {"btrfs volume": devicefactory.get_supported_raid_levels(devicefactory.DEVICE_TYPE_BTRFS),
            "mdraid": devicefactory.get_supported_raid_levels(devicefactory.DEVICE_TYPE_MD),
            "lvmlv": devicefactory.get_supported_raid_levels(devicefactory.DEVICE_TYPE_LVM)}