client – HPLeftHandClient¶
HPLeftHand REST Client
| Author: | Kurt Martin |
|---|---|
| Description: | This is the LeftHand/StoreVirtual Client that talks to the |
LeftHand OS REST Service.
This client requires and works with version 11.5 of the LeftHand firmware
-
class
hplefthandclient.client.HPLeftHandClient(api_url)[source]¶ -
debug_rest(flag)[source]¶ This is useful for debugging requests to LeftHand
Parameters: flag (bool) – set to True to enable debugging
-
login(username, password)[source]¶ This authenticates against the LH OS REST server and creates a session.
Parameters: - username (str) – The username
- password (str) – The password
Returns: None
-
getCluster(cluster_id)[source]¶ Get information about a Cluster
Parameters: cluster_id (str) – The id of the cluster to find Returns: cluster
-
getClusterByName(name)[source]¶ Get information about a cluster by name
Parameters: name (str) – The name of the cluster to find Returns: cluster Raises: HTTPNotFound-NON_EXISTENT_CLUSTER - cluster doesn’t exist
-
getServer(server_id)[source]¶ Get information about a server
Parameters: server_id (str) – The id of the server to find Returns: server Raises: HTTPServerError
-
getServerByName(name)[source]¶ Get information about a server by name
Parameters: name (str) – The name of the server to find Returns: server Raises: HTTPNotFound-NON_EXISTENT_SERVER - server doesn’t exist
-
createServer(name, iqn, optional=None)[source]¶ Create a server by name
Parameters: - name (str) – The name of the server to create
- iqn – The iSCSI qualified name
- optional (dict) – Dictionary of optional params
optional = { 'description' : "some comment", 'iscsiEnabled' : True, 'chapName': "some chap name", 'chapAuthenticationRequired': False, 'chapInitiatorSecret': "initiator secret", 'chapTargetSecret': "target secret", 'iscsiLoadBalancingEnabled': True, 'controllingServerName': "server name", 'fibreChannelEnabled': False, 'inServerCluster": True }
Returns: server Raises: HTTPNotFound-NON_EXISTENT_SERVER - server doesn’t exist
-
deleteServer(server_id)[source]¶ Delete a Server
Parameters: server_id – the server ID to delete Raises: HTTPNotFound-NON_EXISTENT_SERVER - The server does not exist
-
getSnapshot(snapshot_id)[source]¶ Get information about a Snapshot
Returns: snapshot Raises: HTTPServerError
-
getSnapshotByName(name)[source]¶ Get information about a snapshot by name
Parameters: name – The name of the snapshot to find Returns: volume Raises: HTTPNotFound-NON_EXISTENT_SNAP - shapshot doesn’t exist
-
createSnapshot(name, source_volume_id, optional=None)[source]¶ Create a snapshot of an existing Volume
Parameters: - name (str) – Name of the Snapshot
- source_volume_id (int) – The volume you want to snapshot
- optional (dict) – Dictionary of optional params
optional = { 'description' : "some comment", 'inheritAccess' : false }
-
deleteSnapshot(snapshot_id)[source]¶ Delete a Snapshot
Parameters: snapshot_id – the snapshot ID to delete Raises: HTTPNotFound-NON_EXISTENT_SNAPSHOT - The snapshot does not exist
-
cloneSnapshot(name, source_snapshot_id, optional=None)[source]¶ Create a clone of an existing Shapshot
Parameters: - name (str) – Name of the Snapshot clone
- source_snapshot_id (int) – The snapshot you want to clone
- optional (dict) – Dictionary of optional params
optional = { 'description' : "some comment" }
-
getVolume(volume_id)[source]¶ Get information about a volume
Parameters: volume_id (str) – The id of the volume to find Returns: volume Raises: HTTPNotFound-NON_EXISTENT_VOL - volume doesn’t exist
-
getVolumeByName(name)[source]¶ Get information about a volume by name
Parameters: name – The name of the volume to find Returns: volume Raises: HTTPNotFound-NON_EXISTENT_VOL - volume doesn’t exist
-
createVolume(name, cluster_id, size, optional=None)[source]¶ Create a new volume
Parameters: - name (str) – the name of the volume
- cluster_id (int) – the cluster Id
- sizeKB (int) – size in KB for the volume
- optional (dict) – dict of other optional items
optional = { 'description': 'some comment', 'isThinProvisioned': 'true', 'autogrowSeconds': 200, 'clusterName': 'somename', 'isAdaptiveOptimizationEnabled': 'true', 'dataProtectionLevel': 2, }
Returns: List of Volumes Raises: HTTPConflict-EXISTENT_SV - Volume Exists already
-
deleteVolume(volume_id)[source]¶ Delete a volume
Parameters: name (str) – the name of the volume Raises: HTTPNotFound-NON_EXISTENT_VOL - The volume does not exist
-
modifyVolume(volume_id, optional)[source]¶ Modify an existing volume.
Parameters: volume_id (str) – The id of the volume to find Returns: volume Raises: HTTPNotFound-NON_EXISTENT_VOL - volume doesn’t exist
-
cloneVolume(name, source_volume_id, optional=None)[source]¶ Create a clone of an existing Volume
Parameters: - name (str) – Name of the Volume clone
- source_volume_id (int) – The Volume you want to clone
- optional (dict) – Dictionary of optional params
optional = { 'description' : "some comment" }
-