Installation

For development and testing, the server and the agent can be directly installed from pip. The agent typically runs in an a stateless environment with access to server management utilities. For the safety of your development environment, do not run the agent as root, unless you really know what you are doing.

Requirements

Python 3.5+ for the server

Python 2.7+ for the agent

Server

$ pip install mercury-server

Agent

$ pip install mercury-agent

RAID Abstraction

class mercury.hardware.raid.abstraction.api.RAIDActions

Bare bones RAID abstraction layer. Simple support for querying and modifying a RAID controller through a standard interface. Many things are not supported, but may be added at a later date If controller specific advanced features are needed, see the provider APIs and RPC capabilities

create(adapter_info, level, drives=None, size=None, array=None)

This method should only be called from the base classes create_logical_volume method. This method will be implemented by all Actions classes.

Parameters:
  • adapter_info – Transformed adapter data
  • level (str) – A supported RAID level
  • drives – A zero based, expanded list of participating drive indexes. Should be None if array is specified
  • size – A python-size object or None (maximum)
  • array – The index of the existing array (with sufficient free space) being targeted Should be None if drives are specified
Returns:

create_logical_drive(adapter, level, drives=None, size=None, array=None)
Parameters:
  • adapter (int) –
  • level (str) – 0, 1, 5, 6, 10, 1+0, 50, 60
  • 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

  • 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:

create_logical_drive_on_existing_array(adapter, adapter_info, level, array, converted_size, percent_string)
Parameters:
  • adapter
  • adapter_info
  • level
  • array
  • converted_size
  • percent_string
Returns:

create_logical_drive_on_new_array(adapter, adapter_info, level, drives, converted_size, percent_string)
Parameters:
  • adapter
  • adapter_info
  • level
  • drives
  • converted_size
  • percent_string
Returns:

get_adapter_info(adapter_index)

Returns adapter details in a standard format. The driver is responsible for finding adapters to perform actions on. The abstraction uses indexes rather than vendor references.

For instance, hpsa uses pci slot ids to specify adapters, onboard adapters will be 0, expansion cards will be 3 and 4, should they occupy pci-e slots 3 and 4 on the riser card. In order to ‘flatten’ the interface, these cards will be accessed by enumeration:

adapter0: slot0 adapter1: slot3 adapter2: slot4

In the rare occurrence that there are multiple manufacturers, cards will enumerated based on there subsystem ids (PCI Ids for example). To implement this, the driver probe process will need to change so that drivers and handlers are registered in PCI order and not import order. Talk to Jared R. about implementation details as he is soldiering on.

Parameters:adapter_index – The index of the adapter to populate configuration information
Returns:A dictionary representing the adapter
get_all_drives(adapter_index)

Get drives while preserving array membership :param adapter_index: target adapter :return: drives :return type: list

static get_selection_from_pattern(pattern)

The pattern is a mechanism to target one or more drives attached to a controller. See the create_logical_volume documentation for the full format :param pattern: :type pattern: str :return: a list of indexes