Skip to main content

ScaleIO API client

Project description

https://travis-ci.org/gmmephisto/pyscaleio.svg?branch=master https://coveralls.io/repos/github/gmmephisto/pyscaleio/badge.svg?branch=master

Python library that provides convenient way to interact with ScaleIO REST API.

  • Supported ScaleIO versions: 2.0

  • Supported Python versions: 2.6, 2.7, 3.4, 3.5, 3.6

Library is under development!

Features

Currently supported:

  • Simple API client with base methods according to ScaleIO documentation

  • ORM-like models (StoragePool, Volume, etc.)

  • Scheme validation for API responses

TODO:

  • HATEOAS links processing

Installation

Install via pip:

$ pip install pyscaleio

Install as RPM package using yum or dnf on Fedora/RHEL/CentOS:

$ dnf copr enable miushanov/pyscaleio
$ dnf install python-scaleio

Usage

  • Create and register API client:

import pyscaleio

# create API client
client = pyscaleio.ScaleIOClient.from_args("gateway_address", "admin", "password")

# register it for using in models
pyscaleio.add_client(client)
  • Find and modify resources:

# get all volumes in cluster
volumes = pyscaleio.Volume.all()
assert len(volumes) == 1

# or, get volume by specified id
volume = pyscaleio.Volume.one_by_name("test_volume")

# and access some volume attributes
assert volume.name == "test_volume"
assert volume.size == 8 * constants.GIGABYTE

# or, resize it to new size
volume.resize(16)

volume.update()  # updates model data
assert volume.size == 16 * constants.GIGABYTE
  • Create or delete resources:

# create new volume in storage pool
volume = pyscaleio.Volume.create(16, "storage_pool_id", "new_volume")
assert volume.name == "new_volume"
assert volume.size == 16 * constants.GIGABYTE

# delete volume
volume = pyscaleio.Volume.one_by_name("test_volume")
volume.delete()
  • Tune client and models options:

pyscaleio.configure(
   # retries count for each request
   request_retries=0,
   # network timeout for requests
   network_timeout=30,
   # name of exported volume (according to udev/rules.d)
   volume_name="emc-2{system_id}{volume_id}",
   # prefix of exported volume
   volume_prefix="/dev/disk/by-id")

volume = pyscaleio.Volume.one_by_name("test_volume")
assert volume.path == "/dev/disk/by-id/emc-27947a0127a79ce60ca29f20900000008"

Tests

Tests for this library divided to unit tests and functional tests. Functional tests requires ScaleIO installation and available REST API Gateway service. For running functional tests use tox environment with name functional with passed variables:

  • scaleio_host - IP address or hostname of ScaleIO REST API Gateway

  • scaleio_user - username

  • scaleio_passwd - password

  • scaleio_is_secure - 1 for using https scheme otherwise 0 (optional)

  • scaleio_trace - level of logging to stderr (optional)

Example:

$ scaleio_host=localhost scaleio_user=admin scaleio_passwd=passwd tox -e functional

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

pyscaleio-0.1.6.tar.gz (22.6 kB view details)

Uploaded Source

Built Distribution

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

pyscaleio-0.1.6-py2.py3-none-any.whl (13.4 kB view details)

Uploaded Python 2Python 3

File details

Details for the file pyscaleio-0.1.6.tar.gz.

File metadata

  • Download URL: pyscaleio-0.1.6.tar.gz
  • Upload date:
  • Size: 22.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/2.7

File hashes

Hashes for pyscaleio-0.1.6.tar.gz
Algorithm Hash digest
SHA256 656dfaaca5e4072684303a78ea0809f2924fa02ba75e2232807c960ada8241ab
MD5 69d1feaa11b3186f1383cc056a4397ab
BLAKE2b-256 402ca784003d19b8709877ef5b611064ad1978ed6da474dd3554b324c75fd413

See more details on using hashes here.

File details

Details for the file pyscaleio-0.1.6-py2.py3-none-any.whl.

File metadata

  • Download URL: pyscaleio-0.1.6-py2.py3-none-any.whl
  • Upload date:
  • Size: 13.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/2.7

File hashes

Hashes for pyscaleio-0.1.6-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 46b12fda8f3c9a9a4410fd44977f8fdf6d1b69319421384264006f025c1e7c4f
MD5 1eb5f55cb5fee8a3742a50b8b689ea3a
BLAKE2b-256 fd756ad56161081d5b5e70e7606beab97c1c366cc124698687be4e0f42668421

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