Snapshot

Snapshot can be utilised at the Filesystem, creating a GPFS ‘global snapshot’ or at the Fileset level, creating a localised snapshot.

Description

class arcapix.fs.gpfs.snapshot.Snapshot(filesystemName, snapshot_name, fileset_name=None, **kwargs)

Represents a snapshot on the filesystem.

Snapshots can be either global or per (Independent) Fileset. Therefore there a collections of snapshots on both Filesystem and Fileset Objects.

Parameters:
  • filesystemName (str) – The name of the filesystem to create the snapshot on
  • snapshot_name (str) – The name of the snapshot to create
  • fileset_name (str) – The name of the fileset to which this snapshot will/does apply. If None (or the magic value (root), a global snapshot is performed
id

Returns the numerical snapshot ID

Return type:int
status

Returns the status of the snapshot.

Typical values include ‘Valid’ and TBC

Return type:str

:raises GPFSExecuteException

name

Returns the name of the snapshot.

Return type:str
Raises:GPFSExecuteException
filesetName

Returns the name of the fileset which this snapshot relates to.

Returns None for global snapshots

Raises:GPFSExecuteException
Return type:str
filesystemName

Returns the name of the filesystem on which this snapshot is taken.

Return type:str
created

Returns the date and time the snapshot was created.

Raises:GPFSExecuteException
Return type:datetime
dataInKB

Returns the amount of data storage used by the snapshot.

Size in kilobytes

Return type:int
metadataInKB

Returns the amount of metadata storage used by the snapshot.

Size in kilobytes

Return type:int
location

Returns the directory location of the snapshot.

Raises:GPFSError if snapshot of an unlinked fileset
Return type:str
create()

Creates a snapshot based on the values stored in the object.

You must have created/set the object minimally with a filesystem name and a snapshot name, a fileset name is optional

Raises:GPFSExecuteException
delete(qosClass=None, nodes=None)

Deletes the snapshot from disk.

Parameters:
  • 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

change(**kwargs)

Change attributes of the object when this is supported.

Note: Snapshots cannot really be changed post creation, but we provide a method to set the attributes before creation if for some reason you have not provided them in the constructor.

You can specify one or more of the folling named parameters:

Parameters:
  • name (str) – The new name for the snapshot
  • filesetName (str) – The name of the fileset to which this snapshot will apply
  • filesystemName (str) – The name of the file system to which this snapshot will apply
Raises:

ValueError: Attempt to modify a snapshot which is on disk. Only in-memory snapshot objects (i.e. not yet ‘created’) can be modified.

Examples

Utilising Snapshot from the Cluster Object

>>> from arcapix.fs.gpfs import Filesystem
>>>
>>> # Load the 'mmfs1' Filesystem
... fs = Filesystem('mmfs1')
>>>
>>> # Create a global snapshot of the filesystem
... fs.snapshots.new('global-snapshot1')
>>>
>>> # Create a snapshot for a specific independent fileset
... fsnap = fs.filesets['sata1-cg-projects'].snapshots.new('indep-snapshot1')
>>>
>>> # Check the status of the snapshot
... print fsnap.status
Valid
>>>
>>> # Delete the snapshot
... fsnap.delete()
>>>
>>> # Check the status of the snapshot
... print fsnap.status
Deleted

Utilising Snapshot directly

>>> from arcapix.fs.gpfs import Snapshot
>>>
>>> # Create a snapshot of a specific, existing independent fileset
... mysnap = Snapshot('mmfs1', 'fset-snap', 'sata1-cg-projects')
>>> mysnap.create()
>>>
>>> # Check the status of the snapshot
... print mysnap.status
Valid
>>> # Delete the snapshot
... mysnap.delete()
>>>
>>> # Check the status of the snapshot
... print mysnap.status
Deleted