### Connect to PowerStore and Perform Operations Source: https://github.com/dell/python-powerstore/blob/main/README.md Example demonstrating how to establish a connection to a Dell PowerStore appliance using provided credentials and IP address. It also shows how to create a volume, retrieve all replication rules, and get network configurations. ```python from PyPowerStore import powerstore_conn conn = powerstore_conn.PowerStoreConn('user', 'password', 'IP', False) volume_create = conn.provisioning.create_volume(name='foo', size=1073741824) all_replication_rules = conn.protection.get_replication_rules() all_networks = conn.config_mgmt.get_networks() ``` -------------------------------- ### Install PyPowerStore from Source Source: https://github.com/dell/python-powerstore/blob/main/README.md Install PyPowerStore directly from the source code repository. Navigate to the project root containing the setup.py file before running the command. ```bash pip install . ``` -------------------------------- ### Install PyPowerStore from PyPI Source: https://github.com/dell/python-powerstore/blob/main/README.md Install a specific version of PyPowerStore from the Python Package Index. Replace `` with the desired version number. ```bash pip install PyPowerStore== ``` -------------------------------- ### Get Appliance Performance Metrics Source: https://context7.com/dell/python-powerstore/llms.txt Retrieve near-real-time performance metrics for a specific appliance. Choose the desired interval for data collection. ```python # Get 5-second performance metrics for appliance A1 metrics = conn.metrics.get_performance_metrics( entity="performance_metrics_by_appliance", entity_id="A1", interval="Five_Sec", # options: Best_Available, Five_Sec, Twenty_Sec, Five_Mins, One_Hour, One_Day ) print(metrics) ``` -------------------------------- ### Get File System Tree Quota Details Source: https://context7.com/dell/python-powerstore/llms.txt Retrieve detailed information about a specific tree quota using its ID. ```python detail = conn.provisioning.get_tree_quota(tree_quota_id=tree_quota["id"]) ``` -------------------------------- ### Get Volume Performance Metrics Source: https://context7.com/dell/python-powerstore/llms.txt Retrieve performance metrics for a specific volume. The `interval` parameter determines the granularity of the data. ```python # Volume performance metrics vol_metrics = conn.metrics.get_performance_metrics( entity="performance_metrics_by_volume", entity_id="vol-uuid", interval="Five_Mins", ) ``` -------------------------------- ### Update File System User Quota Source: https://context7.com/dell/python-powerstore/llms.txt Modify an existing user quota. This example increases the hard limit for the specified user. ```python conn.provisioning.update_user_quota(user_quota["id"], {"hard_limit": 10737418240}) ``` -------------------------------- ### Update File System Tree Quota Source: https://context7.com/dell/python-powerstore/llms.txt Modify an existing tree quota. This example extends the hard limit. ```python conn.provisioning.update_tree_quota( tree_quota["id"], {"hard_limit": 21474836480}, # extend to 20 GiB ) ``` -------------------------------- ### PowerStoreConn — Establish a Connection Source: https://context7.com/dell/python-powerstore/llms.txt The `PowerStoreConn` class is the single entry point for all SDK operations. It authenticates with the PowerStore array and initialises all sub-module clients. ```APIDOC ## PowerStoreConn — Establish a Connection The `PowerStoreConn` class is the single entry point for all SDK operations. It authenticates with the PowerStore array and initialises all sub-module clients. ```python from PyPowerStore import powerstore_conn conn = powerstore_conn.PowerStoreConn( username="admin", password="Password123!", server_ip="192.168.1.10", verify=False, # set True and supply a CA bundle for production application_type="MyApp/1.0", timeout=180.0, enable_log=True, # optional verbose logging port_no=443, # default 443 ) # Confirm the firmware version of the connected array version = conn.provisioning.get_array_version() print(version) # e.g. "3.0.0.0" ``` ``` -------------------------------- ### Create and Manage Hosts and Host Groups Source: https://context7.com/dell/python-powerstore/llms.txt Use these functions to register compute hosts, add initiators, and group them for shared volume access. Ensure correct initiator port names and types are provided. ```python # Create a host with iSCSI initiator host = conn.provisioning.create_host( name="linux-host-01", os_type="Linux", initiators=[ { "port_name": "iqn.1998-01.com.vmware:lgloc187-4cfa37b6", "port_type": "iSCSI", "chap_single_username": "chapuserSingle", "chap_single_password": "chappasswd12345", } ], host_connectivity="Local_Only", ) host_id = host["id"] # Add an initiator conn.provisioning.add_initiators_to_host( host_id=host_id, add_initiators=[{"port_name": "iqn.2001-04.com.example:storage", "port_type": "iSCSI"}], ) # Create a host group hg = conn.provisioning.create_host_group( name="cluster-hg", host_ids=[host_id], description="ESXi cluster host group", ) # Modify host group conn.provisioning.modify_host_group( host_group_id=hg["id"], add_host_ids=["another-host-id"], ) conn.provisioning.delete_host_group(host_group_id=hg["id"]) conn.provisioning.delete_host(host_id=host_id) ``` -------------------------------- ### Create and Manage Filesystems Source: https://context7.com/dell/python-powerstore/llms.txt Provision file systems under a NAS server with support for snapshots, quotas, and cloning. Ensure the correct NAS server ID and size in bytes are provided. ```python NAS_ID = "5f4a3017-0bad-899e-e1eb-c6f547282e76" # Create a 3 GiB filesystem fs = conn.provisioning.create_filesystem( "prod-fs", NAS_ID, 3221225472, # bytes { "description": "Production filesystem", "smb_notify_on_change_dir_depth": 3, "default_hard_limit": 2147483648, "grace_period": 1209600, }, ) fs_id = fs["id"] # Modify quota defaults conn.provisioning.modify_filesystem(fs_id, { "default_soft_limit": 1073741824, "default_hard_limit": 2147483648, }) # Create and list snapshots snap = conn.connection.protection.create_filesystem_snapshot(fs_id, name="daily-snap") snaps = conn.provisioning.get_snapshots_filesystem(fs_id) # Clone / restore / refresh the filesystem clone = conn.provisioning.clone_filesystem(fs_id, advance_parameters={"name": "fs-clone"}) conn.provisioning.restore_filesystem(snap["id"], backup_snap_name="pre-restore-backup") conn.provisioning.refresh_filesystem(snap["id"]) conn.provisioning.delete_filesystem(fs_id) ``` -------------------------------- ### Create and Manage SMB Shares Source: https://context7.com/dell/python-powerstore/llms.txt Expose file systems as SMB shares, with options for enabling encryption and managing Access Control Entries (ACEs). Use trustee names for user/group identification. ```python FS_ID = "5f4e57d3-2f6e-5fb4-3ac9-c6f547282e76" # Create an SMB share smb = conn.provisioning.create_smb_share( FS_ID, "/", "prod-smb-share", description="Production SMB share", is_abe_enabled=True, ) smb_id = smb["id"] # Enable encryption on the share conn.provisioning.update_smb_share(smb_id, is_encryption_enabled=True) # Get/set ACL acl = conn.provisioning.get_acl(smb_id) conn.provisioning.set_acl( smb_id, add_aces=[{"trustee_name": "DOMAIN\user1", "access_level": "Read", "access_type": "Allow"}], remove_aces=[{"trustee_name": "DOMAIN\old-user", "access_level": "Full", "access_type": "Allow"}], ) conn.provisioning.delete_smb_share(smb_id) ``` -------------------------------- ### Create, Modify, and Map a Volume Source: https://context7.com/dell/python-powerstore/llms.txt Demonstrates the lifecycle of a block volume, including creation with specific size and description, retrieval by name, modification (rename and resize), and mapping to a host. Ensure the PowerStore OS version supports the `app_type` parameter for creation. ```python # Create a 1 GiB volume conn.provisioning.create_volume( name="my-vol", size=1073741824, description="Created via SDK", app_type="Business_Applications_ERP", # requires PowerStore 2.1+ ) # Retrieve by name vol = conn.provisioning.get_volume_by_name(volume_name="my-vol") vol_id = vol[0]["id"] # Modify (rename + resize to 2 GiB) conn.provisioning.modify_volume(volume_id=vol_id, name="my-vol-v2", size=2147483648) # Map to a host host = conn.provisioning.create_host( name="esxi-host-01", os_type="ESXi", initiators=[{"port_name": "iqn.1998-01.com.vmware:esxi01", "port_type": "iSCSI"}], ) conn.provisioning.map_volume_to_host(volume_id=vol_id, host_id=host["id"]) ``` -------------------------------- ### Manage Volume, Volume Group, and Filesystem Snapshots Source: https://context7.com/dell/python-powerstore/llms.txt Use these functions to create, retrieve, modify, and delete point-in-time snapshots for volumes, volume groups, and filesystems. Ensure correct IDs and names are provided. ```python from datetime import datetime, timedelta VOL_ID = "vol-uuid" # Volume snapshot lifecycle snap = conn.protection.create_volume_snapshot( volume_id=VOL_ID, name="hourly-snap", description="Hourly backup", expiration_timestamp=(datetime.utcnow() + timedelta(days=7)).strftime("%Y-%m-%dT%H:%M:%SZ"), ) snap_id = snap["id"] snaps = conn.protection.get_volume_snapshots(volume_id=VOL_ID) conn.protection.modify_volume_snapshot( snapshot_id=snap_id, expiration_timestamp=(datetime.utcnow() + timedelta(days=14)).strftime("%Y-%m-%dT%H:%M:%SZ"), ) conn.protection.delete_volume_snapshot(snapshot_id=snap_id) # Volume group snapshot VG_ID = "vg-uuid" vg_snap = conn.protection.create_volume_group_snapshot( volume_group_id=VG_ID, name="vg-hourly", expiration_timestamp="2025-12-31T23:59:59Z", ) conn.protection.delete_volume_group_snapshot(snapshot_id=vg_snap["id"]) # Filesystem snapshot FS_ID = "fs-uuid" fs_snap = conn.protection.create_filesystem_snapshot(FS_ID, name="fs-daily") conn.protection.modify_filesystem_snapshot(fs_snap["id"], description="Daily backup snap") conn.protection.delete_filesystem_snapshot(fs_snap["id"]) ``` -------------------------------- ### Configure NTP Servers Source: https://context7.com/dell/python-powerstore/llms.txt Retrieve and modify NTP server configurations. Use `add_addresses` to add new NTP servers. ```python ntp = conn.config_mgmt.get_ntp_list() conn.config_mgmt.modify_ntp(ntp[0]["id"], add_addresses=["192.168.1.5"]) ``` -------------------------------- ### Create Snapshot Rules and Protection Policies Source: https://context7.com/dell/python-powerstore/llms.txt Define automated snapshot schedules using interval or time-of-day rules, and bundle them into protection policies. Assign policies to volumes and manage their lifecycle. ```python # Create a snapshot rule (interval-based) rule = conn.protection.create_snapshot_rule_by_interval( name="every-4hrs", desired_retention=24, interval="Four_Hours", days_of_week=["Monday", "Wednesday", "Friday"], ) rule_id = rule["id"] # Or time-of-day based rule2 = conn.protection.create_snapshot_rule_by_time_of_day( name="nightly-2am", desired_retention=168, # 7 days time_of_day="02:00", days_of_week=["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"], ) # Create a protection policy policy = conn.protection.create_protection_policy( name="gold-policy", description="Gold tier: 4-hr snaps + nightly replication", snapshot_rule_ids=[rule_id, rule2["id"]], ) policy_id = policy["id"] # Assign to a volume conn.provisioning.add_protection_policy_for_volume( volume_id="vol-uuid", protection_policy_id=policy_id, ) # Remove policy conn.provisioning.remove_protection_policy_for_volume(volume_id="vol-uuid") conn.protection.delete_protection_policy(policy_id=policy_id) conn.protection.delete_snapshot_rule(snapshot_rule_id=rule_id, delete_snaps=False) ``` -------------------------------- ### Configure DNS Servers Source: https://context7.com/dell/python-powerstore/llms.txt Retrieve and modify DNS server configurations. Use `add_addresses` to add new DNS servers. ```python dns = conn.config_mgmt.get_dns_list() conn.config_mgmt.modify_dns(dns[0]["id"], add_addresses=["8.8.8.8", "8.8.4.4"]) ``` -------------------------------- ### Create and Manage NAS Servers Source: https://context7.com/dell/python-powerstore/llms.txt These functions allow for the creation and management of NAS servers, which act as containers for file systems. Configuration options include directory services and user mapping. ```python # Create a NAS server nas = conn.provisioning.create_nasserver({ "name": "nas-server-01", "current_unix_directory_service": "LDAP", "default_unix_user": "nobody", "is_username_translation_enabled": True, "is_auto_user_mapping_enabled": True, }) nas_id = nas["id"] # List all NAS servers all_nas = conn.provisioning.get_nas_servers(all_pages=True) for s in all_nas: print(s["id"], s["name"]) # Get details by name details = conn.provisioning.get_nas_server_by_name("nas-server-01") # Modify conn.provisioning.modify_nasserver(nas_id, { "description": "Primary NAS", "current_unix_directory_service": "Local_Files", "protection_policy_id": "policy-uuid", }) # Delete conn.provisioning.delete_nasserver(nas_id) ``` -------------------------------- ### Establish PowerStore Connection Source: https://context7.com/dell/python-powerstore/llms.txt Use `PowerStoreConn` to connect to a PowerStore array. Configure authentication, server details, and optional settings like SSL verification and timeouts. The connection object provides access to various management modules. ```python from PyPowerStore import powerstore_conn conn = powerstore_conn.PowerStoreConn( username="admin", password="Password123!", server_ip="192.168.1.10", verify=False, # set True and supply a CA bundle for production application_type="MyApp/1.0", timeout=180.0, enable_log=True, # optional verbose logging port_no=443, # default 443 ) # Confirm the firmware version of the connected array version = conn.provisioning.get_array_version() print(version) # e.g. "3.0.0.0" ``` -------------------------------- ### Filesystem Operations Source: https://context7.com/dell/python-powerstore/llms.txt Operations for creating, modifying, deleting, cloning, restoring, and refreshing file systems, including snapshot management. ```APIDOC ## Filesystem Operations — `conn.provisioning` Provision NFS/SMB-accessible file systems under a NAS server, with snapshot and quota support. ```python NAS_ID = "5f4a3017-0bad-899e-e1eb-c6f547282e76" # Create a 3 GiB filesystem fs = conn.provisioning.create_filesystem( "prod-fs", NAS_ID, 3221225472, # bytes { "description": "Production filesystem", "smb_notify_on_change_dir_depth": 3, "default_hard_limit": 2147483648, "grace_period": 1209600, }, ) fs_id = fs["id"] # Modify quota defaults conn.provisioning.modify_filesystem(fs_id, { "default_soft_limit": 1073741824, "default_hard_limit": 2147483648, }) # Create and list snapshots snap = conn.connection.protection.create_filesystem_snapshot(fs_id, name="daily-snap") snaps = conn.provisioning.get_snapshots_filesystem(fs_id) # Clone / restore / refresh the filesystem clone = conn.provisioning.clone_filesystem(fs_id, advance_parameters={"name": "fs-clone"}) conn.provisioning.restore_filesystem(snap["id"], backup_snap_name="pre-restore-backup") conn.provisioning.refresh_filesystem(snap["id"]) conn.provisioning.delete_filesystem(fs_id) ``` ``` -------------------------------- ### Manage Network Configurations Source: https://context7.com/dell/python-powerstore/llms.txt Retrieve, modify, and manage network settings on the PowerStore system. Use network IDs to target specific configurations. ```python # --- Networks --- networks = conn.config_mgmt.get_networks() net_detail = conn.config_mgmt.get_network_details(network_id=networks[0]["id"]) conn.config_mgmt.modify_network( network_id=networks[0]["id"], network_other_params={"vlan_id": 100}, is_async=True, ) ``` -------------------------------- ### Configure Metro Volume Source: https://context7.com/dell/python-powerstore/llms.txt Demonstrates the configuration and termination of metro volume settings, which is used for synchronous replication between PowerStore systems. This requires PowerStore OS 3.0 or later and a remote system ID. ```python # Configure metro (requires PowerStore 3.0+) conn.provisioning.configure_metro_volume( volume_id=vol_id, remote_system_id="434f534e-7009-4e60-8e1e-5cf721ae40df", ) conn.provisioning.end_volume_metro_config(volume_id=vol_id, delete_remote_volume=False) ``` -------------------------------- ### Manage Remote Systems for Replication Source: https://context7.com/dell/python-powerstore/llms.txt Register and manage remote PowerStore arrays used as replication targets. Create, retrieve, modify, and delete remote system configurations. ```python # Create a remote system peer remote = conn.protection.create_remote_system({ "management_address": "192.168.2.10", "description": "DR site PowerStore", "data_network_latency": "Low", }) remote_id = remote["id"] # Look up by name details = conn.protection.get_remote_system_by_name("DR-array", remote_address="192.168.2.10") # Modify asynchronously conn.protection.modify_remote_system( remote_id, {"description": "Updated DR site"}, is_async=True, ) # Get appliance details on the remote system appliances = conn.protection.get_remote_system_appliance_details(remote_id) conn.protection.delete_remote_system(remote_id, is_async=True) ``` -------------------------------- ### Create File System User Quota Source: https://context7.com/dell/python-powerstore/llms.txt Enforce storage quotas on a per-user basis within a filesystem. Specify the user ID and quota limits. ```python FS_ID = "5f4e57d3-2f6e-5fb4-3ac9-c6f547282e76" # User quota user_quota = conn.provisioning.create_user_quota( file_system_id=FS_ID, user_quota_params={ "uid": 1001, "hard_limit": 5368709120, # 5 GiB "soft_limit": 4294967296, # 4 GiB }, ) ``` -------------------------------- ### Configure SMTP Settings Source: https://context7.com/dell/python-powerstore/llms.txt Retrieve and modify SMTP configuration for email alerts. Ensure the provided address, port, and source email are correct. ```python smtp = conn.config_mgmt.get_smtp_config_list() conn.config_mgmt.modify_smtp_config( smtp[0]["id"], address="smtp.example.com", port=587, source_email="alerts@example.com", ) ``` -------------------------------- ### Snapshot Rules and Protection Policies Source: https://context7.com/dell/python-powerstore/llms.txt Define automated snapshot schedules using intervals or specific times of day, and bundle them with replication rules into protection policies. Assign these policies to volumes. ```APIDOC ## Snapshot Rules and Protection Policies — `conn.protection` Define automated snapshot schedules and bundle them with replication rules into protection policies. ```python # Create a snapshot rule (interval-based) rule = conn.protection.create_snapshot_rule_by_interval( name="every-4hrs", desired_retention=24, interval="Four_Hours", days_of_week=["Monday", "Wednesday", "Friday"], ) rule_id = rule["id"] # Or time-of-day based rule2 = conn.protection.create_snapshot_rule_by_time_of_day( name="nightly-2am", desired_retention=168, # 7 days time_of_day="02:00", days_of_week=["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"], ) # Create a protection policy policy = conn.protection.create_protection_policy( name="gold-policy", description="Gold tier: 4-hr snaps + nightly replication", snapshot_rule_ids=[rule_id, rule2["id"]], ) policy_id = policy["id"] # Assign to a volume conn.provisioning.add_protection_policy_for_volume( volume_id="vol-uuid", protection_policy_id=policy_id, ) # Remove policy conn.provisioning.remove_protection_policy_for_volume(volume_id="vol-uuid") conn.protection.delete_protection_policy(policy_id=policy_id) conn.protection.delete_snapshot_rule(snapshot_rule_id=rule_id, delete_snaps=False) ``` ``` -------------------------------- ### Volume Operations — conn.provisioning Source: https://context7.com/dell/python-powerstore/llms.txt Full CRUD lifecycle for block volumes, including host-mapping, cloning, refreshing, restoring, and metro configuration. ```APIDOC ## Volume Operations — `conn.provisioning` Full CRUD lifecycle for block volumes, including host-mapping, cloning, refreshing, restoring, and metro configuration. ```python # Create a 1 GiB volume conn.provisioning.create_volume( name="my-vol", size=1073741824, description="Created via SDK", app_type="Business_Applications_ERP", # requires PowerStore 2.1+ ) # Retrieve by name vol = conn.provisioning.get_volume_by_name(volume_name="my-vol") vol_id = vol[0]["id"] # Modify (rename + resize to 2 GiB) conn.provisioning.modify_volume(volume_id=vol_id, name="my-vol-v2", size=2147483648) # Map to a host host = conn.provisioning.create_host( name="esxi-host-01", os_type="ESXi", initiators=[{"port_name": "iqn.1998-01.com.vmware:esxi01", "port_type": "iSCSI"}], ) conn.provisioning.map_volume_to_host(volume_id=vol_id, host_id=host["id"]) # Unmap and delete conn.provisioning.unmap_volume_from_host(volume_id=vol_id, host_id=host["id"]) conn.provisioning.delete_volume(volume_id=vol_id) # Clone a volume clone = conn.provisioning.clone_volume( volume_id=vol_id, name="my-vol-clone", description="DR clone", ) # Refresh a volume from another volume backup_snap = conn.provisioning.refresh_volume( volume_id=vol_id, volume_id_to_refresh_from=clone["id"], create_backup_snap=True, backup_snap_name="pre-refresh-backup", ) # Restore a volume from a snapshot conn.provisioning.restore_volume( volume_id=vol_id, snap_id_to_restore_from=backup_snap["backup_snapshot_id"], ) # Configure metro (requires PowerStore 3.0+) conn.provisioning.configure_metro_volume( volume_id=vol_id, remote_system_id="434f534e-7009-4e60-8e1e-5cf721ae40df", ) conn.provisioning.end_volume_metro_config(volume_id=vol_id, delete_remote_volume=False) ``` ``` -------------------------------- ### Create Email Notification Destination Source: https://context7.com/dell/python-powerstore/llms.txt Create a new email address to receive notifications. Configure notification levels as needed. ```python conn.config_mgmt.create_email( email_address="admin@example.com", notify_critical=True, notify_major=True, notify_minor=False, notify_info=False, ) ``` -------------------------------- ### Clone, Refresh, and Restore Volume Source: https://context7.com/dell/python-powerstore/llms.txt Illustrates advanced volume operations: cloning a volume for a copy, refreshing a volume from another (optionally creating a backup snapshot), and restoring a volume from a previously created snapshot. These are crucial for backup and disaster recovery strategies. ```python # Clone a volume clone = conn.provisioning.clone_volume( volume_id=vol_id, name="my-vol-clone", description="DR clone", ) # Refresh a volume from another volume backup_snap = conn.provisioning.refresh_volume( volume_id=vol_id, volume_id_to_refresh_from=clone["id"], create_backup_snap=True, backup_snap_name="pre-refresh-backup", ) # Restore a volume from a snapshot conn.provisioning.restore_volume( volume_id=vol_id, snap_id_to_restore_from=backup_snap["backup_snapshot_id"], ) ``` -------------------------------- ### Manage Replication Sessions Source: https://context7.com/dell/python-powerstore/llms.txt Monitor and control asynchronous replication sessions between PowerStore systems. Use functions for syncing, pausing, resuming, failing over, and reprotecting sessions. ```python SESSION_ID = "24f4236f-f7b6-4ae1-8130-8463b256fae6" # Inspect session state session = conn.protection.get_replication_session_details(session_id=SESSION_ID) print(session["state"], session["progress_percentage"]) # Lifecycle controls conn.protection.sync_replication_session(session_id=SESSION_ID) conn.protection.pause_replication_session(session_id=SESSION_ID) conn.protection.resume_replication_session(session_id=SESSION_ID) # Planned failover with auto-reprotect conn.protection.failover_replication_session( session_id=SESSION_ID, is_planned=True, reverse=True, # auto-reprotect after failover ) # Reprotect manually conn.protection.reprotect_replication_session(session_id=SESSION_ID) # Modify role (e.g., promote to metro preferred) conn.protection.modify_replication_session(session_id=SESSION_ID, role="Metro_Preferred") # List all sessions all_sessions = conn.protection.get_replication_sessions(all_pages=True) ``` -------------------------------- ### Create and Manage NFS Exports Source: https://context7.com/dell/python-powerstore/llms.txt Export file systems over NFS with configurable access controls for different host groups. Specify read-write and root hosts using IP addresses or CIDR notation. ```python FS_ID = "5f4e57d3-2f6e-5fb4-3ac9-c6f547282e76" # Create an NFS export nfs = conn.provisioning.create_nfs_export( file_system_id=FS_ID, path="/", name="prod-nfs-export", nfs_other_params={ "description": "Production NFS export", "default_access": "No_Access", "read_write_hosts": [{"ip_address": "192.168.10.0/24"}], "root_hosts": [{"ip_address": "192.168.10.5"}], }, ) nfs_id = nfs["id"] # Retrieve by name and modify detail = conn.provisioning.get_nfs_export_details_by_name("prod-nfs-export") conn.provisioning.modify_nfs_export(nfs_id, {"default_access": "Read_Only"}) # List with filter exports = conn.provisioning.get_nfs_exports(filter_dict={"name": "eq.prod-nfs-export"}) conn.provisioning.delete_nfs_export(nfs_id) ``` -------------------------------- ### Manage Local Users Source: https://context7.com/dell/python-powerstore/llms.txt Create, modify, and delete local users on the PowerStore appliance. Ensure you have the necessary role IDs and strong passwords. ```python users = conn.config_mgmt.get_local_users() user = conn.config_mgmt.create_local_user( name="ops-user", role_id="role-uuid", password="SecurePass1!", ) conn.config_mgmt.modify_local_user(user_id=user["id"], password="NewSecurePass1!") conn.config_mgmt.delete_local_user(user_id=user["id"]) ``` -------------------------------- ### Delete Volume and Host Mapping Source: https://context7.com/dell/python-powerstore/llms.txt This snippet shows how to unmap a volume from a host and subsequently delete the volume and the host. This is typically done after the volume is no longer needed or has been migrated. ```python # Unmap and delete conn.provisioning.unmap_volume_from_host(volume_id=vol_id, host_id=host["id"]) conn.provisioning.delete_volume(volume_id=vol_id) ``` -------------------------------- ### Create File System Tree Quota Source: https://context7.com/dell/python-powerstore/llms.txt Enforce storage quotas at the directory level within a filesystem. Define hard limits, soft limits, and grace periods. ```python FS_ID = "5f4e57d3-2f6e-5fb4-3ac9-c6f547282e76" # Tree quota tree_quota = conn.provisioning.create_tree_quota( file_system_id=FS_ID, path="/projects/team-a", tree_quota_params={ "hard_limit": 10737418240, # 10 GiB "soft_limit": 8589934592, # 8 GiB "grace_period": 604800, }, ) ``` -------------------------------- ### Create and Manage Volume Group Source: https://context7.com/dell/python-powerstore/llms.txt Covers the creation of volume groups for consistent snapshots across multiple volumes, adding/removing members, and performing group-level clone, refresh, and restore operations. The `is_write_order_consistent` parameter is important for data integrity. ```python # Create a volume group and add members vg = conn.provisioning.create_volume_group( name="vg-prod", description="Production VG", volume_ids=["vol-id-1", "vol-id-2"], is_write_order_consistent=True, ) vg_id = vg["id"] conn.provisioning.add_members_to_volume_group(volume_group_id=vg_id, volume_ids=["vol-id-3"]) # Clone the entire group clone_vg = conn.provisioning.clone_volume_group( volume_group_id=vg_id, name="vg-prod-clone", description="Clone for testing", ) # Refresh group from another group conn.provisioning.refresh_volume_group( volume_group_id=vg_id, src_vol_group=clone_vg["id"], create_backup_snap=True, backup_snap_profile={"name": "pre-refresh"}, ) # Restore group from a snapshot conn.provisioning.restore_volume_group( volume_group_id=vg_id, src_snap_id="snap-set-uuid", ) conn.provisioning.remove_members_from_volume_group(volume_group_id=vg_id, volume_ids=["vol-id-3"]) conn.provisioning.delete_volume_group(volume_group_id=vg_id) ``` -------------------------------- ### Network Configuration Management Source: https://context7.com/dell/python-powerstore/llms.txt Manage system-level network configurations, including retrieving network details and modifying network parameters like VLAN IDs. ```APIDOC ## Configuration Management — `conn.config_mgmt` Manage system-level configuration including networks, local users, LDAP, certificates, SMTP, NTP, and DNS. ```python # --- Networks --- networks = conn.config_mgmt.get_networks() net_detail = conn.config_mgmt.get_network_details(network_id=networks[0]["id"]) conn.config_mgmt.modify_network( network_id=networks[0]["id"], network_other_params={"vlan_id": 100}, is_async=True, ) ``` ``` -------------------------------- ### Host and Host Group Operations Source: https://context7.com/dell/python-powerstore/llms.txt Operations for creating, modifying, and deleting hosts and host groups, including managing initiators. ```APIDOC ## Host and Host Group Operations — `conn.provisioning` Register compute hosts and group them for shared volume access. ```python # Create a host with iSCSI initiator host = conn.provisioning.create_host( name="linux-host-01", os_type="Linux", initiators=[ { "port_name": "iqn.1998-01.com.vmware:lgloc187-4cfa37b6", "port_type": "iSCSI", "chap_single_username": "chapuserSingle", "chap_single_password": "chappasswd12345", } ], host_connectivity="Local_Only", ) host_id = host["id"] # Add an initiator conn.provisioning.add_initiators_to_host( host_id=host_id, add_initiators=[{"port_name": "iqn.2001-04.com.example:storage", "port_type": "iSCSI"}], ) # Create a host group hg = conn.provisioning.create_host_group( name="cluster-hg", host_ids=[host_id], description="ESXi cluster host group", ) # Modify host group conn.provisioning.modify_host_group( host_group_id=hg["id"], add_host_ids=["another-host-id"], ) conn.provisioning.delete_host_group(host_group_id=hg["id"]) conn.provisioning.delete_host(host_id=host_id) ``` ``` -------------------------------- ### SMB Share Operations Source: https://context7.com/dell/python-powerstore/llms.txt Operations for creating, updating, retrieving, setting ACLs, and deleting SMB shares. ```APIDOC ## SMB Share Operations — `conn.provisioning` Expose filesystems as Windows/SMB shares, with optional ACL management. ```python FS_ID = "5f4e57d3-2f6e-5fb4-3ac9-c6f547282e76" # Create an SMB share smb = conn.provisioning.create_smb_share( FS_ID, "/", "prod-smb-share", description="Production SMB share", is_abe_enabled=True, ) smb_id = smb["id"] # Enable encryption on the share conn.provisioning.update_smb_share(smb_id, is_encryption_enabled=True) # Get/set ACL acl = conn.provisioning.get_acl(smb_id) conn.provisioning.set_acl( smb_id, add_aces=[{"trustee_name": "DOMAIN\user1", "access_level": "Read", "access_type": "Allow"}], remove_aces=[{"trustee_name": "DOMAIN\old-user", "access_level": "Full", "access_type": "Allow"}], ) conn.provisioning.delete_smb_share(smb_id) ``` ``` -------------------------------- ### Volume Group Operations — conn.provisioning Source: https://context7.com/dell/python-powerstore/llms.txt Manage consistency groups of volumes, including clone, refresh, and restore operations on the whole group. ```APIDOC ## Volume Group Operations — `conn.provisioning` Manage consistency groups of volumes, including clone, refresh, and restore operations on the whole group. ```python # Create a volume group and add members vg = conn.provisioning.create_volume_group( name="vg-prod", description="Production VG", volume_ids=["vol-id-1", "vol-id-2"], is_write_order_consistent=True, ) vg_id = vg["id"] conn.provisioning.add_members_to_volume_group(volume_group_id=vg_id, volume_ids=["vol-id-3"]) # Clone the entire group clone_vg = conn.provisioning.clone_volume_group( volume_group_id=vg_id, name="vg-prod-clone", description="Clone for testing", ) # Refresh group from another group conn.provisioning.refresh_volume_group( volume_group_id=vg_id, src_vol_group=clone_vg["id"], create_backup_snap=True, backup_snap_profile={"name": "pre-refresh"}, ) # Restore group from a snapshot conn.provisioning.restore_volume_group( volume_group_id=vg_id, src_snap_id="snap-set-uuid", ) conn.provisioning.remove_members_from_volume_group(volume_group_id=vg_id, volume_ids=["vol-id-3"]) conn.provisioning.delete_volume_group(volume_group_id=vg_id) ``` ``` -------------------------------- ### SMTP Configuration Management Source: https://context7.com/dell/python-powerstore/llms.txt Operations for configuring the Simple Mail Transfer Protocol (SMTP) server for sending alerts. ```APIDOC ## SMTP Configuration ### Description Configures the SMTP server settings used for sending email notifications. ### Methods - `get_smtp_config_list()`: Retrieves the current SMTP configuration. - `modify_smtp_config(smtp_config_id, address=None, port=None, source_email=None)`: Modifies the SMTP server configuration. ### Example Usage ```python # Get SMTP configuration smtp = conn.config_mgmt.get_smtp_config_list() # Modify SMTP configuration conn.config_mgmt.modify_smtp_config( smtp[0]["id"], address="smtp.example.com", port=587, source_email="alerts@example.com" ) ``` ``` -------------------------------- ### Replication Session Operations Source: https://context7.com/dell/python-powerstore/llms.txt Monitor and control asynchronous replication sessions between PowerStore systems. Operations include syncing, pausing, resuming, failing over, reprotecting, and modifying session roles. ```APIDOC ## Replication Session Operations — `conn.protection` Monitor and control asynchronous replication sessions between PowerStore systems. ```python SESSION_ID = "24f4236f-f7b6-4ae1-8130-8463b256fae6" # Inspect session state session = conn.protection.get_replication_session_details(session_id=SESSION_ID) print(session["state"], session["progress_percentage"]) # Lifecycle controls conn.protection.sync_replication_session(session_id=SESSION_ID) conn.protection.pause_replication_session(session_id=SESSION_ID) conn.protection.resume_replication_session(session_id=SESSION_ID) # Planned failover with auto-reprotect conn.protection.failover_replication_session( session_id=SESSION_ID, is_planned=True, reverse=True, # auto-reprotect after failover ) # Reprotect manually conn.protection.reprotect_replication_session(session_id=SESSION_ID) # Modify role (e.g., promote to metro preferred) conn.protection.modify_replication_session(session_id=SESSION_ID, role="Metro_Preferred") # List all sessions all_sessions = conn.protection.get_replication_sessions(all_pages=True) ``` ``` -------------------------------- ### Remote System Operations Source: https://context7.com/dell/python-powerstore/llms.txt Register and manage remote PowerStore arrays that serve as replication targets. This includes creating, retrieving, modifying, and deleting remote system configurations. ```APIDOC ## Remote System Operations — `conn.protection` Register and manage the remote PowerStore arrays used as replication targets. ```python # Create a remote system peer remote = conn.protection.create_remote_system({ "management_address": "192.168.2.10", "description": "DR site PowerStore", "data_network_latency": "Low", }) remote_id = remote["id"] # Look up by name details = conn.protection.get_remote_system_by_name("DR-array", remote_address="192.168.2.10") # Modify asynchronously conn.protection.modify_remote_system( remote_id, {"description": "Updated DR site"}, is_async=True, ) # Get appliance details on the remote system appliances = conn.protection.get_remote_system_appliance_details(remote_id) conn.protection.delete_remote_system(remote_id, is_async=True) ``` ``` -------------------------------- ### Performance Metrics Retrieval Source: https://context7.com/dell/python-powerstore/llms.txt Retrieves near-real-time and historical performance metrics for various PowerStore entities. ```APIDOC ## Metrics ### Description Retrieves performance metrics for appliances, volumes, and other entities. ### Methods - `get_performance_metrics(entity, entity_id, interval)`: Retrieves performance metrics for a specified entity and interval. - `is_logging_enabled()`: Checks if performance metrics logging is enabled. ### Parameters #### `get_performance_metrics` Parameters - **entity** (string) - Required - The type of entity (e.g., `performance_metrics_by_appliance`, `performance_metrics_by_volume`). - **entity_id** (string) - Required - The ID of the entity. - **interval** (string) - Required - The time interval for metrics (e.g., `Five_Sec`, `Twenty_Sec`, `Five_Mins`, `One_Hour`, `One_Day`). ### Example Usage ```python # Get 5-second performance metrics for appliance A1 metrics = conn.metrics.get_performance_metrics( entity="performance_metrics_by_appliance", entity_id="A1", interval="Five_Sec" ) print(metrics) # Volume performance metrics vol_metrics = conn.metrics.get_performance_metrics( entity="performance_metrics_by_volume", entity_id="vol-uuid", interval="Five_Mins" ) # Check if logging is enabled print(conn.metrics.is_logging_enabled()) ``` ``` -------------------------------- ### NAS Server Operations Source: https://context7.com/dell/python-powerstore/llms.txt Operations for creating, retrieving, modifying, and deleting NAS servers. ```APIDOC ## NAS Server Operations — `conn.provisioning` Create and manage NAS servers that serve as containers for file systems. ```python # Create a NAS server nas = conn.provisioning.create_nasserver({ "name": "nas-server-01", "current_unix_directory_service": "LDAP", "default_unix_user": "nobody", "is_username_translation_enabled": True, "is_auto_user_mapping_enabled": True, }) nas_id = nas["id"] # List all NAS servers all_nas = conn.provisioning.get_nas_servers(all_pages=True) for s in all_nas: print(s["id"], s["name"]) # Get details by name details = conn.provisioning.get_nas_server_by_name("nas-server-01") # Modify conn.provisioning.modify_nasserver(nas_id, { "description": "Primary NAS", "current_unix_directory_service": "Local_Files", "protection_policy_id": "policy-uuid", }) # Delete conn.provisioning.delete_nasserver(nas_id) ``` ``` -------------------------------- ### NTP Servers Management Source: https://context7.com/dell/python-powerstore/llms.txt Operations for managing Network Time Protocol (NTP) server configurations. ```APIDOC ## NTP Servers ### Description Manages Network Time Protocol (NTP) server settings for time synchronization. ### Methods - `get_ntp_list()`: Retrieves the list of configured NTP servers. - `modify_ntp(ntp_id, add_addresses=None, remove_addresses=None)`: Modifies NTP server addresses. ### Example Usage ```python # Get NTP server list ntp = conn.config_mgmt.get_ntp_list() # Add an NTP server address conn.config_mgmt.modify_ntp(ntp[0]["id"], add_addresses=["192.168.1.5"]) ``` ``` -------------------------------- ### Snapshot Operations Source: https://context7.com/dell/python-powerstore/llms.txt Manage point-in-time snapshots for volumes, volume groups, and filesystems. This includes creating, retrieving, modifying expiration times, and deleting snapshots. ```APIDOC ## Snapshot Operations — `conn.protection` Create, modify, and delete point-in-time snapshots of volumes, volume groups, and filesystems. ```python from datetime import datetime, timedelta VOL_ID = "vol-uuid" # Volume snapshot lifecycle snap = conn.protection.create_volume_snapshot( volume_id=VOL_ID, name="hourly-snap", description="Hourly backup", expiration_timestamp=(datetime.utcnow() + timedelta(days=7)).strftime("%Y-%m-%dT%H:%M:%SZ"), ) snap_id = snap["id"] snaps = conn.protection.get_volume_snapshots(volume_id=VOL_ID) conn.protection.modify_volume_snapshot( snapshot_id=snap_id, expiration_timestamp=(datetime.utcnow() + timedelta(days=14)).strftime("%Y-%m-%dT%H:%M:%SZ"), ) conn.protection.delete_volume_snapshot(snapshot_id=snap_id) # Volume group snapshot VG_ID = "vg-uuid" vg_snap = conn.protection.create_volume_group_snapshot( volume_group_id=VG_ID, name="vg-hourly", expiration_timestamp="2025-12-31T23:59:59Z", ) conn.protection.delete_volume_group_snapshot(snapshot_id=vg_snap["id"]) # Filesystem snapshot FS_ID = "fs-uuid" fs_snap = conn.protection.create_filesystem_snapshot(FS_ID, name="fs-daily") conn.protection.modify_filesystem_snapshot(fs_snap["id"], description="Daily backup snap") conn.protection.delete_filesystem_snapshot(fs_snap["id"]) ``` ``` -------------------------------- ### Local Users Management Source: https://context7.com/dell/python-powerstore/llms.txt Operations for managing local users on the PowerStore appliance, including creation, modification, and deletion. ```APIDOC ## Local Users ### Description Manages local user accounts on the PowerStore appliance. ### Methods - `get_local_users()`: Retrieves a list of local users. - `create_local_user(name, role_id, password)`: Creates a new local user. - `modify_local_user(user_id, password)`: Modifies an existing local user's password. - `delete_local_user(user_id)`: Deletes a local user. ### Example Usage ```python # Get all local users users = conn.config_mgmt.get_local_users() # Create a new user user = conn.config_mgmt.create_local_user( name="ops-user", role_id="role-uuid", password="SecurePass1!" ) # Modify user password conn.config_mgmt.modify_local_user(user_id=user["id"], password="NewSecurePass1!") # Delete a user conn.config_mgmt.delete_local_user(user_id=user["id"]) ``` ```