Ejemplo n.º 1
0
def abstract_create_logical_drive(adapter, level, drives=None, size=None, array=None):
    """
    :param adapter: Target adapter
    :type adapter: int
    :param level: 0, 1, 5, 6, 10, 1+0, 50, 60
    :type level: str
    :param drives: drives should be referenced as 0 based comma separated indexes, ranges,
        or a combination of both. For example::

            0, 1, 2, 3
                or
            0-3
                or
            0, 2, 4-8, 9, 10

        When using a range, both the lower and upper bounds are inclusive

        Another option is to use all or unassigned. `all` requires that all drives on the
        adapter are not part of the array. `unassigned` will select all drives not currently
        members of an array or participating as spares
    :param size: Size can be specified in bytes (int), a string using SI or IEC standards,
    a percent of total space, or a percent of free space available. If no size is listed,
    all available space will be used
    :param array: An index of an existing array we are updating
    :return:
    """
    log.info('Creating array on adapter {}: level={} drives={} size={} array={}'.format(
        adapter, level, drives, size, array
    ))

    # Right now, I assume that there is only ONE driver type, ie, one vendor type.

    raid_driver = get_subsystem_drivers('raid')[0]

    return raid_driver.handler.create_logical_drive(adapter, level, drives, size, array)
Ejemplo n.º 2
0
def abstract_clear_configuration(adapter):
    """
    :param adapter:
    :return:
    """
    raid_driver = get_subsystem_drivers('raid')[0]
    return raid_driver.handler.clear_configuration(adapter)
Ejemplo n.º 3
0
def abstract_delete_logical_drive(adapter, array, logical_drive):
    """
    :param adapter:
    :param array:
    :param logical_drive:
    :return:
    """
    raid_driver = get_subsystem_drivers('raid')[0]
    return raid_driver.handler.delete_logical_drive(adapter, array, logical_drive)
Ejemplo n.º 4
0
def abstract_add_spares(adapter, array, drives):
    """
    :param adapter:
    :param array:
    :param drives:
    :return:
    """
    raid_driver = get_subsystem_drivers('raid')[0]
    return raid_driver.handler.add_spares(adapter, array, drives)
Ejemplo n.º 5
0
def has_abstraction_handler():
    raid_drivers = get_subsystem_drivers('raid')
    for driver in raid_drivers:
        if isinstance(driver.handler, RAIDActions):
            return True
    return False