Quick Start Guide

Initialise PyU4V

First, make sure that PyU4V is installed as directed in the Installation Guide:

$ pip show PyU4V

To initialise the connection with Unisphere use U4VConn, it will load the configuration provided in PyU4V.conf configured during installation:

import PyU4V
conn = PyU4V.U4VConn()

With a connection to the Unisphere server you can start to run some test queries to validate the successful connection.

conn.common.get_unisphere_version()
('V10.1.0.0', '101')
conn.common.get_array_list()
["000197900123", "000197900124", "000197900125", "000197900126"]

If you want to query another array, you can set the array_id to a value of your choice which overrides what is set in PyU4V.conf. Alternatively you can initialise a new PyU4V connection and pass in the array_id but load all other configuration settings from PyU4V.conf.

# Option 1 - Set new array ID in current PyU4V connection
conn.set_array_id('000197900126')
# Option 2 - Create new PyU4V connection using PyU4V.conf settings
new_conn = PyU4V.U4VConn(array_id='000197900126')

PyU4V Unisphere REST Coverage

The functions in PyU4V have been divided into logical categories which reflect the various categories provided by the Unisphere REST API:

  • Common - REST methods and assistive utilities

  • Migration - all migration related calls

  • Performance - all performance and threshold calls

  • Real Time - all performance real-time calls

  • Provisioning - all provisioning and masking related calls

  • Replication - all local and remote replication calls

  • Clone - Create and manage clone replicas of storage groups.

  • Metro DR - all Metro DR calls

  • Snapshot Policy - all Snapshot Policy calls

  • System - all system level calls

  • Workload Planner - all workload planner calls

  • Utils - assistive functions to aid with PyU4V usage

  • Enhanced API - Array & Performance, Bulk API calls to simplify and reduce the number of API calls needed to get information for Data Mining.

There are plans to further increase the coverage of Unisphere REST calls in future releases. All changes are reflected in the PyU4V change log (link).

Perform a Custom REST Call in PyU4V

At its core PyU4V is your typical REST client. It creates a request header, defines any request parameters in JSON, sends the request with an associated method which dictates the action being performed (GET, POST, etc.), and expects a response payload in most instances (DELETE calls tend to return a status instead of a response payload).

There are functions created in PyU4V.common which provide the ability to perform GET, POST and other request calls directly with the Unisphere REST API to any supported endpoint.

  • PyU4V.common.get_resource() - GET

  • PyU4V.common.create_resource() - POST

  • PyU4V.common.modify_resource() - PUT

  • PyU4V.common.delete_resource() - DELETE

If there is any functionality that is provided by the Unisphere REST API that is not yet implemented in PyU4V, it is possible to create a custom function which use the above functions to make use of that functionality. For information on the Unisphere REST API please consult its related documentation.

The Unisphere for PowerMax REST documentation is accessible directly from the help menu in Unipshere or you can Navigate to https://developer.dell.com/apis/4458/versions/10.1/

 1"""docs/source/programmers_guide_src/code/custom_call.py."""
 2import PyU4V
 3
 4# Initialise PyU4V connection to Unisphere
 5conn = PyU4V.U4VConn()
 6
 7# Create a Clone Copy of a Stoage group, The Target Storage Group will be
 8# created with all required volumes for the clone copy if it does not exist
 9# already.
10
11
12def my_custom_api_Call(
13        storage_group_id, target_storage_group_id,
14        consistent=True, establish_terminate=False,
15        array_id=None, force=False, star=False, skip=False):
16    """Create Clone.
17    :param storage_group_id: The Storage Group ID -- string
18    :param consistent: creates the clone crash consistent using ECA
19                       technology -- bool
20    :param establish_terminate: creates the clone and immediately
21                                terminates, very useful if you want to
22                                make an independent copy available
23                                immediately but don't intend to use for
24                                restore purposes -- bool
25    :param array_id: The storage array ID -- string
26    :param target_storage_group_id: name of storage group to contain
27                                      clone devices -- string
28    :param force: Attempts to force the operation even though one or more
29                  volumes may not be in the normal, expected state(s) for
30                  the specified operation -- bool
31    :param star: Acknowledge the volumes are in an SRDF/Star
32                 configuration -- bool
33    :param skip: Skips the source locks action -- bool
34
35    """
36    array_id = array_id if array_id else conn.array_id
37    payload = {
38        "target_storage_group_name": target_storage_group_id,
39        "establish_terminate": establish_terminate,
40        "consistent": consistent,
41        "force": force,
42        "star": star,
43        "skip": skip
44    }
45    return conn.common.create_resource(
46        target_uri=f"/100/replication/symmetrix"
47                   f"/{array_id}/storagegroup/{storage_group_id}"
48                   f"/clone/storagegroup", payload=payload)
49
50
51# Close the session
52conn.close_session()

To find out more information on the any PyU4V calls refer to the supporting function documentation in the API Glossary , there are also programmers guide examples provided with this documentation which demonstrate a range of functions using PyU4V.