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 writable snapshots are not rotated
In a case that the rotating snapshot that has to be deleted is mapped to a host or to a writable snapshot, it is not deleted until it is unmapped or its writeable snaps 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 writeable snaps per volume | 1,000 |
Total number of snapshots and/or writeable snaps per filesystem | 1,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.
- See Related documentation for details on InfiniBox management consoles documentation.
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:
- Connect to InfiniBox and vCenter.
- Find VMs that reside on datastores connected to InfiniBox.
- Filter datastores/VMs using corresponding config file sections.
- Perform a VMWare snap for each VM using the config file options (quiesce, memory, base snap name).
- Create InfiniBox snap for each InfiniBox volume associated with datastore.
- Remove old snaps from InfiniBox according to config file options.
- Register and unregister created/removed snapshots on Host PowerTools for VMware.
- Remove VMWare snap we just created - this is also done in parallel.
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
- Create the .conf file.
Point the SnapRotator to the file:
/usr/bin/snaprotator -c/etc/vmware_snapshot.conf
Create a log path:
/var/log/snaprotator/snaprotator.log
- (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
- Create the .conf file.
Point the SnapRotator to the file:
/usr/bin/snaprotator -c /etc/infinibox_snapshot.conf
Create a log path:
/var/log/snaprotator/snaprotator.log
- (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
- 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 For example:
snaprotator -H ibox517 -u infinidat -p ****** -v volume -b daily -r 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
Code | Type | Message |
---|---|---|
1 | Generic | error |
10 | CONFIG | Configuration file path not found |
11 | CONFIG | Configuration file or command line parameters error |
20 | IBOX | Could not connect to InfiniBox: username/password error |
21 | IBOX | InfiniBox API command failed |
22 | IBOX | Failed to connect to InfiniBox: network error |
23 | IBOX | InfiniBox version is not supported by this version of SnapRotator |
24 | IBOX | Maximum number of snapshots per InfiniBox system has been reached |
25 | IBOX | Failed to find InfiniBox volume |
26 | IBOX | Too many snapshots for an InfiniBox volume |
27 | IBOX | Volume name is longer than supported |
40 | VMWARE | vCenter connection error |
41 | VMWARE | vCenter login error |
42 | VMWARE | Failed to connect to vCenter. Unknown error |
43 | VMWARE | Cannot find datastores for a snapshot |
InfiniBox SnapRotator warning codes
Code | Type | Message |
---|---|---|
128 | Generic warning | |
129 | Execution has been interrupted by Ctrl+C | |
130 | HPTVM | HTTP request failed |
131 | HPTVM | Cannot delete a snapshot from Host PowerTools for VMware |
132 | HPTVM | Failed to remove a snapshot from Host PowerTools for VMware |
140 | HPTVM | Failed to register a snapshot with Host PowerTools for VMware |
141 | HPTVM | Failed to unregister a snapshot with Host PowerTools for VMware |
150 | IBOX | Failed to delete a snapshot from InfiniBox |
151 | IBOX | Failed to create the latest snapshot on InfiniBox |
160 | VMWARE | Cannot create a VM snapshot |
161 | VMWARE | The object has already been deleted or has not been completely created |
162 | VMWARE | Cannot delete a VM snapshot |
163 | VMWARE | Unknown VM snapshot remove error |
164 | VMWARE | Unknown error in VMware cleanup |
171 | VMWARE | Snapshot creation failed |
172 | VMWARE | Unknown error in snapshot creation |
173 | VMWARE | Snapshot deletion failed |
174 | VMWARE | Unknown error in snapshot removal |
175 | VMWARE | Failed to cleanup a snapshot |
176 | VMWARE | No VMs discovered from the configuration file, continuing InfiniBox snapshots without OS consistency |
Comments