Nsd

The Nsd object represents a storage device attached to one or more server nodes. It may or may not have been added to a filesystem.

Description

class arcapix.fs.gpfs.nsd.Nsd(name, filesystem=None, servers=None)

An NSD (Network Shared Disk) is a storage device connected to one or more server nodes.

Parameters:
  • name (str) – Name of the NSD
  • filesystem (str or Filesystem) – Filesystem to which the NSD belongs (None if unassigned)
  • servers (list of str or Node) – A list of server nodes associated with the NSD
id

Returns the id of the NSD

synonym for name

Return type:str
name

Returns the name of the NSD

Return type:str
filesystemName

Returns the name of the filesystem the disk belongs to

Returns None if the NSD is unassigned

Return type:str
filesystem

Returns the filesystem the disk belongs to

Returns None if the NSD is unassigned

Return type:Filesystem
volumeId

Returns the alphanumeric volume id of the disk

Return type:str
servers

Returns a list of the server nodes attatched to the NSD.

In the case of an ECE VDisk, this will be the list of servers in the nodeclass which manages the disk

If the nsd is ‘directly attached’, an empty dict will be returned.

Return type:dict of Node objects
serverNames

Returns a list of names of server nodes attached to the NSD

In the case of an ECE VDisk, this will be the list of servers in the nodeclass which manages the disk

If the nsd is ‘directly attached’, an empty list will be returned.

Return type:list of str
localCache

Returns whether the nsd is configure for local cache disk usage.

Return type:bool
vdiskNodeClass

Returns the nodeclass associated with this NSD, if the NSD is ECE based (vdisk)

Returns None otherwise

Return type:Nodeclass
vdisk

Returns a VDisk object if the NSD is ECE Based (i.e. a vdisk), or None otherwise.

The VDisk object is currently a stub, with only name and nodeclass properties.

if nsd.vdisk:
    print(nsd.vdisk.name)
    print(nsd.vdisk.nodeclass.name)

A future release will flesh-out this object, the strucuture of which is subject to change

free

Returns True if the NSD is presently free. (unassigned)

Synonym for unassigned

direct

Returns True if the NSD is directly attached (as opposed to being managed by a server)

Return type:bool
unassigned

Synonym for free. The NSD is not presently assigned to a filesystem

device_map

Returns a dict of node names to node-specific device info.

The NSD might be mapped to a different device on different nodes.

For each node (or nodeclass if ECE VDisk), the value is a dict containing device, deviceType, and remarks

for name in nsd.serverNames:
    print(name, nsd.device_map[name]['device'])
Return type:dict
device

Returns the path of the block device that makes up the NSD

Typically “/dev/…”

The NSD might be mapped to a different device on different nodes. If the NSD is accessed via a Node object, the value will be specific to that node e.g. node.nsds['nsd001'].device

Return type:str
deviceType

Returns the device type of the NSD

Typically ‘hdisk’ or ‘dmm’

Return type:str
remarks

Returns any remarks about the NSD

e.g. ‘server node’

The NSD might be mapped to a different device on different nodes. If the NSD is accessed via a Node object, the value will be specific to that node e.g. node.nsds['nsd001'].remarks

Return type:str
storagePoolName

Returns the name of the NSD.

Return type:str
totalSizeBytes

Returns the total capacity of the NSD in bytes.

Return type:long
failureGroup

Returns the failure group that the NSD is assigned to.

Return type:long
data

Returns True if the NSD is allocated for data usage.

Return type:bool
metadata

Returns True if the NSD is allocated for metadata usage.

Return type:bool
contiguousSpaceBytes

Returns the amount of contiguous space in bytes for the NSD.

Return type:long
fragmentedSpaceBytes

Returns the amount of fragmented space in bytes for the NSD.

Return type:long
thinDisk

Returns if an NSD is a thin disk

Return type:bool

Examples

Checks an NSD’s device name on each attached node

>>> from __future__ import print_function
>>> from arcapix.fs.gpfs import Nsd
>>>
>>> # create an NSD object
... n = Nsd('md3200_001_L001')
>>>
>>> # look up device names
... for name in nsd.serverNames:
...     print(name, nsd.device_map[name]['device'])
...
pixstor-sn-001 /dev/gpfsblock/mmfs1-md2
pixstor-sn-002 /dev/gpfsblock/mmfs1-md1

Check the state of an NSD’s server nodes

>>> from arcapix.fs.gpfs import Disk
>>>
>>> # create a Disk object
... d = Disk("md3200_001_L000", "mmfs1")
>>>
>>> # loop over disk's NSD's server nodes
... for s in d.nsd.servers.values():
...    print(s.id, s.state)
...
pixstor-sn-001 active
pixstor-sn-002 active