ucampurestorage.lib package — ucampurestorage 1.0.1 documentation

# ucampurestorage.lib package

## Submodules

## ucampurestorage.lib.httpclient module

class ucampurestorage.lib.httpclient.HttpClient(host: any, port: int, user: str, password: any, token: any, verify: bool)

  Bases: `object`

  API_VERSION = '2.17'
  delete(url, payload=None)

    Perform a REST DELETE request.

  get(url)

    Perform a REST GET request.

  patch(url, payload)

    Perform a REST PATCH request.

  post(url, payload)

    Perform a REST POST request.

  put(url, payload)

    Perform a REST PUT request.

## ucampurestorage.lib.options module

class ucampurestorage.lib.options.LoadFromFile(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)

  Bases: `argparse.Action`

class ucampurestorage.lib.options.Options

  Bases: `object`

  parse(args=None)

    Parse given arguments and execute an action accordingly.

ucampurestorage.lib.options.clone_volume(args)

  Clone volume on Pure storage and mount to the local server.

  Example 1: ucampurestorage –client_id=<clientID> –key_id=<KeyID> –user=<User> –password=<passwd> –client_name=<ClientName> –keyfile=”privatekey.pem” volume clone –name TEST113_clone –srcvol TEST113 –target_mp /t2

  Example 2: ucampurestorage –file=./ucampurestorage/lib/secrets.json volume clone –name TEST113_clone –srcvol TEST113 –target_mp /t2

ucampurestorage.lib.options.clone_volumes(args)

ucampurestorage.lib.options.connect_volume(args)

  Connect Volume to the host on the Pure storage.

  Example 1: ucampurestorage –client_id=<clientID> –key_id=<KeyID> –user=<User> –password=<passwd> –client_name=<ClientName> –keyfile=”privatekey.pem” volume connect –hostname HOST01 –volname TEST113

  Example 2: ucampurestorage –file=./ucampurestorage/lib/secrets.json volume connect –hostname HOST01 –volname TEST113

  [optionally define the LUNID] Example 3: ucampurestorage –client_id=<clientID> –key_id=<KeyID> –user=<User> –password=<passwd> –client_name=<ClientName> –keyfile=”privatekey.pem” volume connect –hostname HOST01 –volname TEST113 –lunid 77

  Example 4: ucampurestorage –file=./ucampurestorage/lib/secrets.json volume connect –hostname HOST01 –volname TEST113 –lunid 77

ucampurestorage.lib.options.create_host(args)

  Create host defination on the Purestorage.

  Example 1: ucampurestorage –client_id=<clientID> –key_id=<KeyID> –user=<User> –password=<passwd> –client_name=<ClientName> –keyfile=”privatekey.pem” host create –name <HOSTNAME> –iqn <IQN number> –personality <aix,esxi,hpux,solaris,vms,oracle-vm-server,none>

  Example 2: ucampurestorage –file=./ucampurestorage/lib/secrets.json host create –name <HOSTNAME> –iqn <IQN number> –personality <aix,esxi,hpux,solaris,vms,oracle-vm-server,none>

ucampurestorage.lib.options.create_snapshot(args)

  Create snapshot of the volume on the Pure storage.

  Example 1: ucampurestorage –client_id=<clientID> –key_id=<KeyID> –user=<User> –password=<passwd> –client_name=<ClientName> –keyfile=”privatekey.pem” snapshot create –srcvol TEST113 –suffix snap01

  Example 2: ucampurestorage –file=./ucampurestorage/lib/secrets.json snapshot create –srcvol TEST113 –suffix snap01

ucampurestorage.lib.options.create_token(args)

  Generate Pure Storage token.

  Example: ucampurestorage –client_id=<clientID> –key_id=<KeyID> –user=<User> –password=<passwd>

    –client_name=<ClientName> –keyfile=”privatekey.pem” tokengen

  Example 2: ucampurestorage –file=./ucampurestorage/lib/secrets.json tokengen

ucampurestorage.lib.options.create_volume(args)

  Create Volume on the Pure storage.

  Example 1: ucampurestorage –client_id=<clientID> –key_id=<KeyID> –user=<User> –password=<passwd> –client_name=<ClientName> –keyfile=”privatekey.pem” volume create –name TEST113 –size 1T

  Example 2: ucampurestorage –file=./ucampurestorage/lib/secrets.json volume create –name TEST113 –size 1T

ucampurestorage.lib.options.delete_host(args)

  Delete host defination on the Pure Storage.

  Example 1: ucampurestorage –client_id=<clientID> –key_id=<KeyID> –user=<User> –password=<passwd> –client_name=<ClientName> –keyfile=”privatekey.pem” host delete –name <HOSTNAME>

  Example 2: ucampurestorage –file=./ucampurestorage/lib/secrets.json host delete –name <HOSTNAME>

ucampurestorage.lib.options.delete_snapshot(args)

  Delete snapshot of the volume on the Pure storage.

  Example 1: ucampurestorage –client_id=<clientID> –key_id=<KeyID> –user=<User> –password=<passwd> –client_name=<ClientName> –keyfile=”privatekey.pem” snapshot delete –snapname TEST113.snap01

  Example 2: ucampurestorage –file=./ucampurestorage/lib/secrets.json snapshot delete –snapname TEST113.snap01

ucampurestorage.lib.options.delete_volume(args)

  Delete Volume from the Pure storage.

  Example 1: ucampurestorage –client_id=<clientID> –key_id=<KeyID> –user=<User> –password=<passwd> –client_name=<ClientName> –keyfile=”privatekey.pem” volume delete –name TEST113

  Example 2: ucampurestorage –file=./ucampurestorage/lib/secrets.json volume delete –name TEST113

ucampurestorage.lib.options.detail_host(args)

  List the detail information of the host connected to the Pure Storage.

  Example 1: ucampurestorage –client_id=<clientID> –key_id=<KeyID> –user=<User> –password=<passwd> –client_name=<ClientName> –keyfile=”privatekey.pem” host list –name cs-dev-db2

  Example 2: ucampurestorage –file=./ucampurestorage/lib/secrets.json host list –name cs-dev-db2

  Example 3: ucampurestorage –file=./ucampurestorage/lib/secrets.json host list –name cs-dev-db2 –format=json

ucampurestorage.lib.options.detail_volume(args)

  List the detail information of the volume from the Pure Storage.

  Example 1: ucampurestorage –client_id=<clientID> –key_id=<KeyID> –user=<User> –password=<passwd> –client_name=<ClientName> –keyfile=”privatekey.pem” volume list –name TEST113

  Example 2: ucampurestorage –file=./ucampurestorage/lib/secrets.json volume list –name TEST113

  Example 3: ucampurestorage –file=./ucampurestorage/lib/secrets.json volume list –name TEST113 –format=json

ucampurestorage.lib.options.disconnect_volume(args)

  Disconnect Volume from the host on the Pure storage.

  Example 1: ucampurestorage –client_id=<clientID> –key_id=<KeyID> –user=<User> –password=<passwd> –client_name=<ClientName> –keyfile=”privatekey.pem” volume disconnect –hostname HOST01 –volname TEST113

  Example 2: ucampurestorage –file=./ucampurestorage/lib/secrets.json volume disconnect –hostname HOST01 –volname TEST113

ucampurestorage.lib.options.eradicate_volume(args)

  eradicate Volume from the Pure storage.

  Example 1: ucampurestorage –client_id=<clientID> –key_id=<KeyID> –user=<User> –password=<passwd> –client_name=<ClientName> –keyfile=”privatekey.pem” volume eradicate –name TEST113

  Example 2: ucampurestorage –file=./ucampurestorage/lib/secrets.json volume eradicate –name TEST113

ucampurestorage.lib.options.host_operations(args)

  Perform Pure Storage host level Operations.

  Example: ucampurestorage –client_id=<clientID> –key_id=<KeyID> –user=<User> –password=<passwd>

    –client_name=<ClientName> –keyfile=”privatekey.pem” host {list,create,delete}

  Example 2: ucampurestorage –file=./ucampurestorage/lib/secrets.json host {list,create,delete}

ucampurestorage.lib.options.list_object(args)

  List Pure Storage objects.

  Example 1: ucampurestorage –client_id=<clientID> –key_id=<KeyID> –user=<User> –password=<passwd>

    –client_name=<ClientName> –keyfile=”privatekey.pem” list –object controllers

  Example 2: ucampurestorage –file=./ucampurestorage/lib/secrets.json list –object controllers

  Example 3: ucampurestorage –file=./ucampurestorage/lib/secrets.json list –object controllers –format=json

ucampurestorage.lib.options.list_snapshots(args)

  List the detail information of the snapshot from the Pure Storage.

  Example 1: ucampurestorage –client_id=<clientID> –key_id=<KeyID> –user=<User> –password=<passwd> –client_name=<ClientName> –keyfile=”privatekey.pem” snapshot list –volname TEST12

  Example 2: ucampurestorage –file=./ucampurestorage/lib/secrets.json snapshot list –volname TEST12

  Example 3: ucampurestorage –file=./ucampurestorage/lib/secrets.json snapshot list –volname TEST12 –format=json

ucampurestorage.lib.options.map_volume(args)

  Map volume to the local server which is provided by Pure storage.

  Example 1: ucampurestorage –client_id=<clientID> –key_id=<KeyID> –user=<User> –password=<passwd> –client_name=<ClientName> –keyfile=”privatekey.pem” volume map –name TEST113 –mp /t2

  Example 2: ucampurestorage –file=./ucampurestorage/lib/secrets.json volume map –name TEST113 –mp /t2

  [NOTE: New volume need to be formated therefore -new flag is required]

  Example 3: ucampurestorage –file=./ucampurestorage/lib/secrets.json volume map –name TEST113_new –mp /t2 -new

  Example 4: ucampurestorage –client_id=<clientID> –key_id=<KeyID> –user=<User> –password=<passwd> –client_name=<ClientName> –keyfile=”privatekey.pem” volume map –name TEST113 –mp /t2 -new

ucampurestorage.lib.options.replace_volume(args)

  Replace the mounted clone volume with new clone from Pure storage and mount to the local server.

  Example 1: ucampurestorage –client_id=<clientID> –key_id=<KeyID> –user=<User> –password=<passwd> –client_name=<ClientName> –keyfile=”privatekey.pem” volume replace –src_mp /t1 –dst_mp /t2

  Example 2: ucampurestorage –file=./ucampurestorage/lib/secrets.json volume replace –src_mp /t1 –dst_mp /t2

ucampurestorage.lib.options.run_option(subparser, args)

  Runs a ucampurestorage subcommand. :param subparser: the subcommand to run. :param args: args to pass to the ucampurestorage subcommand. :return: result of the executed subcommand.

ucampurestorage.lib.options.snap_operations(args)

  Perform Pure Storage Snapshot level Operations.

  Example: ucampurestorage –client_id=<clientID> –key_id=<KeyID> –user=<User> –password=<passwd> –client_name=<ClientName> –keyfile=”privatekey.pem” snapshot {list,create,delete}

  Example 2: ucampurestorage –file=./ucampurestorage/lib/secrets.json snapshot {list,create,delete}

ucampurestorage.lib.options.str2bool(v)

ucampurestorage.lib.options.unmap_volume(args)

  Map volume to the local server which is provided by Pure storage.

  Example 1: ucampurestorage –client_id=<clientID> –key_id=<KeyID> –user=<User> –password=<passwd> –client_name=<ClientName> –keyfile=”privatekey.pem” volume unmap –name TEST113

  Example 2: ucampurestorage –file=./ucampurestorage/lib/secrets.json volume unmap –name TEST113

  [optionally define the WWN]

  Example 3: ucampurestorage –client_id=<clientID> –key_id=<KeyID> –user=<User> –password=<passwd> –client_name=<ClientName> –keyfile=”privatekey.pem” volume unmap –wwn <WWN number>

  Example 4: ucampurestorage –file=./ucampurestorage/lib/secrets.json volume unmap –wwn <WWN number>

  [optionally define the mountpoint]

  Example 5: ucampurestorage –client_id=<clientID> –key_id=<KeyID> –user=<User> –password=<passwd> –client_name=<ClientName> –keyfile=”privatekey.pem” volume unmap –mp /t1

  Example 6: ucampurestorage –file=./ucampurestorage/lib/secrets.json volume unmap –mp /t1

ucampurestorage.lib.options.volume_operations(args)

  Perform Pure Storage volume level Operations.

  Example: ucampurestorage –client_id=<clientID> –key_id=<KeyID> –user=<User> –password=<passwd> –client_name=<ClientName> –keyfile=”privatekey.pem” volume {list,create,delete,eradicate,connect, disconnect,map,unmap,replace,clone}

  Example 2: ucampurestorage –file=./ucampurestorage/lib/secrets.json volume {list,create,delete,eradicate, connect,disconnect,map,unmap,replace,clone}

## ucampurestorage.lib.process module

Utilities for linux filesystems administration

class ucampurestorage.lib.process.Process

  Bases: `object`

  add_entry_in_fstab(fs_device, mountpoint, fstype='ext4', opts='_netdev')

    Adds fs_device in FSTAB_CONF file.

    Parameters

      - fs_device – fs device to add.

      - mountpoint – mountpoint of fs device.

      - fstype – fs type of fs device.

    Returns

      True for success, False for error.

  add_multipath_alias(wwn)

    Adds a multipath alias to MULTIPATH_CONF file.

    Parameters

      wwn – wwn to add to MULTIPATH_CONF.

    Returns

      True for success, False for error.

  backup_file(file_, backup_dir)

    Backups a file.

    Copies file_ to backup_dir directory and name the new file file.timestamp.

    Parameters

      - file – the full path and the name of the file to back up.

      - backup_dir – the path of the new file.

    Returns

      True if backup task succeeded, False, otherwise.

  create_dir(path)

    Create a directory if provided.

    Returns

      True for success, False for error.

  create_partition(dev: str) → bool

    Create partition on the dev.

    Args:

      dev (str): multipath dev path

    Returns:

      bool: TRUE if dev is partitioned

  daemon_reload()

    Reloads systemd manager configuration

    Returns

      True for success, False for error.

  delete_raw_devices(raw_device)

    Deletes a raw device.

    Parameters

      raw_device – raw device to delete.

    Returns

      True for success, False for error.

  format_partition_with_ext4(part: str) → bool

    Format the partition with ext4.

    Args:

      part (str): partition name crated on the local system.

    Returns:

      bool: TRUE if partition is updated

  generate_devicemapper_alias()

    Generates a new device mapper alias.

    Returns

      alias name, None for error.

  get_fsdevice_from_mountpoint(mountpoint)

    Gets filesystem device from mountpoint.

    Example: mountpoint = /d03 –> fsdevice = /dev/mapper/vold03p1.

    Parameters

      mountpoint – the mountpoint to look for its filesystem device.

    Returns

      fsdevice or None if fsdevice not found.

  get_hostname()

    Gets hostname of local server.

    Returns

      server’s hostname or None for error.

  get_index_in_list(index_list)

    Returns the available index in a list of int.

    If index_list is empty, return 1. If no index is available, return max index in the list + 1.

    Parameters

      index_list – list of int.

    Returns

      index.

  get_local_mountpoints()

    fetch information regarding local filesystem.

    Returns:

      list: All the mounted partitions or False if command fails

  get_mountpoint_from_devicename(device_name)

    Gets mountpoint from devicename.

    Example: device = /dev/mapper/vold03p1 –> mountpoint = /d03.

    Parameters

      device_name – the device_name to look for its mountpoint.

    Returns

      mountpoint or None if fsdevice not found.

  get_mpath_from_mountpoint(mountpoint)

    Gets mpath from mountpoint.

    Example: mountpoint = /d03 –> mpath = /dev/mapper/vold03.

    Parameters

      mountpoint – the mountpoint to look for its mpath.

    Returns

      mpath of mountpoint, or None if no mpath is found.

  get_mpath_from_wwn(wwn)

    Gets mpath of a wwn by looking in multipath -ll output.

    Example: wwn = ‘6000d31000e3940000000000000001fd’ –> mpath = vold03.

    Parameters

      mpath – mpath to look for its wwn.

    Returns

      mpath or None if mpath is not found.

  get_multipath_raw_devices(wwid)

    Gets multipath raw devices of a multipath device.

    Example: wwid = 360dd0d31000e39600000000000000073e –> [‘sdc’, ‘sdb’].

    Parameters

      wwid – wwid of the multipath.

    Returns

      list of multipath raw devices, None for error.

  get_release()

    Returns OS release

  get_wwid_from_wwn(wwn)

    Obtains wwid from wwn by looking at multipath -ll command output.

    Parameters

      wwn – wwn to look for its wwid.

    Returns

      wwid for success, None on error.

  get_wwn_from_mpath(mpath_device)

    Gets wwn of a mpath.

    Example: mpath = vold03p1 –> wwn = ‘6000d31000e3940000000000000001fd’.

    Parameters

      mpath_device – mpath device to look for its wwn.

    Returns

      wwn of mpath device, None otherwise.

  is_device_in_fstab(device)

    Checks if device is in FSTAB_CONF file.

    Parameters

      device – device to check in FSTAB_CONF.

    Returns

      True if device in FSTAB_CONF, otherwise, False.

  is_device_valid(device)

    Checks if device name is valid.

    A valid device name should start with ‘/dev/mapper/vold’ and ends with ‘p1’.

    Parameters

      device – device name to check.

    Returns

      True if device name is valid, otherwise, False.

  is_dir_empty(path)

    Checks if a directory is empty.

    Parameters

      path – path of the directory to check.

    Returns

      True if the directory, False otherwise.

  is_dir_exist(path)

    Checks if a directory is exists.

    Parameters

      path – path of the directory to check.

    Returns

      True if the directory, False otherwise.

  is_string_in_file(string, filename)

    Checks if a string is in filename.

    Parameters

      - string – the string to look for in the file.

      - file – the file to search in.

    Returns

      True if string in file, False, otherwise.

  is_wwn_mounted(wwn)

    Checks if a device with wwn is mounted.

    Parameters

      wwn – wwn of the device to check.

    Returns

      mountpoint if the device is mounted, None, otherwise.

  is_wwn_serial_valid(wwn)

    Checks if wwn is valid.

    A valid WWN should have 32 or 33 characters.

    Parameters

      wwn – the wwn to check

    Returns

      True if wwn is valid, otherwise, False.

  is_wwn_valid(wwn)

    Checks if wwn is valid.

    A valid WWN should have 32 or 33 characters.

    Parameters

      wwn – the wwn to check

    Returns

      True if wwn is valid, otherwise, False.

  mount(fs)

    Mounts a filesystem or mountpoint if provided.

    Returns

      True for success, False for error.

  mountpoint_exists(mountpoint)

    Checks if mountpoint exists.

    Parameters

      mountpoint – mountpoint to check.

    Returns

      True if the mountpoint exists, False otherwise.

  read_file(filename)

    Reads a file.

    Parameters

      filename – the name of file to read.

    Returns

      content of the file to read, or None on error.

  record_config_details()

    Logs df, multipath, and fstab config details.

  reload_multipathd()

    Reloads the multipathd service.

    Returns

      True for success, False for error.

  remove_entry_from_fstab(fs_device)

    Removes fs_device from FSTAB_CONF file.

    Parameters

      fs_device – fs device to remove.

    Returns

      True for success, False for error.

  remove_multipath_entry(wwn, alias)

    Removes a multipath entry from MULTIPATH_CONF file.

    Parameters

      - wwn – wwn of the multipath entry to remove.

      - alias – alias of the multipath entry to remove

    Returns

      True for success, False for error.

  rescan_scsibus()

    Scans SCSI bus on local server.

    Returns

      True for success, False on error.

  run(command, stdin=- 1, stdout=- 1)

    Runs a Shell command.

    Parameters

      - command – command to run.

      - stdin – stdin of the command execution, default: subprocess.PIPE.

      - stdout – stdout of the command execution, default: subprocess.PIPE.

    Returns

      tuple (return_code, stdout_data, stderr_data).

  umount(fs)

    Unmounts a filesystem, or mountpoint if provided.

    Returns

      True for success, False for error.

  update_system_partition(part: str) → bool

    Update about the partition to the local system.

    Args:

      part (str): partition name crated on the local system.

    Returns:

      bool: TRUE if partition is updated

## ucampurestorage.lib.pureconnect module

class ucampurestorage.lib.pureconnect.PureAdvanceConnection(host: any, port: int, user: str, password: any, token: any, verify: bool)

  Bases: `ucampurestorage.lib.pureconnect.SystemTask`

  clone_volume(cln_name: str, src_name: str, mt_pt: str = None) → bool

    Create clone volume.

    Args:

      cln_name (str): Name of the clone volume to be create on PureStorage Array src_name (str): Name of the source volume for which clone need to be created on PureStorage Array

    Returns:

      boolean: True for success, False on error.

  connect_volume(hostname: str, volname: str, **kwargs) → bool

    Connect volume.

    Args:

      hostname (str): Name of the host specified on PureStorage Array with which volume need to be connect volname (str): Name of the volume specified on PureStorage Array which need to be connect

    Returns:

      boolean: True for success, False on error.

  create_host(iqn: str, name: str, personality: str) → bool

    Create host.

    Args:

      name (str): Name of the Host to be create on PureStorage Array iqn (str): iqn of Host Eg: “” personality (str): personality of the host

    Returns:

      boolean: True for success, False on error.

  create_snapshot(name: str, suffix: str) → bool

    Create Snapshot of the volume.

    Args:

      name (str): Name of the volume for which snapshot to be create on PureStorage Array suffix (str): suffix of the snapshot

    Returns:

      boolean: True for success, False on error.

  create_volume(size: str, name: str) → bool

    Create volume.

    Args:

      name (str): Name of the volume to be create on PureStorage Array size (str): Capacity of volume Eg: “1T”, “300G”, “20M”

    Returns:

      boolean: True for success, False on error.

  delete_host(name: str) → bool

    Delete host.

    Args:

      name (str): Name of the host to be deleted on PureStorage Array

    Returns:

      boolean: True for success, False on error.

  delete_snapshot(name: str) → bool

    Delete snapshot.

    Args:

      name (str): Name of the snapshot to be deleted on PureStorage Array

    Returns:

      boolean: True for success, False on error.

  delete_volume(name: str) → bool

    Delete volume.

    Args:

      name (str): Name of the volume to be deleted on PureStorage Array

    Returns:

      boolean: True for success, False on error.

  disconnect_volume(hostname: str, volname: str) → bool

    Remove the connection of volume from .

    Args:

      hostname (str): Name of the host specified on PureStorage Array with which volume need to be connect volname (str): Name of the volume specified on PureStorage Array which need to be connect

    Returns:

      boolean: True for success, False on error.

  eradicate_volume(name: str) → bool

    Eradicate volume.

    Args:

      name (str): Name of the volume to be eradicate on PureStorage Array

    Returns:

      boolean: True for success, False on error.

  map_volume(name, mountpoint=None, new_vol=False)

    Map volume to local server and mount it to mountpoint.

    Args:

      name (str): Name of the volume to map to local server. mountpoint (str): Name of the mountpoint on local server to be mounted new_vol (bool): Is the volume name newly created in PureStorage Array

    Returns:

      boolean: True for success, False on error.

  replace_volume(src_mountpoint, dst_mountpoint, unmount_src_mp)

    Clones the volume mounted on src_mountpoint and mount it on dst_mountpoint, the volume that was mounted on dst_mountpoint will be deleted.

    Parameters

      - src_mountpoint – mountpoint of the volume to be cloned.

      - dst_mountpoint – mountpoint of the clone volume.

      - unmount_src_mp – If True, unmount the source mountpoint, otherwise, not.

    Returns

      True for success, False on error.

  unmap_volume(name=None, wwn=None, mp=None)

    Unmaps a Pure Storage volume with WWN. Unmounting the volume should be performed manually.

    Parameters

      - name – name of the volume to unmap.

      - wwn – wwn of the volume to unmap.

      - mp – mountpoint of the localsever to unmap.

    Returns

      True for success, False on error.

class ucampurestorage.lib.pureconnect.PureConnection(host: any, port: int, user: str, password: any, token: any, verify: bool)

  Bases: `object`

  Pure Storage API interface.

  Handles calls to Pure Storage Management via the REST API interface.

  get_arrays()

    Gets all arrays and updates self.arrays. :returns: True for success, False on error.

  get_controllers()

    Gets all controllers and updates self.controllers. :returns: True for success, False on error.

  get_hostgroups()

    Gets all host-groups and updates self.hostgroups. :returns: True for success, False on error.

  get_hosts(name=None)

    Gets all hosts and updates self.hosts. :returns: True for success, False on error.

  get_networkports()

    Gets all networkports and updates self.target-ports. :returns: True for success, False on error.

  get_pods()

    Gets all pods and updates self.pods. :returns: True for success, False on error.

  get_protectiongroups()

    Gets all networkports and updates self.target-ports. :returns: True for success, False on error.

  get_protectiongroupsnapshots()

    Gets all networkports and updates self.target-ports. :returns: True for success, False on error.

  get_protectiongroupvolmembers()

    Gets all volumes in protection-groups and updates self.protectiongroupvolmembers. :returns: True for success, False on error.

  get_remotepods()

    Gets all pods and updates self.pods. :returns: True for success, False on error.

  get_targetports()

    Gets all ports and updates self.target-ports. :returns: True for success, False on error.

  get_vol_clones(src_name)
  get_vol_destroyed()
  get_vol_name_by_devwwn(wwn)
  get_volumeconnections(name=None)

    Gets all connections and updates self.volumeconnections. :returns: True for success, False on error.

  get_volumegroups()

    Gets all volume-groups and updates self.volumegroups. :returns: True for success, False on error.

  get_volumes(name=None)

    Gets all volumes and updates self.volumes. :returns: True for success, False on error.

  get_volumesnapshots(name=None)

    Gets all volume-snapshots and updates self.volumesnapshots. :returns: True for success, False on error.

  run_list_object(object_type)

    Returns the result of get object functions and updates the corresponding data structures.

    Parameters

      object_type – the object type to list.

    Returns

      couple of (result of object get function, object data structure)

class ucampurestorage.lib.pureconnect.SystemTask(host: any, port: int, user: str, password: any, token: any, verify: bool)

  Bases: `ucampurestorage.lib.pureconnect.PureConnection`

  generate_clone_name(volume_name)

    Generates a clone name from a volume name.

    Parameters

      volume_name – the volume name from which to generate a clone name.

    Returns

      clone name, None, otherwise.

  get_local_mountpoints()
  get_local_server_name_on_array()

    Returns local server ID, or None on error.

  get_mountpoint_info(mountpoint=None)

    Returns details of volume with WWN wwn or mounted on mountpoint.

    Parameters

      - name – volume’s name.

      - mountpoint – mountpoint where the volume is mounted.

    Returns

      str wwn, None, otherwise.

ucampurestorage.lib.pureconnect.converttobytes(value, fromtype, bsize=1024)

  Converts megabytes to bytes, etc. sample code:

  > print(‘mb= ‘ + str(bytesto(314575262000000, ‘m’)))

  sample output:

    mb= 300002347.946

ucampurestorage.lib.pureconnect.totalbytes(value: str) → int

## ucampurestorage.lib.tokencreater module

Token Generation module.

class ucampurestorage.lib.tokencreater.TokenCreater

  Bases: `object`

  Generate Token for the API CALLs

  current_token_modify(**kwarg)

    Updating the token of the instance on the new token request.

    Returns:

      str: provide the new token.

  token_create_datetime(**kwarg)

    Provide date and time of the token creation.

    Returns:

      datetime: date and time of token creation

  token_generation(client_id: str, key_id: str, client_name: str, key_file_private: str, username: str, fa_fqdn_ip: any, password=None, output_file=None) → str

    Generation of the Token.

    Args:

      client_id (str): Client ID created on PureStorage for API calls key_id (str): Key ID generated on PureStorage while creating client ID for API calls client_name (str): Client Name created for the api call key_file_private (str): location of the private key file username (str): username of the purestorage fa_fqdn_ip (any): FQDN of the PureStorage password (_type_, optional): password of the pure storage. Defaults to None. output_file (_type_, optional): Location of file if the file need to be redirected. Defaults to None.

    Returns:

      str: :Provide the token for API call

  token_jsonformat()

    format data with token and creation date.

    Returns:

      dict: dictory information of token and creation date

  token_output_file(output_file)

    Perform the write operation on a file.

    Args:

      output_file (str): filename need to be written with information.

  token_output_json(output_file)

    Perform the write operation on a file in json format.

    Args:

      output_file (str): filename need to be written with information.

## Module contents