Module netapp_ontap.resources.disk
Copyright © 2019 NetApp Inc. All rights reserved.
Retrieving storage disk information
The storage disk GET API retrieves all of the disks in the cluster.
Examples
1) Retrieve a list of disks from the cluster
The following example shows the response with a list of disks in the cluster:
# The API:
/api/storage/disks
# The call:
curl -X GET "https://<mgmt-ip>/api/storage/disks" -H "accept: application/hal+json"
# The response:
{
"records": [
{
"name": "1.24.4",
"_links": {
"self": {
"href": "/api/storage/disks/1.24.4"
}
}
},
{
"name": "1.24.3",
"_links": {
"self": {
"href": "/api/storage/disks/1.24.3"
}
}
},
{
"name": "1.24.5",
"_links": {
"self": {
"href": "/api/storage/disks/1.24.5"
}
}
},
{
"name": "1.24.0",
"_links": {
"self": {
"href": "/api/storage/disks/1.24.0"
}
}
},
{
"name": "1.24.2",
"_links": {
"self": {
"href": "/api/storage/disks/1.24.2"
}
}
},
{
"name": "1.24.1",
"_links": {
"self": {
"href": "/api/storage/disks/1.24.1"
}
}
}
],
"num_records": 6,
"_links": {
"self": {
"href": "/api/storage/disks"
}
}
}
2) Retrieve a specific disk from the cluster
The following example shows the response of the requested disk. If there is no disk with the requested name, an error is returned.
# The API:
/api/storage/disks/{name}
# The call:
curl -X GET "https://<mgmt-ip>/api/storage/disks/1.24.3" -H "accept: application/hal+json"
# The response:
{
"name": "1.24.3",
"uid": "50000394:0808AA88:00000000:00000000:00000000:00000000:00000000:00000000:00000000:00000000",
"serial_number": "EC47PC5021SW",
"model": "X421_FAL12450A10",
"vendor": "NETAPP",
"firmware_version": "NA02",
"usable_size": 438304768000,
"rpm": 10000,
"type": "sas",
"class": "performance",
"container_type": "aggregate",
"pool": "pool0",
"state": "present",
"node": {
"uuid": "3a89ed49-8c6d-11e8-93bc-00a0985a64b6",
"name": "node-2",
"_links": {
"self": {
"href": "/api/cluster/nodes/3a89ed49-8c6d-11e8-93bc-00a0985a64b6"
}
}
},
"home_node": {
"uuid": "3a89ed49-8c6d-11e8-93bc-00a0985a64b6",
"name": "node-2",
"_links": {
"self": {
"href": "/api/cluster/nodes/3a89ed49-8c6d-11e8-93bc-00a0985a64b6"
}
}
},
"aggregates": [
{
"uuid": "3fd9c345-ba91-4949-a7b1-6e2b898d74e3",
"name": "node_2_SAS_1",
"_links": {
"self": {
"href": "/api/storage/aggregates/3fd9c345-ba91-4949-a7b1-6e2b898d74e3"
}
}
}
],
"shelf": {
"uid": "10318311901725526608",
"_links": {
"self": {
"href": "/api/storage/shelves/10318311901725526608"
}
}
},
"bay": 3,
"_links": {
"self": {
"href": "/api/storage/disks/1.24.3"
}
}
}
Classes
class Disk (*args, **kwargs)
-
Allows interaction with Disk 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 find(*args, connection: HostConnection = None, **kwargs) -> Resource
-
Retrieves a collection of disks.
Related ONTAP commands
storage disk 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 or 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.Raises
NetAppRestError
: If the API call did not return exactly 1 matching resource. def get_collection(*args, connection: HostConnection = None, max_records: int = None, **kwargs) -> typing.Iterable
-
Retrieves a collection of disks.
Related ONTAP commands
storage disk show
Learn more
Fetch a list of all objects of this type from the host.
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
objectsRaises
NetAppRestError
: If there is no connection available to use either passed in or on the library.
Methods
def get(self, **kwargs) -> NetAppResponse
-
Retrieves a specific disk.
Related ONTAP commands
storage disk show
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
Inherited members
class DiskSchema (only=None, exclude=(), many=False, context=None, load_only=(), dump_only=(), partial=False, unknown=None)
-
The fields of the Disk object
Ancestors
- netapp_ontap.resource.ResourceSchema
- marshmallow.schema.Schema
- marshmallow.schema.BaseSchema
- marshmallow.base.SchemaABC
Class variables
var aggregates
-
List of aggregates sharing this disk
var bay
-
Disk shelf bay
Example: 1
var class_
-
Disk class
Valid choices:
- unknown
- capacity
- performance
- archive
- solid_state
- array
- virtual
var container_type
-
Type of overlying disk container
Valid choices:
- aggregate
- broken
- foreign
- labelmaint
- maintenance
- shared
- spare
- unassigned
- unknown
- unsupported
- remote
- mediator
var dr_node
-
The dr_node field of the disk.
var drawer
-
The drawer field of the disk.
var firmware_version
-
The firmware_version field of the disk.
Example: NA51
var home_node
-
The home_node field of the disk.
var model
-
The model field of the disk.
Example: X421_HCOBE450A10
var name
-
Cluster-wide disk name
Example: 1.0.1
var node
-
The node field of the disk.
var opts
var pool
-
Pool to which disk is assigned
Valid choices:
- pool0
- pool1
- failed
- none
var rated_life_used_percent
-
Percentage of rated life used
Example: 10
var rpm
-
Revolutions per minute
Example: 15000
var serial_number
-
The serial_number field of the disk.
Example: KHG2VX8R
var shelf
-
The shelf field of the disk.
var state
-
State
Valid choices:
- broken
- copy
- maintenance
- partner
- pending
- present
- reconstructing
- removed
- spare
- unfail
- zeroing
var type
-
Disk interface type
Valid choices:
- ata
- bsas
- fcal
- fsas
- lun
- sas
- msata
- ssd
- vmdisk
- unknown
- ssd_nvm
var uid
-
The unique identifier for a disk
Example: 002538E5:71B00B2F:00000000:00000000:00000000:00000000:00000000:00000000:00000000:00000000
var usable_size
-
The usable_size field of the disk.
Example: 959934889984
var vendor
-
The vendor field of the disk.
Example: NETAPP