Module netapp_ontap.resources.storage_pool

Copyright © 2023 NetApp Inc. All rights reserved.

This file has been automatically generated based on the ONTAP REST API documentation.

Updating storage pools

The PATCH operation is used to modify properties of the storage pool. There are several properties that can be modified on a storage pool. PATCH operations on a storage pool are restricted when another PATCH operation is in progress. The following is a list of properties that can be modified using the PATCH operation including a brief description for each:

  • name - Can be updated to rename the storage pool.
  • capacity.disk_count - Can be updated to increase the number of disks in a storage pool.
  • capacity.spare_allocation_units[].count - Modifying this value requires that the user specify capacity.spare_allocation_units[].node as well. Modifying this value redistributes spare cache capacity among the nodes specified in the operation When expanding a storage pool, the cache tiers of all aggregates using the storage pool's allocation units are expanded automatically.

Simulated storage pool expansion

The PATCH operation also supports simulated expansion of a storage pool. Running PATCH with the query "simulate" set to "true", and "capacity.disk_count" set to the final disk count will return a response containing the projected new capacity and the new constituent disk list for the storage pool.

Deleting storage pools

If cache capacity from a storage pool is being used in an aggregate, it cannot be deleted. See the /storage/aggregates API for details on deleting aggregates.


Examples

Retrieving a specific pool from the cluster

The following example shows the response of the requested storage pool. If there is no storage pool with the requested UUID, an error is returned.

from netapp_ontap import HostConnection
from netapp_ontap.resources import StoragePool

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    resource = StoragePool(uuid="870dd9f2-bdfa-4167-b692-57d1cec874d4")
    resource.get()
    print(resource)

StoragePool(
    {
        "health": {"is_healthy": True, "state": "normal"},
        "uuid": "8255fef7-4737-11ec-bd1b-005056bbb879",
        "storage_type": "ssd",
        "name": "new_sp",
        "nodes": [
            {"name": "node-1", "uuid": "caf95bec-f801-11e8-8af9-005056bbe5c1"},
            {"name": "node-2", "uuid": "cf9ab500-ff3e-4bce-bfd7-d679e6078f47"},
        ],
        "capacity": {
            "spare_allocation_units": [
                {
                    "syncmirror_pool": "pool0",
                    "node": {
                        "name": "node-1",
                        "uuid": "caf95bec-f801-11e8-8af9-005056bbe5c1",
                    },
                    "count": 1,
                    "available_size": 1846542336,
                    "size": 1846542336,
                },
                {
                    "syncmirror_pool": "pool0",
                    "node": {
                        "name": "node-2",
                        "uuid": "cf9ab500-ff3e-4bce-bfd7-d679e6078f47",
                    },
                    "count": 0,
                    "available_size": 0,
                    "size": 1846542336,
                },
            ],
            "remaining": 1846542336,
            "disk_count": 4,
            "total": 7386169344,
            "used_allocation_units": [
                {
                    "node": {
                        "name": "node-1",
                        "uuid": "caf95bec-f801-11e8-8af9-005056bbe5c1",
                    },
                    "aggregate": {
                        "name": "test_a",
                        "uuid": "19425837-f2fa-4a9f-8f01-712f626c983c",
                    },
                },
                {
                    "node": {
                        "name": "node-2",
                        "uuid": "cf9ab500-ff3e-4bce-bfd7-d679e6078f47",
                    },
                    "aggregate": {
                        "name": "test_b",
                        "uuid": "f4cc30d5-b052-493a-a49f-19781425f987",
                    },
                },
            ],
            "disks": [
                {
                    "usable_size": 1902379008,
                    "disk": {"name": "VMw-1.11"},
                    "total_size": 1908871168,
                },
                {
                    "usable_size": 1902379008,
                    "disk": {"name": "VMw-1.12"},
                    "total_size": 1908871168,
                },
                {
                    "usable_size": 1902379008,
                    "disk": {"name": "VMw-1.23"},
                    "total_size": 1908871168,
                },
                {
                    "usable_size": 1902379008,
                    "disk": {"name": "VMw-1.24"},
                    "total_size": 1908871168,
                },
            ],
        },
    }
)

Simulating storage pool expansion

The following example shows the response for a simulated storage pool expansion based on the values of the 'capacity.disk_count' attribute passed in. The query does not modify the existing storage pool, but rather returns how it will look after the expansion. This will be reflected in the following attributes:

  • capacity.total- Total space, in bytes.
  • capacity.remaining - New remaining capacity, in bytes.
  • capacity.disks.disk - New list of constituent disks.
  • capacity.disk_count - New number of disks in the pool.
from netapp_ontap import HostConnection
from netapp_ontap.resources import StoragePool

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    resource = StoragePool(uuid="cae60cfe-deae-42bd-babb-ef437d118314")
    resource.capacity = {"disk_count": 6}
    resource.patch(hydrate=True, simulate=True)

Adding capacity to a storage pool

The following example shows the workflow of adding disks to the storage pool.
Step 1: Check the current disk count on the storage pool.

from netapp_ontap import HostConnection
from netapp_ontap.resources import StoragePool

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    resource = StoragePool(uuid="19425837-f2fa-4a9f-8f01-712f626c983c")
    resource.get(fields="capacity.disk_count")
    print(resource)

StoragePool(
    {
        "uuid": "19425837-f2fa-4a9f-8f01-712f626c983c",
        "name": "sp1",
        "capacity": {"disk_count": 4},
    }
)

Step 2: Update the pool with the new disk count in 'capacity.disk_count'. The response to PATCH is a job unless the request is invalid.

from netapp_ontap import HostConnection
from netapp_ontap.resources import StoragePool

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    resource = StoragePool(uuid="19425837-f2fa-4a9f-8f01-712f626c983c")
    resource.capacity = {"disk_count": 6}
    resource.patch()

Step 3: Wait for the job to finish, then call GET to see the reflected change.

from netapp_ontap import HostConnection
from netapp_ontap.resources import StoragePool

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    resource = StoragePool(uuid="19425837-f2fa-4a9f-8f01-712f626c983c")
    resource.get(fields="capacity.disk_count")
    print(resource)

StoragePool(
    {
        "uuid": "19425837-f2fa-4a9f-8f01-712f626c983c",
        "name": "sp1",
        "capacity": {"disk_count": 6},
    }
)

The following example shows the workflow to redistribute spare capacity among nodes sharing the storage pool Step 1: Check the current spare capacity distribution of the pool.

from netapp_ontap import HostConnection
from netapp_ontap.resources import StoragePool

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    resource = StoragePool(uuid="f3aafdc6-be35-4d93-9590-5a402bffbe4b")
    resource.get(fields="capacity.spare_allocation_units")
    print(resource)

StoragePool(
    {
        "uuid": "f3aafdc6-be35-4d93-9590-5a402bffbe4b",
        "name": "sp1",
        "capacity": {
            "spare_allocation_units": [
                {
                    "syncmirror_pool": "pool0",
                    "node": {
                        "name": "node-1",
                        "uuid": "caf95bec-f801-11e8-8af9-005056bbe5c1",
                    },
                    "count": 1,
                    "available_size": 1846542336,
                    "size": 1846542336,
                },
                {
                    "syncmirror_pool": "pool0",
                    "node": {
                        "name": "node-2",
                        "uuid": "cf9ab500-ff3e-4bce-bfd7-d679e6078f47",
                    },
                    "count": 0,
                    "available_size": 0,
                    "size": 1846542336,
                },
            ]
        },
    }
)

Step 2: Update the pool so that the spare allocation unit count is symmetrically modified for each node. The response to PATCH is a job unless the request is invalid.

from netapp_ontap import HostConnection
from netapp_ontap.resources import StoragePool

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    resource = StoragePool(uuid="f3aafdc6-be35-4d93-9590-5a402bffbe4b")
    resource.capacity = {
        "spare_allocation_units": [
            {"node": {"name": "node-1"}, "count": 0},
            {"node": {"name": "node-2"}, "count": 1},
        ]
    }
    resource.patch()

Step 3: Wait for the job to finish, then call GET to see the reflected change.

from netapp_ontap import HostConnection
from netapp_ontap.resources import StoragePool

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    resource = StoragePool(uuid="f3aafdc6-be35-4d93-9590-5a402bffbe4b")
    resource.get(fields="capacity.spare_allocation_units")
    print(resource)

StoragePool(
    {
        "uuid": "f3aafdc6-be35-4d93-9590-5a402bffbe4b",
        "name": "sp1",
        "capacity": {
            "spare_allocation_units": [
                {
                    "syncmirror_pool": "pool0",
                    "node": {
                        "name": "node-1",
                        "uuid": "caf95bec-f801-11e8-8af9-005056bbe5c1",
                    },
                    "count": 0,
                    "available_size": 0,
                    "size": 1846542336,
                },
                {
                    "syncmirror_pool": "pool0",
                    "node": {
                        "name": "node-2",
                        "uuid": "cf9ab500-ff3e-4bce-bfd7-d679e6078f47",
                    },
                    "count": 1,
                    "available_size": 1846542336,
                    "size": 1846542336,
                },
            ]
        },
    }
)

Classes

class StoragePool (*args, **kwargs)

Allows interaction with StoragePool objects on the host

Initialize the instance of the resource.

Any keyword arguments are set on the instance as properties. For example, if the class was named 'MyResource', then this statement would be true:

MyResource(name='foo').name == 'foo'

Args

*args
Each positional argument represents a parent key as used in the URL of the object. That is, each value will be used to fill in a segment of the URL which refers to some parent object. The order of these arguments must match the order they are specified in the URL, from left to right.
**kwargs
each entry will have its key set as an attribute name on the instance and its value will be the value of that attribute.

Ancestors

Static methods

def count_collection (*args, connection: HostConnection = None, **kwargs) -> int

Returns a count of all StoragePool resources that match the provided query


This calls GET on the object to determine the number of records. It is more efficient than calling get_collection() because it will not construct any objects. Query parameters can be passed in as kwargs to determine a count of objects that match some filtered criteria.

Args

*args
Each entry represents a parent key which is used to build the path to the child object. If the URL definition were /api/foos/{foo.name}/bars, then to get the count of bars for a particular foo, the foo.name value should be passed.
connection
The HostConnection object to use for this API call. If unset, tries to use the connection which is set globally for the library or from the current context.
**kwargs
Any key/value pairs passed will be sent as query parameters to the host. These query parameters can affect the count. A return_records query param will be ignored.

Returns

On success, returns an integer count of the objects of this type. On failure, returns -1.

Raises

NetAppRestError: If the API call returned a status code >= 400, or if there is no connection available to use either passed in or on the library.

def delete_collection (*args, records: Iterable[_ForwardRef('StoragePool')] = None, body: Union[Resource, dict] = None, poll: bool = True, poll_interval: Optional[int] = None, poll_timeout: Optional[int] = None, connection: HostConnection = None, **kwargs) -> NetAppResponse

Deletes the storage pool specified by the UUID. This request starts a job and returns a link to that job.

  • storage pool delete

Learn more


Delete all objects in a collection which match the given query.

All records on the host which match the query will be deleted.

Args

*args
Each entry represents a parent key which is used to build the path to the child object. If the URL definition were /api/foos/{foo.name}/bars, then to delete the collection of bars for a particular foo, the foo.name value should be passed.
records
Can be provided in place of a query. If so, this list of objects will be deleted from the host.
body
The body of the delete request. This could be a Resource instance or a dictionary object.
poll
If set to True, the call will not return until the asynchronous job on the host has completed. Has no effect if the host did not return a job response.
poll_interval
If the operation returns a job, this specifies how often to query the job for updates.
poll_timeout
If the operation returns a job, this specifies how long to continue monitoring the job's status for completion.
connection
The HostConnection object to use for this API call. If unset, tries to use the connection which is set globally for the library or from the current context.
**kwargs
Any key/value pairs passed will be sent as query parameters to the host. Only resources matching this query will be deleted.

Returns

A NetAppResponse object containing the details of the HTTP response.

Raises

NetAppRestError: If the API call returned a status code >= 400

def find (*args, connection: HostConnection = None, **kwargs) -> Resource

Retrieves the collection of storage pools for the entire cluster.

  • storage pool show

Learn more


Find an instance of an object on the host given a query.

The host will be queried with the provided key/value pairs to find a matching resource. If 0 are found, None will be returned. If more than 1 is found, an error will be raised or returned. If there is exactly 1 matching record, then it will be returned.

Args

*args
Each entry represents a parent key which is used to build the path to the child object. If the URL definition were /api/foos/{foo.name}/bars, then to find a bar for a particular foo, the foo.name value should be passed.
connection
The HostConnection object to use for this API call. If unset, tries to use the connection which is set globally for the library or from the current context.
**kwargs
Any key/value pairs passed will be sent as query parameters to the host.

Returns

A Resource object containing the details of the object or None if no matches were found.

Raises

NetAppRestError: If the API call returned more than 1 matching resource.

def get_collection (*args, connection: HostConnection = None, max_records: int = None, **kwargs) -> Iterable[Resource]

Retrieves the collection of storage pools for the entire cluster.

  • storage pool show

Learn more


Fetch a list of all objects of this type from the host.

This is a lazy fetch, making API calls only as necessary when the result of this call is iterated over. For instance, if max_records is set to 5, then iterating over the collection causes an API call to be sent to the server once for every 5 records. If the client stops iterating before getting to the 6th record, then no additional API calls are made.

Args

*args
Each entry represents a parent key which is used to build the path to the child object. If the URL definition were /api/foos/{foo.name}/bars, then to get the collection of bars for a particular foo, the foo.name value should be passed.
connection
The HostConnection object to use for this API call. If unset, tries to use the connection which is set globally for the library or from the current context.
max_records
The maximum number of records to return per call
**kwargs
Any key/value pairs passed will be sent as query parameters to the host.

Returns

A list of Resource objects

Raises

NetAppRestError: If there is no connection available to use either passed in or on the library. This would be not be raised when get_collection() is called, but rather when the result is iterated.

def patch_collection (body: dict, *args, records: Iterable[_ForwardRef('StoragePool')] = None, poll: bool = True, poll_interval: Optional[int] = None, poll_timeout: Optional[int] = None, connection: HostConnection = None, **kwargs) -> NetAppResponse

Updates the storage pool specified by the UUID with the properties in the body. This request starts a job and returns a link to that job.

  • storage pool rename
  • storage pool reassign
  • storage pool add

Learn more


Patch all objects in a collection which match the given query.

All records on the host which match the query will be patched with the provided body.

Args

body
A dictionary of name/value pairs to set on all matching members of the collection. The body argument will be ignored if records is provided.
*args
Each entry represents a parent key which is used to build the path to the child object. If the URL definition were /api/foos/{foo.name}/bars, then to patch the collection of bars for a particular foo, the foo.name value should be passed.
records
Can be provided in place of a query. If so, this list of objects will be patched on the host.
poll
If set to True, the call will not return until the asynchronous job on the host has completed. Has no effect if the host did not return a job response.
poll_interval
If the operation returns a job, this specifies how often to query the job for updates.
poll_timeout
If the operation returns a job, this specifies how long to continue monitoring the job's status for completion.
connection
The HostConnection object to use for this API call. If unset, tries to use the connection which is set globally for the library or from the current context.
**kwargs
Any key/value pairs passed will be sent as query parameters to the host. Only resources matching this query will be patched.

Returns

A NetAppResponse object containing the details of the HTTP response.

Raises

NetAppRestError: If the API call returned a status code >= 400

def post_collection (records: Iterable[_ForwardRef('StoragePool')], *args, hydrate: bool = False, poll: bool = True, poll_interval: Optional[int] = None, poll_timeout: Optional[int] = None, connection: HostConnection = None, **kwargs) -> Union[List[StoragePool], NetAppResponse]

Creates a new storage pool using available solid state capacity attached to the nodes specified.

Required properties

The following properties are required in the POST body: * name - Name of the new storage pool. * nodes[].name or nodes[].uuid - Nodes that can use cache capacity from the new storage pool. Only nodes in the same HA pair can be specified for a given storage pool. Spare cache capacity will be distributed evenly among the specified nodes. * capacity.disk_count - Number of SSDs to be used to create the storage pool.

  • storage pool create

Example:

POST /api/storage/pools {"nodes": [{"name": "node1"}, {"name": "node2"}], "name": "storage_pool_1", "capacity": {"disk_count": "4"}}

Learn more


Send this collection of objects to the host as a creation request.

Args

records
A list of Resource objects to send to the server to be created.
*args
Each entry represents a parent key which is used to build the path to the child object. If the URL definition were /api/foos/{foo.name}/bars, then to create a bar for a particular foo, the foo.name value should be passed.
hydrate
If set to True, after the response is received from the call, a a GET call will be made to refresh all fields of each object. When hydrate is set to True, poll must also be set to True.
poll
If set to True, the call will not return until the asynchronous job on the host has completed. Has no effect if the host did not return a job response.
poll_interval
If the operation returns a job, this specifies how often to query the job for updates.
poll_timeout
If the operation returns a job, this specifies how long to continue monitoring the job's status for completion.
connection
The HostConnection object to use for this API call. If unset, tries to use the connection which is set globally for the library or from the current context.
**kwargs
Any key/value pairs passed will be sent as query parameters to the host. Only resources matching this query will be patched.

Returns

A list of Resource objects matching the provided type which have been created by the host and returned. This is not the same list that was provided, so to continue using the object, you should save this list. If poll is set to False, then a NetAppResponse object is returned instead.

Raises

NetAppRestError: If the API call returned a status code >= 400

Methods

def delete (self, body: Union[Resource, dict] = None, poll: bool = True, poll_interval: Optional[int] = None, poll_timeout: Optional[int] = None, **kwargs) -> NetAppResponse

Deletes the storage pool specified by the UUID. This request starts a job and returns a link to that job.

  • storage pool delete

Learn more


Send a deletion request to the host for this object.

Args

body
The body of the delete request. This could be a Resource instance or a dictionary object.
poll
If set to True, the call will not return until the asynchronous job on the host has completed. Has no effect if the host did not return a job response.
poll_interval
If the operation returns a job, this specifies how often to query the job for updates.
poll_timeout
If the operation returns a job, this specifies how long to continue monitoring the job's status for completion.
connection
The HostConnection object to use for this API call. If unset, tries to use the connection which is set globally for the library or from the current context.
**kwargs
Any key/value pairs passed will be sent as query parameters to the host.

Returns

A NetAppResponse object containing the details of the HTTP response.

Raises

NetAppRestError: If the API call returned a status code >= 400

def get (self, **kwargs) -> NetAppResponse

Retrieves the storage pool specified by the UUID.

  • storage pool show -storage-pool-uuid

Learn more


Fetch the details of the object from the host.

Requires the keys to be set (if any). After returning, new or changed properties from the host will be set on the instance.

Returns

A NetAppResponse object containing the details of the HTTP response.

Raises

NetAppRestError: If the API call returned a status code >= 400

def patch (self, hydrate: bool = False, poll: bool = True, poll_interval: Optional[int] = None, poll_timeout: Optional[int] = None, **kwargs) -> NetAppResponse

Updates the storage pool specified by the UUID with the properties in the body. This request starts a job and returns a link to that job.

  • storage pool rename
  • storage pool reassign
  • storage pool add

Learn more


Send the difference in the object's state to the host as a modification request.

Calculates the difference in the object's state since the last time we interacted with the host and sends this in the request body.

Args

hydrate
If set to True, after the response is received from the call, a a GET call will be made to refresh all fields of the object.
poll
If set to True, the call will not return until the asynchronous job on the host has completed. Has no effect if the host did not return a job response.
poll_interval
If the operation returns a job, this specifies how often to query the job for updates.
poll_timeout
If the operation returns a job, this specifies how long to continue monitoring the job's status for completion.
connection
The HostConnection object to use for this API call. If unset, tries to use the connection which is set globally for the library or from the current context.
**kwargs
Any key/value pairs passed will normally be sent as query parameters to the host. If any of these pairs are parameters that are sent as formdata then only parameters of that type will be accepted and all others will be discarded.

Returns

A NetAppResponse object containing the details of the HTTP response.

Raises

NetAppRestError: If the API call returned a status code >= 400

def post (self, hydrate: bool = False, poll: bool = True, poll_interval: Optional[int] = None, poll_timeout: Optional[int] = None, **kwargs) -> NetAppResponse

Creates a new storage pool using available solid state capacity attached to the nodes specified.

Required properties

The following properties are required in the POST body: * name - Name of the new storage pool. * nodes[].name or nodes[].uuid - Nodes that can use cache capacity from the new storage pool. Only nodes in the same HA pair can be specified for a given storage pool. Spare cache capacity will be distributed evenly among the specified nodes. * capacity.disk_count - Number of SSDs to be used to create the storage pool.

  • storage pool create

Example:

POST /api/storage/pools {"nodes": [{"name": "node1"}, {"name": "node2"}], "name": "storage_pool_1", "capacity": {"disk_count": "4"}}

Learn more


Send this object to the host as a creation request.

Args

hydrate
If set to True, after the response is received from the call, a a GET call will be made to refresh all fields of the object.
poll
If set to True, the call will not return until the asynchronous job on the host has completed. Has no effect if the host did not return a job response.
poll_interval
If the operation returns a job, this specifies how often to query the job for updates.
poll_timeout
If the operation returns a job, this specifies how long to continue monitoring the job's status for completion.
connection
The HostConnection object to use for this API call. If unset, tries to use the connection which is set globally for the library or from the current context.
**kwargs
Any key/value pairs passed will normally be sent as query parameters to the host. If any of these pairs are parameters that are sent as formdata then only parameters of that type will be accepted and all others will be discarded.

Returns

A NetAppResponse object containing the details of the HTTP response.

Raises

NetAppRestError: If the API call returned a status code >= 400

Inherited members

class StoragePoolSchema (*, only: Union[Sequence[str], Set[str]] = None, exclude: Union[Sequence[str], Set[str]] = (), many: bool = False, context: Dict = None, load_only: Union[Sequence[str], Set[str]] = (), dump_only: Union[Sequence[str], Set[str]] = (), partial: Union[bool, Sequence[str], Set[str]] = False, unknown: str = None)

The fields of the StoragePool object

Ancestors

  • netapp_ontap.resource.ResourceSchema
  • marshmallow.schema.Schema
  • marshmallow.base.SchemaABC

Class variables

capacity: StoragePoolCapacity GET POST PATCH

The capacity field of the storage_pool.

health: PoolHealth GET

The health field of the storage_pool.

The links field of the storage_pool.

name: str GET POST PATCH

Storage pool name.

nodes: List[Node] GET POST PATCH

Nodes that can use this storage pool for their aggregates.

storage_type: str GET

Storage type for the disks used to create the storage pool.

Valid choices:

  • SSD
uuid: str GET

Storage pool UUID.