FDP Utils

class Utils(main_api)

Utility functions for the FDP API, used via the FDP class.

Example

from fdp import FDP
f = FDP(..)
enable_fdp(flag)

Enables or disables Flexible Data Placement in a specific Endurance Group, and deletes all namespaces associated with the Endurance Group prior to doing so.

Parameters:

flag (int) – FDP Toggle Flag. If set to ‘1’, and Flexible Data Placement is disabled, then FDP is enabled. If set to ‘0’ and Flexible Data Placement is enabled, then FDP is disabled. If FDP is already in the configuration requested in flag, then no changes are made.

Returns:

status: int

0 for success, 1 for failure

reason: str

A brief explanation of the result

Return type:

dict

enable_fdp_event(nsid, events, flag, handle=0)

Enables or disables a specified sequence of FDP events associated with a specific Reclaim Unit Handle.

Parameters:
  • nsid (int) – Namespace Identifier. The NSID associated with the list of FDP events.

  • events (list) – The list of FDP Events to enable/disable.

  • flag (int) – FDP Event Toggle Flag. If set to ‘1’, then the FDP events specified in events are enabled. If set to ‘0’ then the FDP events specified in events are disabled. If the FDP Event Enable bit is already set to flag, then no change will occur.

  • handle (int) – Placement Handle (PHNDL) The Placement Handle associated with the Reclaim Unit Handle affected by this command.

Returns:

status: int

0 for success, 1 for failure

reason: str

A brief explanation of the result

Return type:

dict

placement_handle_of(identifier)

Convenience function to extract the Placement Handle (PHNDL) from a Placement Identifier (PI).

Parameters:

identifier (int) – Placement Identifier.

Returns:

The Placement Handle associated with the provided Placement Identifier.

Return type:

int

update_handles(handles, nsid, identifiers=None)

Convenience function for I/O Management Send Operation 01h Reclaim Unit Handle Update.

Parameters:
  • handles (list) –

    A list of Placement Handles. The handles will be parsed in the order they are placed in the list.

    For example, if handles = [1, 2, 3] Handle 1 at index 0 will be assigned to the first Placement Identifier. Handle 2 at index 1 will be assigned to the second Placement Identifier. and so on.

  • nsid (int) – Namespace Identifier. The NSID associated with the list of FDP events.

  • identifiers (list) –

    A list of Reclaim Group Identifiers specifying the Reclaim Group used by the command.

    If identifiers is specified, then the Reclaim Group Identifiers will be parsed in the order they are placed in the list. If identifiers is not specified, or if len(identifiers) is less than len(handles), then the Reclaim Group Identifiers field will be cleared to 0h.

    For example, if identifiers = [2, 3, 2] and handles = [1, 2, 3] RGID 2 and Handle 1 will be assigned to the first Placement Identifier. RGID 3 and Handle 2 will be assigned to the second Placement Identifier. and so on.

    If identifiers = [1] and handles [1, 2, 3] RGID 1 and Handle 1 will be assigned to the first Placement Identifier. Handles 2 and 3 will be assigned to their respective Placement Identifiers with the RGID field cleared to 0h.

Returns:

status: int

0 for success, 1 for failure

reason: str

A brief explanation of the result

data: dict

The parsed bytes returned by the controller

Return type:

dict