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
-
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
-
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
-
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
andnodeclass
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
, andremarks
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
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