Skip to main content

A Dell SC tasks automation using REST API

Project description

Dell SC

Introduction

The CLI developed in this project allows the user to interact with Dell SCs using REST API.

With this CLI, you can list the existing volumes, servers, etc, on the Dell SCs, clone volumes, create snapshots, replace existing volumes with a golden image, etc. It is also able to configure system /etc/fstab and multipath when needed in some operations like volume mapping and mounting.

Running the Application

Prerequisites

Installation

To install the ucamdsm pip package:

pip3 install ucamdsm

CLI

The help shows how to use ucamdsm. Some detailed example can be found on https://confluence.uis.cam.ac.uk/display/SYS/Dell+SC+automation+and+scripting.

usage: ucamdsm [-h] [--dsm_host DSM_HOST] [--dsm_port DSM_PORT]
               [--dsm_user DSM_USER] [--dsm_password DSM_PASSWORD]
               [--is_secure IS_SECURE] [--record_config RECORD_CONFIG]
               [--file FILE]
               {list,delete_volume,replace_volume,clone_volume,create_snapshot,delete_recycled_vols,map_volume,unmap_volume,volume_from_snapshot}
               ...

Manage Dell Storage Manager objects via REST API.

positional arguments:
  {list,delete_volume,replace_volume,clone_volume,create_snapshot,delete_recycled_vols,map_volume,unmap_volume,volume_from_snapshot}
    list                List Dell SC objects. Example: ucamdsm --dsm_user user
                        --dsm_password abc123 list --object scs
    delete_volume       Delete Dell SC Volume. Example: ucamdsm --dsm_user
                        user --dsm_password abc123 delete_volume --vol_wwn
                        12345
    replace_volume      Clone the volume mounted on source mountpoint and
                        mount it on destination mountpoint. Then, delete the
                        volume was initially mounted on destination
                        mountpoint. Example: ucamdsm --dsm_user user
                        --dsm_password abc123 replace_volume --src_mp /src
                        --dst_mp /dst
    clone_volume        Create a snapshot with label of a volume with WWN,
                        create a view volume from the snapshot, then, map the
                        view volume to local server and mount it on target
                        mountpoint. Example: ucamdsm --dsm_user user
                        --dsm_password abc123 clone_volume --vol_wwn 12345
                        --replay_label test1 --clone_name name --target_mp
                        /target
    create_snapshot     Create a snapshot of the volume mounted on a given
                        mountpoint. Example: ucamdsm --dsm_user user
                        --dsm_password abc123 create_snapshot --mp /mp
                        --replay_label test1 --retention 5
    delete_recycled_vols
                        Delete recycled volumes whose WWNs are listed in a
                        file. Example: ucamdsm --dsm_user user --dsm_password
                        abc123 delete_recycled_vols --wwns_file
                        /tmp/recycled_vols_wwns.txt
    map_volume          Maps the volume to local server and mounts it on the
                        specified mount point. Example: ucamdsm --dsm_user
                        user --dsm_password abc123 map_volume --wwn vol_wwn
                        --mp /d10
    unmap_volume        Unmaps the volume from local server. Volume must be
                        unmounted. Example: ucamdsm --dsm_user user
                        --dsm_password abc123 create_snapshot --wwn vol_wwn
    volume_from_snapshot
                        Clone a volume from a snapshot and mount it on a given
                        mountpoint. Example: ucamdsm --dsm_user user
                        --dsm_password abc123 volume_from_snapshot --sid
                        snapshot_id --rpid replay_profile_id --vol_name
                        clone_name --folder_id volume_folder_id --mp
                        target_mountpoint

optional arguments:
  -h, --help            show this help message and exit
  --dsm_host DSM_HOST   DSM hostname. Default: sc-data-ma.admin.cam.ac.uk
  --dsm_port DSM_PORT   DSM port. Default: 3033
  --dsm_user DSM_USER   DSM Data Collector username
  --dsm_password DSM_PASSWORD
                        DSM Data Collector password
  --is_secure IS_SECURE
                        Secure connection. Default: False
  --record_config RECORD_CONFIG
                        Record multipath and file system config details.
                        Default: False (do not record system config details)
  --file FILE           Read arguments from json file

For instance, to get the list of Dell Storage Centers:

$ ucamdsm --dsm_host host --dsm_user user --dsm_password password list --object scs --output json
07/10/2019 04:24:32 PM INFO Connected to DSM. API Version: 3.5, Connection ID: 0
07/10/2019 04:24:32 PM INFO API call ApiConnection/ApiConnection/0/StorageCenterList succeeded.
07/10/2019 04:24:32 PM INFO List of scs:
{
    "SB Storage Center": {
        "instanceId": "000",
        "hostOrIP": "x.x.x.x"
    },
    "WCDC Storage Center": {
        "instanceId": "000",
        "hostOrIP": "y.y.y.y"
    }
}
07/10/2019 04:24:32 PM INFO Logout of DSM: True.

You get prompted for user and password if they are not specified in the command.

$ ucamdsm --dsm_host host list --object scs --output json
Username: user
Password: 
07/16/2019 04:59:53 PM INFO Connected to DSM. API Version: 3.5, Connection ID: 0
07/16/2019 04:59:53 PM INFO API call ApiConnection/ApiConnection/0/StorageCenterList succeeded.
07/16/2019 04:59:53 PM INFO List of scs:
{
    "SB Storage Center": {
        "instanceId": "000",
        "hostOrIP": "x.x.x.x"
    },
    "WCDC Storage Center": {
        "instanceId": "000",
        "hostOrIP": "y.y.y.y"
    }
}
07/16/2019 04:59:53 PM INFO Logout of DSM: True.

The CLI can also read arguments from a json file like the one below:

{
    "dsm_host": "abc",
    "dsm_port": 3033,
    "dsm_user": "user",
    "dsm_password": "password",
    "is_secure": false,
    "record_config": false,
    "subparser": "list",
    "object": "scs",
    "output": "json"
}

To use a config file, use the option --file:

$ ucamdsm --file args.json
07/16/2019 05:05:57 PM INFO Connected to DSM. API Version: 3.5, Connection ID: 0
07/16/2019 05:05:58 PM INFO API call ApiConnection/ApiConnection/0/StorageCenterList succeeded.
07/16/2019 05:05:58 PM INFO List of scs:
{
    "SB Storage Center": {
        "instanceId": "000",
        "hostOrIP": "x.x.x.x"
    },
    "WCDC Storage Center": {
        "instanceId": "000",
        "hostOrIP": "y.y.y.y"
    }
}
07/16/2019 05:05:58 PM INFO Logout of DSM: True.

Application logging

Logs generated by the CLI are located in /var/log/ucamdsm/.

Resources

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ucamdsm-1.3.8.tar.gz (26.3 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page