Filesets

The Filesets Object is a container of the IndependentFileset Object and DependentFileset Object for the associated file system.

Filesets is typically accessed and instantiated via the Cluster Object.

Description

class arcapix.fs.gpfs.filesets.Filesets(deviceName)

An OrderedDict for all Filesets under a Filesystem

Parameters:deviceName (str) – Name of the filesystem with which the filesets are associated
new(filesetname, maxInodes=None, allocInodes=None, **kwargs)

Creates a new Fileset.

Parameters:
  • maxInodes (int) – The hard limit for the number of inodes to allocate. If value > 0, an IndependentFileset is created.
  • allocInodes (int) – The number of inodes to pre-allocate to an independent fileset.
  • remotePath – If specified, a CachedFileset is created
Returns:

The newly created Fileset

destroy(filesetid, deleteNonEmpty=False, unlink=False, force=False, qosClass=None)

Deletes the specified fileset, optionally forcing the operation if the fileset contains data.

Parameters:
  • deleteNonEmpty (bool) –

    Synonym for force

    True: Filesets which are not empty will be forcably deleted.

    False (default): A Fileset containing data will not be deleted.

  • force (bool) –

    Partial Synonym for deleteNonEmpty

    True: Filesets which are not empty will be forcably deleted.

    False (default): A Fileset containing data will not be deleted.

    In addition, setting force to True will forcibly unlink the fileset, if unlink is also specified.

  • unlink (bool) –

    True: The Fileset will be unlinked prior to deletion.

    False (default): Fileset will proceed immediately to deletion.

  • qosClass (str) – Quality of Service class to which the operation should be assigned. One of ‘maintenance’ (default) or ‘other’. (GPFS version 4.2+ only)
Returns:

None

Raises:

GPFSError

change(**kwargs)
Parameters:
  • snapDir (str) – Change the name of the directory under which fileset snapshots are stored (default=’.snapshots’)
  • showGlobalSnapshots (bool) – Change whether global snapshots are shown in all fileset snapshot directories. E.G. /mmfs1/fset1/.snapshots/global-snapshot
snapDir

Returns the name of the directory into which fileset snapshots are created

Default:.snapshots
Return type:str
showGlobalSnapshots

Returns whether global snapshots are shown in all fileset snapshot directories.

E.G. /mmfs1/fset1/.snapshots/global-snapshot
Return type:bool
inodeSpaceOwner(inodeSpaceId)

Returns the Independent Fileset which owns the inode space with given numerical id.

Returns None if the inodeSpaceId passed is not used on the filesystem.

Return type:IndependentFileset
active()

Convenience method that only returns active filesets

i.e. not Deleted, not with stale snapshots

Return type:dict
dependent()

Convenience method for only returning Dependent Filesets

Return type:dict
independent()

Convenience method which only returns Independent Filesets

Return type:dict
afm()

Convenience method which only returns Cache Filesets (i.e. as used in afm systems)

Return type:dict
cache()

Synonym for afm

Return type:dict

Examples

Utilising Filesets from the Cluster Object

>>> from arcapix.fs.gpfs import Cluster
>>>
>>> # Load our cluster
... mycluster = Cluster()
>>>
>>> # Create a dependent fileset and link it to the mmfs1 file system
... filesys = mycluster.filesystems['mmfs1']
>>>
>>> # The fileset is automatically created via filesets.new()
... fset = filesys.filesets.new('dep-fileset')
>>>
>>> # Link the fileset to the file system
... fset.link('/mmfs1/created-via-filesets-object-dir')
>>>
>>> # Unlink the fileset
... fset.unlink()

Iterating Fileset from the Filesets Object

>>> from arcapix.fs.gpfs import Cluster
>>>
>>> # Load our cluster
... mycluster = Cluster()
>>>
>>> # Select the mmfs1file system
... filesys = mycluster.filesystems['mmfs1']
>>>
>>> # Print the names of all independent filesets and where they are linked
... for fset in filesys.filesets.values():
...     if isinstance(fset, IndependentFileset):
...         print("{0}\t\t{1}".format(fset.name, fset.path))
...
root                     /mmfs1
sas1-4K-playback         /mmfs1/data/4K-playback
sata2-avid-bin           /mmfs1/data/avid2
sata1-cg-projects        /mmfs1/data/maya
sata2-testwrap           /mmfs1/data/1234569797

Snapshot all independent filesets on starting with name ‘sata1’

>>> import datetime
>>> from arcapix.fs.gpfs import Cluster
>>> from arcapix.fs.gpfs import IndependentFileset
>>>
>>> # Load our cluster
... mycluster = Cluster()
>>>
>>> # Select the mmfs1 file system
... filesys = mycluster.filesystems['mmfs1']
>>>
>>> # Create a snapshot name compatible with SAMBA's vss_shadow_copy2
... today = datetime.datetime.today()
... snapshot_name = datetime.datetime.strftime(today, "@GMT-%Y.%m.%d-%H.%M.%S")
>>>
>>> # Iterate the filesystem's filesets
... for fset in filesys.filesets.values():
...
...     # Only IndependentFilesets support snapshots
...     if isinstance(fset, IndependentFileset) and fset.name.startswith("sata1-"):
...
...         # Create the snapshot
...         fset.snapshots.new(snapshot_name)