Snapshots

The Snapshots Object is a container of the Snapshot Object for the associated Filesystem and Filesets.

Snapshots is typically accessed and instantiated via the Cluster Object.

Description

class arcapix.fs.gpfs.snapshots.Snapshots(deviceName, filesetName=None)

Provides a view over the Snapshots class, filtering to only show snapshots of a given fileset.

If the fileset is passed as None, then global snapshots are returned.

NB. This collection is not externally mutable. Use the ‘new’ method to create snapshots and add them to the collection.

Parameters:
  • deviceName (str) – Name of the Filesystem to retrieve snapshots for
  • filesetName (str) – The fileset(name) by which to filter the snapshots. Only snapshots of this fileset are returned when iterating the collection.
new(name, **kwargs)

Create a new Snapshot, given a name.

The snapshot is taken of the fileset upon which this collection is filtering (as passed in the constructor)

Parameters:name (str) – The name to use for the snapshot. Note this must be unique per fileset, but need not be globally unique.
Return type:Snapshot
Raises:GPFSExecuteException: The underlying GPFS call to mmdelsnapshot failed
destroy(snapname, qosClass=None, nodes=None)

Destroy a snapshot.

This removes it from the filesystem, and also from this collection.

Parameters:
  • snapname (str) – The name of the snapshot to remove
  • qosClass (str) – Quality of Service class to which the operation should be assigned. One of ‘maintenance’ (default) or ‘other’. (GPFS version 4.2+ only)
  • nodes (str or list) – Nodes to participate in delete (default=all or defaultHelperNodes)
Raises:

GPFSExecuteException: The underlying GPFS call to mmdelsnapshot failed

Raises:

ValueError: The snapshot with the name passed was not found in the collection

Examples

Snapshot all independent filesets on the cluster whose name starts with ‘sata1-‘

>>> from arcapix.fs.gpfs import Cluster
>>> from arcapix.fs.gpfs import IndependentFileset
>>> import datetime
>>>
>>> # 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)