Follow

 


Purpose

The InfiniBox SnapRotator creates snapshots of InfiniBox volumes, filesystems and consistency groups. The tool enables keeping a user-defined number of snapshots (deleting the oldest snapshot upon creating a new one).

For VMware environment, SnapRotator can create a VM-consistent snapshot and automatically integrate it to Host PowerTools for VMware to allow an easy restore.

Modes of operation

The SnapRotator works in two distinct modes:

  • vCenter-aware mode
  • InfiniBox only

Location of the download file

Configuring the SnapRotator

Storage snapshot naming

The snapshots are named as follows:

<volname/volid>.<basename>.<yyyy.mm.dd_hhmmss>
  • volname/volid – the name of the volume/the volume id that the snapshots are created for
  • basename – a prefix that provides an indication on the snapshots interval (for example, daily, weekly, etc.)
  • timestamp – the exact time at which the snapshot was taken

A snapshot is created for each run, and if the number of snapshots exceeds the retention limit, older snapshots are deleted.

The number of the snapshots to retain must be an integer between 1 and 220. It is stored into the configuration file.

Mapped and cloned snapshots are not rotated

In a case that the rotating snapshot that has to be deleted is mapped to a host or cloned, it is not deleted until it is unmapped or its clones are deleted.

In such case, the snapshot is not rotated and newer snapshots may get deleted so the retention policy will hold.

Ad-hoc snapshots are not rotated

Snapshots created by administrators or other tools (i.e. not originates from SnapRotator) are not deleted by SnapRotator retention definition.

Limits

Volume name Must be less than 46 characters long
Total maximum number of snapshots in system 100,000
Total number of snapshots and/or clones per volume 100,000
Total number of snapshots and/or clones per filesystem 4,000

Scheduling the rotation

The SnapRotator tool does not schedule the rotations themselves. Instead, it is designed to be run from cron or other scheduling tool. It can be run under any user, and does not require any privileges. Each schedule requires its own ini file and cron task.

Example of a crontab entry:

# Perform a daily snapshot (InfiniBox only mode) at 23:53, keeping 10 snapshot back.
# Log to a logfile.
53 23 * * * /usr/bin/snaprotator -c /etc/shaprotator_daily.conf

InfiniBox authentication

The SnapRotator tool requires at least PoolAdmin level credentials to operate.

For VMware aware mode, the SnapRotator also requires datastore admin level credentials (for vCenter user used in the configuration file).

Using encrypted passwords

Passwords in the configuration file can be stored in cleartext or encrypted. The relevant fields in the configuration file are: [infinibox] password, [vcenter] password, [logging] emailpassword.

To generate the encrypted password, use the following command:

snaprotator --encrypt= or snaprotator -e

For example:


snaprotator --encrypt=my_secret_password1 
ENC:15A4FWIYb4hawBk5xhn7Axa3QlVpW2wqf9bKlW91JR6Di


You can then use the resulting encrypted password in the configuration file.

[infinibox] 
host = infinibox.local 
username = storageadmin 
password = ENC:15A4FWIYb4hawBk5xhn7Axa3QlVpW2wqf9bKlW91JR6Di

Events

The creation and deletion of snapshots is recorded by InfiniBox events. The events are visible via all management consoles: InfiniAPI, InfiniShell and InfiniBox GUI. 

Logging

Adding --logfile=<logfile> to a SnapRotator invocation causes it to write a rotating log file on each operation.

By default, SnapRotator keeps 14 log files, and log rotation is performed daily.

Sending the log to a Syslog daemon

Using the --syslog option will cause the SnapRotator to send all the log messages to the syslog daemon.

Command usage

snaprotator [options]
snaprotator -h | --help
snaprotator --version

Options

-c configfile --configfile=<configfile>   Config file location
-H hostname --hostname=<hostname>         DNS name of the InfiniBox 
-u user --user=<username>                 Administrator's username
-p password --password=<password>         Administrator's password 
-b basename --basename=<basename>         Basename (snapshot name prefix, for example, daily,weekly, etc...)
-r retain --retain=<retain>               Number of snapshots to retain
-l logfile --logfile=<logfile>            Use log file instead of stderr
-h, --help                                Show this screen 
-D, --debug                               Debug
-q, --quiet                               Suppress all informational messages 
-d, --dryrun                              Show what will be done
-P, --purge                               Purge all snapshots with basename <basename> //deprecated, use -r 
-s, --syslog                              Log to syslog daemon
-n, --norotation                          Do NOT rotate logfile, keep writing indefinitely
-V, --version                             Show snaprotator version
-Z, --force_report                        Force heartbeat (last 24 hours report)
-R, --delete                              Delete all snaps with given basename using wildcard
-L, --list                                Show all snapshots belonging to policy
-J, --listjson                            Show all snapshots belonging to policy in JSON format
--lockdays=<snap_lock_days>               Number of days to lock snapshot
--maxlockdays=<max_snap_lock_days>        Max number of days a snap can be locked
-e password --encrypt=<password>          Encrypt cleartext password for config file use

Examples

Retain 10 snapshots:

snaprotator -u user -p password -H host1 -v vol1 -r 10

Reduce the number of retailed snapshots from 10 to 2:

snaprotator -u user -p password -H host1 -v vol1 -r 2

Delete snapshots:

snaprotator -H ibox1521 -u user -p password -R -b BP101 -v vol1,vol2

Rotating snapshots of replication target entities

By default, SnapRotator does not take snapshot of replication target entities. To enable rotating snapshots of replication target entities, set the following parameter:

[global]
allow_replicas = true

In addition, make sure that the SnapRotator interval is larger than the asynchronous replication interval. In case that the SnapRotator interval is smaller that asynchronous replication interval, the SnapRotator will attempt to take a snapshot that is identical to the previously taken snapshot, and the operation will fail.

Include filesystem snapshots that have mapped exports

SnapRotator look at filesystems snapshots that themselves have exports mapped onto and include them in the snapshot cycle

By default, SnapRotator does not look at filesystem snapshots that have exports mapped onto them, and does not include them in the snapshot cycle. To enable this, set the following parameter:

[global]
# Allow snapshots of mapped fs snapshots
snap_mapped_fs_snapshots = True 

Take Snapshots of Active-Active Replicated Volumes

The SnapRotator tools allows taking snapshots of Active-Active replicated volumes. This option is available in both InfiniBox mode and VMware mode.

To use this option, the username and password must be identical for both of the Active-Active InfiniBox systems.

The option is configured under the global section:

[global] 
snap_both_aa_peers = True

Once this option is enabled, the SnapRotator tool will automatically detect the remote InfiniBox system and manage the snapshots of the Active-Active volume on both systems.

vCenter-aware mode

In this mode, the SnapRotator creates rotating snapshots of VMware cluster datastores. Snapshots that share the same prefix are created for each of the VMs in the datastore, according to a predefined policy.

The snapshots are registered in the INFINIDAT Host PowerTools for VMware, and can be accessed from the vCenter HPTVM plugin.

vCenter-aware mode is applicable to volumes only.

Before you begin

Consistency guarantees

InfiniBox SnapRotator guarantees the following:

  • Snapshotting a volume is crash-consistent
  • Snapshotting an RDM volume is crash-consistent
  • Snapshotting datastores and VMs w/o RDM, where all of the datastore volumes are InfiniBox, is:
    • Filesystem consistent (given that the VM is not under [noquiesce] section)

    • Application-consistent (if used with VMware tools and VSS)

Restoring

The snapshots created by the SnapRotator are visible in Host PowerTools for VMware.

The configuration file

The SnapRotator will take snapshots of VMs on the specified datastore(s) according to wildcards that are stored in the config file.

VMs can be included or excluded from the snapshotting process.

Memory snapshot and quiesce are also configurable on a per-VM basis.

Upon operating the SnapRotator

  • The SnapRotator identifies all of the InfiniBox volumes that are part of the specified datastores and create an InfiniBox snapshot for them.
  • The SnapRotator removes all VM snapshots of InfiniBox volumes.

How to

The workflow of operating SnapRotator on VMware is as follows:

  1. Connect to InfiniBox and vCenter.
  2. Find VMs that reside on datastores connected to InfiniBox.
  3. Filter datastores/VMs using corresponding config file sections.
  4. Perform a VMWare snap for each VM using the config file options (quiesce, memory, base snap name).
  5. Create InfiniBox snap for each InfiniBox volume associated with datastore.
  6. Remove old snaps from InfiniBox according to config file options.
  7. Register and unregister created/removed snapshots on Host PowerTools for VMware.
  8. Remove VMWare snap we just created - this is also done in parallel.


When setting up for VMware, the user must login to the vCenter with the vCenter user that is defined for the SnapRotator, and confirm the HPTV plugin window has the array user for the SnapRotator defined and "Remember these credentials" is checked.
Unless that is done, when executing SnapRotator the user will get an error of failing to register the snapshot due to credentials missing for the array.

Invoking the SnapRotator in vCenter-aware mode

  1. Create the .conf file.
  2. Point the SnapRotator to the file: 

    /usr/bin/snaprotator -c/etc/vmware_snapshot.conf
  3. Create a log path: 

    /var/log/snaprotator/snaprotator.log
  4. (Recommended)
    Create a local user for SnapRotator activities.

Editing the configuration file

The first line of the configuration file must be [global].

[global]

# Take a snapshot of an Active-Active volume on both systems
# The user credentials must be correct on both Active-Active systems
snap_both_aa_peers = True

# Basename i.e daily,weekly - both InfiniBox and VMWare
snap_basename = daily


# How much snaps to retain
snaps_to_keep = 7


#Use volume name or volume id to generate snap name
use_volid = True

#Only allow one snaprotator running
single_instance = False

# Whether to allow creating snaps of replica targets
allow_replicas = False

# Allow snapshots of mapped fs snapshots
snap_mapped_fs_snapshots = False

# Perform snapshot of both Active-Active systems. Requires identical
# username and password on both systems
snap_both_aa_peers = False

# Make snapshots immutable for a limited time
# WARNING: this has capacity implications, as immutable
#          snaps can't be destroyed
# snap_lock_days = 0
# Set a limit on the snap lock window.  
# WARNING: set this with care; see above capacity warning
# max_snap_lock_days = 30


[logging]


# Log to syslog daemon
syslog = true


# Whether rotate log files or log to a single file
rotation = False


# Log file path or 'stderr'
logpath = /var/log/snaprotator/snaprotator.log


# Suppress all informational messages in console
quiet = False


# Display debug information in console
debug = False


# Whether to send email after job completion
email = False


# (optional) if using authentication, user that sends emails
emailuser = user@infinidat.com


# (optional) if using authentication, password of sender
emailpassword = $Passw0rd


# Who is the sender of the email
emailsender = sender@infinidat.com


# List of recipients, separated by comma (,)
emailrcpt = recipient@customer.com


# Email server to send email to
emailserver = smtp.gmail.com


# (optional) email server port to send email to. Default is port 25
emailport = 587


# (optional) Emit emails in Backup Radar compatible format
backup_radar_email_format = False


# (optional) Do not send emails if no errors or warnings were found
email_skip_success = False


[vcenter]


# Vcenter host name/ip
host = vcenter.customer.com


# Vcenter user name
username = Administrator


# Vcenter password
password = my_password


# (optional) How many snapshot operations to perform simultaneously
parallel = 10



# (optional) Include templates in the snapshot
include_templates = False

[infinibox]


host = infinibox.local
username = storageadmin
password = storage_admin_password


[datastores]


# Include datastore by name (* is match all)
datastore_to_include


# Exclude datastores - starts with exclamation mark
!datastores_to_exclude*


# include all datastores
*


[vms]


# Include vm by name
vm_to_snapshot


# By wildcard
*vms_which_end_like_me 


# Exclude by name
!not_vms_which_start_like_me*


# Exclude by wildcard 
!*temp*


[noquiesce]


# list of vms to skip quiesce
*linux*


# Those VM's memory will not be included in snapshot
[nomemory]
!*vm_important*
*linux*

Creating snapshots

Run snaprotator.
The on-screen notifications inform you on the various steps taken:
Connect to InfiniBox and vCenter:

[2015-05-20 11:49:28.157460] INFO: snaprotator.infinibox: Connecting to the Infinibox 'ibox039'
[2015-05-20 11:49:35.060944] INFO: snaprotator.snaprotator: Connecting to VCenter 'vcenter-colo'

Identify the datastore and powered on virtual machines:

[2015-05-20 11:49:43.218501] INFO: snaprotator.snaprotator: Datastores to snap: ['Betti_DS_01']
[2015-05-20 11:49:50.554162] INFO: snaprotator.snaprotator: VMS to snap: ['Win2008R2_01']

Identify InfiniBox volume:

[2015-05-20 11:49:50.867464] INFO: snaprotator.snaprotator: Infinibox volumes to snap: ['Betti_DS_01']

Create a snapshot for each VM in the datastore: 

[2015-05-20 11:49:51.021857] INFO: snaprotator.vmware: Creating snapshot for vm Win2008R2_01 (quiesce = False memory = False)
[2015-05-20 11:49:56.591985] INFO: snaprotator.snaprotator: Successfully created snapshot for VM Win2008R2_01 ('vim.vm.Snapshot:snapshot-414')

Snapshot rotating (creating a snapshot and deleting a previously created snapshot) in InfiniBox:

[2015-05-20 11:49:58.044207] INFO: snaprotator.infinibox: Checking for the 'Betti_DS_01' volume
[2015-05-20 11:49:59.339015] DEBUG: snaprotator.infinibox: Volume validation - OK
[2015-05-20 11:49:59.980640] INFO: snaprotator.rotation: Creating snapshot Betti_DS_01.daily.2015.05.20_114959 for volume Betti_DS_01
[2015-05-20 11:50:08.720609] INFO: snaprotator.rotation: Deleted snapshot Betti_DS_01.daily.2015.05.19_181013

Registering the InfiniBox snapshot to the Host PowerTools for VMware:

[2015-05-20 11:50:17.382388] INFO: snaprotator.powertools: Successfully registered snapshot with Host Power Tools for VMware for Betti_DS_01
[ [2015-05-20 11:50:21.376718] INFO: snaprotator.snaprotator: Done.

Viewing the datastore with its snapshots using Host PowerTools for VMware

The INFINIDAT tab of the vSphere cluster displays VMs along with their InfiniBox snapshots.

InfiniBox-only mode

In this mode of operation, the SnapRotator will create rotating snapshots for specific InfiniBox
volumes, filesystems,or consistency groups.

The required volumes/CGs wildcards are configured in the [volume] section.and the required
filesystems wildcards are configured in [fs] section of the config file.

Setup

Invoking the SnapRotator in InfiniBox-only mode

  1. Create the .conf file.

  2. Point the SnapRotator to the file: 

    /usr/bin/snaprotator -c /etc/infinibox_snapshot.conf
  1. Create a log path:

    /var/log/snaprotator/snaprotator.log
  2. (Recommended)
    Create a local user for SnapRotator activities.

Editing the configuration file

Volumes and filesystem names:

  • Can include spaces
  • Have to be comma separated
  • Can use wildcards


[global]

# Basename i.e daily,weekly
snap_basename = daily


# How much snaps to retain
snaps_to_keep = 7


# Use volume name or volume id to generate snap name
use_volid = True


[logging]


# Log to syslog daemon
syslog = true
rotation = False


# Log file path or ''stderr'
logpath = /var/log/snaprotator/snaprotator.log


# Suppress all informational messages in console
quiet = False


# Show debug in console
debug = False


[infinibox]


host = infinibox.local
username = storageadmin
password = storage_admin_password


[volumes]
*volume_or_cg_include_names*
!*volume_or_cg_exclude_names*


[fs]
*fs_include_names*
!*fs_exclude_names*

How to

Creating snapshots using command-line interface

Run snaprotator

  1. Use the following parameters: 
    -H The name of the InfiniBox that the volume belongs to
    -u and -p InfiniBox credentials (user and password)
    -v The volume(s) for which SnapRotator takes snapshots
    -b The snapshots frequency
    -r The number of snapshots that are retained before rotating
    -D Toggle between regular and debug mode

  2. For example:

    snaprotator -H ibox517 -u infinidat -p ****** -v volume -b daily -r 3
  3. Output example:

    11:37 INFO Connecting to the Infinibox 'ibox517' 
    11:37 INFO Checking for the 'volume' volume 
    11:37 INFO Creating snapshot volume.daily.2015.05.20_113735 for volume volume 
    11:37 INFO Done.

Run the command twice more, in order to create two more snapshots: 

# snaprotator -H ibox517 -u infinidat -p 123456 -v volume -b daily -r 3
11:37 INFO Connecting to the Infinibox 'ibox517'
11:37 INFO Checking for the 'volume' volume
11:37 INFO Creating snapshot volume.daily.2015.05.20_113739 for volume volume
11:37 INFO Done.

# snaprotator -H ibox517 -u infinidat -p 123456 -v volume -b daily -r 3
11:37 INFO Connecting to the Infinibox 'ibox517'
11:37 INFO Checking for the 'volume' volume
11:37 INFO Creating snapshot volume.daily.2015.05.20_113741 for volume volume
11:37 INFO Deleted snapshot volume.daily.2015.05.20_113721
11:37 INFO Done.

Run the command again. As three snapshots already exist, one snapshot will be deleted in order to allow for the next snapshot to be created.

# snaprotator -H ibox517 -u infinidat -p 123456 -v volume -b daily -r 3
[2015-05-20 11:38:02.277785] INFO: snaprotator.infinibox: Connecting to the Infinibox 'ibox517'
[2015-05-20 11:38:02.533773] INFO: snaprotator.infinibox: Checking for the 'volume' volume
[2015-05-20 11:38:02.583822] DEBUG: snaprotator.infinibox: Volume validation - OK
[2015-05-20 11:38:02.604478] INFO: snaprotator.rotation: Creating snapshot volume.daily.2015.05.20_113802 for volume volume
[2015-05-20 11:38:02.811918] INFO: snaprotator.rotation: Deleted snapshot volume.daily.2015.05.20_113735
[2015-05-20 11:38:02.812133] INFO: snaprotator.snaprotator: Done.

Running SnapRotator for several volumes

Run snaprotator with several volumes, separated with a comma:

#snaprotator -H ibox517 -u infinidat -p 123456 -v volume,volume2 -b daily -r 3 -D
[2015-05-20 11:40:28.142928] INFO: snaprotator.infinibox: Connecting to the Infinibox 'ibox517'
[2015-05-20 11:40:28.404185] INFO: snaprotator.infinibox: Checking for the 'volume' volume
[2015-05-20 11:40:28.461842] DEBUG: snaprotator.infinibox: Volume validation - OK
[2015-05-20 11:40:28.481380] INFO: snaprotator.rotation: Creating snapshot volume.daily.2015.05.20_114028 for volume volume
[2015-05-20 11:40:28.679679] INFO: snaprotator.rotation: Deleted snapshot volume.daily.2015.05.20_113739
[2015-05-20 11:40:28.679900] INFO: snaprotator.infinibox: Checking for the 'volume2' volume
[2015-05-20 11:40:28.737492] DEBUG: snaprotator.infinibox: Volume validation - OK
[2015-05-20 11:40:28.759381] INFO: snaprotator.rotation: Creating snapshot volume2.daily.2015.05.20_114028 for volume volume2
[2015-05-20 11:40:28.833376] INFO: snaprotator.snaprotator: Done.

Viewing the volume and its snapshots on InfiniBox

Open the InfiniShell console

Run the vol.tree command with the name of the volume.

Input example:

vol.tree vol=volume

The output is (some of the table columns were removed, for ease of viewing):

vol.tree name=volume
NAME                           TYPE   SIZE     POOL      CREATED AT
volume                         VOLUME 10.00 GB v240-cert 2015-05-19 15:40:04
volume.daily.2015.05.20_113741 SNAP   10.00 GB v240-cert 2015-05-20 08:37:41
volume.daily.2015.05.20_113802 SNAP   10.00 GB v240-cert 2015-05-20 08:38:02
volume.daily.2015.05.20_114028 SNAP   10.00 GB v240-cert 2015-05-20 08:40:28

Note that the snapshot name includes the time zone of the host, while the value of the Created At column is the time zone of InfiniBox.

Appendix: InfiniBox SnapRotator Exit Codes

InfiniBox SnapRotator error codes

CodeTypeMessage
1Genericerror
10CONFIGConfiguration file path not found
11CONFIGConfiguration file or command line parameters error
20IBOXCould not connect to InfiniBox: username/password error
21IBOXInfiniBox API command failed
22IBOXFailed to connect to InfiniBox: network error
23IBOXInfiniBox version is not supported by this version of SnapRotator
24IBOXMaximum number of snapshots per InfiniBox system has been reached
25IBOXFailed to find InfiniBox volume
26IBOXToo many snapshots for an InfiniBox volume
27IBOXVolume name is longer than supported
40VMWAREvCenter connection error
41VMWAREvCenter login error
42VMWAREFailed to connect to vCenter. Unknown error
43VMWARECannot find datastores for a snapshot

InfiniBox SnapRotator warning codes

CodeTypeMessage
128
Generic warning
129
Execution has been interrupted by Ctrl+C
130HPTVMHTTP request failed
131HPTVMCannot delete a snapshot from Host PowerTools for VMware
132HPTVMFailed to remove a snapshot from Host PowerTools for VMware
140HPTVMFailed to register a snapshot with Host PowerTools for VMware
141HPTVMFailed to unregister a snapshot with Host PowerTools for VMware
150IBOXFailed to delete a snapshot from InfiniBox
151IBOXFailed to create the latest snapshot on InfiniBox
160VMWARECannot create a VM snapshot
161VMWAREThe object has already been deleted or has not been completely created
162VMWARECannot delete a VM snapshot
163VMWAREUnknown VM snapshot remove error
164VMWAREUnknown error in VMware cleanup
171VMWARESnapshot creation failed
172VMWAREUnknown error in snapshot creation
173VMWARESnapshot deletion failed
174VMWAREUnknown error in snapshot removal
175VMWAREFailed to cleanup a snapshot
176VMWARENo VMs discovered from the configuration file, continuing InfiniBox snapshots without OS consistency


Was this article helpful?
0 out of 0 found this helpful

0 out of 0 found this helpful

Comments