Module netapp_ontap.resources.tape_device

Copyright © 2022 NetApp Inc. All rights reserved.

Retrieving storage tape information

The storage tape GET API retrieves all of the tapes in the cluster.


Examples

1) Retrieving a list of tapes from the cluster

The following example returns the list of tapes in the cluster:


from netapp_ontap import HostConnection
from netapp_ontap.resources import TapeDevice

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    print(list(TapeDevice.get_collection()))

[
    TapeDevice(
        {
            "node": {
                "_links": {
                    "self": {
                        "href": "/api/cluster/nodes/4083be52-5315-11eb-a839-00a0985ebbe7"
                    }
                },
                "uuid": "4083be52-5315-11eb-a839-00a0985ebbe7",
                "name": "st-8020-1-01",
            },
            "device_id": "2d.0",
        }
    ),
    TapeDevice(
        {
            "node": {
                "_links": {
                    "self": {
                        "href": "/api/cluster/nodes/4083be52-5315-11eb-a839-00a0985ebbe7"
                    }
                },
                "uuid": "4083be52-5315-11eb-a839-00a0985ebbe7",
                "name": "st-8020-1-01",
            },
            "device_id": "2d.0L1",
        }
    ),
    TapeDevice(
        {
            "node": {
                "_links": {
                    "self": {
                        "href": "/api/cluster/nodes/4083be52-5315-11eb-a839-00a0985ebbe7"
                    }
                },
                "uuid": "4083be52-5315-11eb-a839-00a0985ebbe7",
                "name": "st-8020-1-01",
            },
            "device_id": "qeg-tape-brocade2-8g:0.126",
        }
    ),
    TapeDevice(
        {
            "node": {
                "_links": {
                    "self": {
                        "href": "/api/cluster/nodes/4083be52-5315-11eb-a839-00a0985ebbe7"
                    }
                },
                "uuid": "4083be52-5315-11eb-a839-00a0985ebbe7",
                "name": "st-8020-1-01",
            },
            "device_id": "stsw-broc6510-01:11.126",
        }
    ),
    TapeDevice(
        {
            "node": {
                "_links": {
                    "self": {
                        "href": "/api/cluster/nodes/4083be52-5315-11eb-a839-00a0985ebbe7"
                    }
                },
                "uuid": "4083be52-5315-11eb-a839-00a0985ebbe7",
                "name": "st-8020-1-01",
            },
            "device_id": "stsw-broc6510-01:15.126",
        }
    ),
    TapeDevice(
        {
            "node": {
                "_links": {
                    "self": {
                        "href": "/api/cluster/nodes/4083be52-5315-11eb-a839-00a0985ebbe7"
                    }
                },
                "uuid": "4083be52-5315-11eb-a839-00a0985ebbe7",
                "name": "st-8020-1-01",
            },
            "device_id": "stsw-broc6510-01:15.126L1",
        }
    ),
    TapeDevice(
        {
            "node": {
                "_links": {
                    "self": {
                        "href": "/api/cluster/nodes/4083be52-5315-11eb-a839-00a0985ebbe7"
                    }
                },
                "uuid": "4083be52-5315-11eb-a839-00a0985ebbe7",
                "name": "st-8020-1-01",
            },
            "device_id": "stsw-broc6510-01:22.126",
        }
    ),
    TapeDevice(
        {
            "node": {
                "_links": {
                    "self": {
                        "href": "/api/cluster/nodes/4083be52-5315-11eb-a839-00a0985ebbe7"
                    }
                },
                "uuid": "4083be52-5315-11eb-a839-00a0985ebbe7",
                "name": "st-8020-1-01",
            },
            "device_id": "stsw-broc6510-01:23.126",
        }
    ),
]


2) Retrieving a specific tape device from the cluster

The following example returns the requested tape device. If there is no tape with the requested UID, an error is returned.


from netapp_ontap import HostConnection
from netapp_ontap.resources import TapeDevice

with HostConnection("<mgmt-ip>", username="admin", password="password", verify=False):
    resource = TapeDevice(
        device_id="2d.0", **{"node.uuid": "5f5275eb-5315-11eb-8ac4-00a0985e0dcf"}
    )
    resource.get()
    print(resource)

TapeDevice(
    {
        "wwnn": "5001697722ee0010",
        "block_number": -1,
        "residual_count": 0,
        "type": "tape",
        "device_names": [
            {
                "no_rewind_device": "nrst0l",
                "rewind_device": "rst0l",
                "unload_reload_device": "urst0l",
            },
            {
                "no_rewind_device": "nrst0m",
                "rewind_device": "rst0m",
                "unload_reload_device": "urst0m",
            },
            {
                "no_rewind_device": "nrst0h",
                "rewind_device": "rst0h",
                "unload_reload_device": "urst0h",
            },
            {
                "no_rewind_device": "nrst0a",
                "rewind_device": "rst0a",
                "unload_reload_device": "urst0a",
            },
        ],
        "interface": "sas",
        "node": {
            "_links": {
                "self": {
                    "href": "/api/cluster/nodes/5f5275eb-5315-11eb-8ac4-00a0985e0dcf"
                }
            },
            "uuid": "5f5275eb-5315-11eb-8ac4-00a0985e0dcf",
            "name": "st-8020-1-02",
        },
        "device_id": "2d.0",
        "file_number": -1,
        "formats": [
            "LTO-4/5 Native Density",
            "LTO-4/5 Compressed",
            "LTO-6 2.5TB",
            "LTO-6 6.25TB Compressed",
        ],
        "wwpn": "5001697722ee0011",
        "reservation_type": "off",
        "device_state": "offline",
        "storage_port": {"name": "2d"},
        "description": "IBM LTO-6 ULT3580",
        "serial_number": "1068000245",
        "alias": {"mapping": "SN[1068000245]", "name": "st7"},
    }
)


Classes

class TapeDevice (*args, **kwargs)

Allows interaction with TapeDevice 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

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

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 find(*args, connection: HostConnection = None, **kwargs) -> Resource

Retrieves a collection of tape devices.

  • storage tape 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 a collection of tape devices.

  • storage tape 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.

Methods

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

Retrieves a specific tape.

  • storage tape 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 TapeDeviceSchema (*, 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 TapeDevice object

Ancestors

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

Class variables

alias GET

The alias field of the tape_device.

block_number GET

Block number.

Example: 0

description GET

The description field of the tape_device.

Example: QUANTUM LTO-8 ULTRIUM

device_id GET

The device_id field of the tape_device.

Example: 1a.0

device_names GET

The device_names field of the tape_device.

device_state GET

Operational state of the device.

Valid choices:

  • unknown
  • available
  • ready_write_enabled
  • ready_write_protected
  • offline
  • in_use
  • error
  • reserved_by_another_host
  • normal
  • rewinding
  • erasing
file_number GET

File number.

Example: 0

formats GET

Tape cartridge format.

Example: ["LTO-7 6TB","LTO-7 15TB Compressed","LTO-8 12TB","LTO-8 30TB Compressed"]

interface GET

Device interface type.

Valid choices:

  • unknown
  • fibre_channel
  • sas
  • pscsi
node GET

The node field of the tape_device.

reservation_type GET

The reservation_type field of the tape_device.

Valid choices:

  • off
  • persistent
  • scsi
residual_count GET

Residual count of the last I/O operation.

Example: 0

serial_number GET

The serial_number field of the tape_device.

Example: 10WT00093

storage_port GET

The storage_port field of the tape_device.

type GET

Device type.

Valid choices:

  • unknown
  • tape
  • media_changer
wwnn GET

World Wide Node Name.

Example: 500507631295741c

wwpn GET

World Wide Port Name.

Example: 500507631295741c