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 allFilesets
under aFilesystem
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: 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
- deleteNonEmpty (bool) –
-
change
(**kwargs)¶ Parameters:
-
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-snapshotReturn 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
-
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)