Skip to main content

QuantaStor REST API python library

Project description

QuantaStor

OSNEXUS QuantaStor Python Client Library


The python library for QuantaStor simplifies the process of automating QuantaStor management operations via python scripts. All of the published QuantaStor REST APIs as documented on the OSNEXUS documentation wiki are callable via the python client.


System Requirements for QuantaStor

The QuantaStor Python Client Library requires a QuantaStor box to interact with. The minimum requirements for your storage system vary based on the workload. Use our Solution Design Tools to help you find the solution that best fits your use-case and budget. The minimum requirements provided in this documentation serves as the bare minimum to explore using the software and its capabilities.

  • Intel Xeon or AMD x64 bit server (or virtual server)
  • 16GB RAM
  • 2x SSDs for system/boot drives
    • Boot drives should be hardware mirrored and should be atleast 64GB in size.
  • One or more disks per system for storage pools. (SSD/NVMe/PCI SSD/SATA/SAS/FC/iSCSI/AoE)
  • Download QuantaStor USB/ISO Installation Media for installation.

Installation

Install Quantastor

To use the QuantaStor Python Client Library, you must first install QuantaStor on your server hardware or use a QuantaStor virtual system. Installation of QuantaStor will also include python3. QuantaStor ISO files are created as hybrid ISO files which can be written to DVD media with DVD writting software or directly copied to a USB flash drive using dd. Follow the installation guide on our support wiki to get started. The installation guide provides instructions for installation and configuration on both server hardware and virtual machines.

Run pip Installer

Using the PYPI pip installer run the following command to install the quantastor python client library:

On Linux/Unix

$ sudo python3 -m pip install quantastor-qsclient

Testing qs_client Installation

Start the python3 interpreter:

$ python3

Import quantastor_sdk_enabled() function from the library:

>>> from quantastor.qs_client import quantastor_sdk_enabled

The following should print out 'True':

>>> print (quantastor_sdk_enabled())

Examples

See the ./examples/ directory for examples:

  1. Basic Example

The basic example for the QuantaStor Python Client Library (example.py) does one operation to get information about the storage system that is specified from the command line and dumps the response data in JSON format. You can use this Python script as a basic template to build off of for QuantaStor automation.

  1. StorageVolume

The file example_sv.sh is a bash script that utilizes two python scripts, vol_setup.py and acl_attach.py, to create an example storage volume and host. It then utilizes the qs-util QuantaStor tool-set to add a host initiator and login to an ISCSI session with the example storage volume.

  1. NetworkShare

The file example_ns.sh is a bash script that utilizes the shr_setup.py python script to create an example network share. Then using the zfs mount command, mounts the network share to the local mount directory /mnt/testMount.


Python Interpreter Usage

To quickly do operations from the commandline you can easily utilize the QuantaStor Python Client Library strait from the Python3 interpreter. Run the following commands in the python interpreter to set up a client connection to your QuantaStor server. Replace 'hostIP', 'username', and 'password' with your own credentials:

>>> from qs_client import QuantastorClient
>>> client = QuantastorClient('hostIP', 'username', 'password')

Requests are sent using HTTPS see the 'SSL Certs' section to learn to generate your own 'qs-ca-cert' to use for host verification. If you do not provide your own ca-cert, your client will warn you that 'requests cannot be verified'.

Once you have generated an instance of the 'QuantastorClient' class you can start making REST service calls to your QuantaStor server. The following is a simple example usage similar to the 'example.py' script:

>>> system = client.storage_system_get()

This command will return your QuantaStor storage system as a 'StorageSystem' object. You can view the meta of any object class in JSON format (pretty print) by using the StorageSystem.exportJson() function and the dumps() function from the python json module.

>>> import json
>>> print (json.dumps(system.exportJson(), sort_keys=True,  indent=4, separators=(',', ': ')))

For more information about our REST API methods and objects see our Reference Guide.


SSL Certs

The 'QuantastorClient' class supports HTTPS ca-cert verification. You can provide the full path to your certification file as the fourth argument when creating an instance of the 'QuantastorClient' class:

client = QuantastorClient('hostIP', 'username', 'password','/full/path/to/cert')

The certification path is an optional argument, but you will be warned that your requests cannot be verified if you do not provide one or if your certification path does not exist. If you do provide a valid ca-cert file, REST service calls will only succeed if your SSL verification succeeds.

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

quantastor-qsclient-6.2.1.tar.gz (113.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

quantastor_qsclient-6.2.1-py3-none-any.whl (221.1 kB view details)

Uploaded Python 3

File details

Details for the file quantastor-qsclient-6.2.1.tar.gz.

File metadata

  • Download URL: quantastor-qsclient-6.2.1.tar.gz
  • Upload date:
  • Size: 113.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for quantastor-qsclient-6.2.1.tar.gz
Algorithm Hash digest
SHA256 ab1db6d63904fb24a9e44041cdc6b0c89ca445bc2e580bfc205e047d0c9b3ddf
MD5 0b4326167a0e13916c442607ba181792
BLAKE2b-256 7ad7c91338824cd18cdc0a92d774af39a8b3eb4e64890bfa33e569e540d68e67

See more details on using hashes here.

File details

Details for the file quantastor_qsclient-6.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for quantastor_qsclient-6.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 500d45775a779f1e3f555bab24c4f7f4e1e84b1fd9b024550a95c95a61909a12
MD5 62d12383eb3c6c1a2a7a5cace5d9f656
BLAKE2b-256 15f4bff7fd47637dbc0554985f07d6b86e031828f8034bd1283c2a3e05f9bf25

See more details on using hashes here.

Supported by

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