This application (licensed by the NetApp ToolChest License, found here) is intended to help users clean-up VMware snapshots left over after being taken by different backup applications. A Windows executable and Perl script for UNIX environments are included. The -snapname option allows users to specify a string to look for with VMware snapshots, and if discovered on the selected datastores, will delete those snapshots. One common use could be to specify -snapname smvi_ to cleanup any leftover VMware-based snapshots created by SMVI.
Please use in a test environment to confirm it works for your environment before moving to production. To test, simply create a VMware snapshot of a specific name for a VM, then use CVMS against the datastore and/or VM to find and delete the VMware snapshot.
Command output is below:
C:\>cvms -vcuser administrator -vcpasswd passwd -vcip 10.2.1.2 -snapname bar -ds test_ds -verbose
LOG REPORT FOR CVMS
-----------------------------------------------------
CVMS Version: 1.0
Log Filename: \NetApp\CVMS\Report\CVMS_20100131_143350.log
Start Time: Sun Jan 31 14:33:50 2010
Datastore(s) selected: test_ds
Command line arguments successful.
Initializing connectivity to Virtual Center and storage appliances.
Converting Virtual Center hostname to IP address ...
Attempting to ping Virtual Center 10.2.1.2 ...
Ping of Virtual Center 10.2.1.2 successful.
Creating new Virtual Center instance for 10.2.1.2 ...
Logging into Virtual Center server 10.2.1.2 ...
Virtual Center login successful.
Collecting VMware and storage appliance configuration data.
Collecting datacenter information ...
Found 2 Datacenter(s).
Collecting host system information ...
Host system information collected.
Looking on host system esx2.internal.net for datastore test_ds ...
Requested Datastore (test_ds) is available.
Saving virtual machine information for vm2.
Saving virtual machine information for vm1.
Cleaning up snapshots for all VMs listed ...
Checking snapshot capability of VM vm1 ...
Removing all snapshots with string 'bar' from VM vm1 ...
No VM snapshots found.
Checking snapshot capability of VM vm2 ...
Removing all snapshots with string 'bar' from VM vm2 ...
Removing VM snapshot 'bar2' ...
Removal of VM snapshot for vm2 successful.
Command completed successfully.
Backup End Time: Sun Jan 31 14:34:02 2010
Exiting with return code: 0
C:\>cvms -help
Usage: cvms <arguments>
Required arguments:
-vcip <str> IP address/Hostname of Virtual Center to connect to
-vcuser <str> Username on ESX Virtual Center
-vcpasswd <str> Password of Virtual Center username (-vcuser)
-snapname <str> Snapshot prefix name to search for [default: CVMS]
-cluster Use a specific cluster (only needed if Datacenter has multiple clusters!)
For datastore-level clean-up, use:
-ds <ds>[,<ds>,...] Name of Datastore(s) to clean up
-allds Select all Datastore(s) to clean up
Optional arguments:
-vccryptpasswd <str> Password (generated by -cryptpasswd) of Virtual Center username (-vcuser)
-help Print out the usage information
-version Print the version number of this application
-verbose Print out information as it is running
-debug Print out script-specific information
-noping Do not ping the VC -- just try and login
-noreport Do not generate a report at the end of the script run
-reportdir Directory to save the report to [default: /NetApp/CVMS/Report]
-vm <str> Name of Virtual Machine to clean
-vmset <vm>,<vm>,... Set of Virtual Machines to clean (separated by commas)
-novmset <vm>,<vm>,... Set of Virtual Machines to exclude from the list
-logdest <str> Log output destination (file, eventlog or both)
-loglevel <str> Log output at <str> and above threshold (info, warning, error)
-cryptpasswd Generate an encrypted password to use with other crypt password commands
-config <filename> Read all runtime values from <filename>
(additional command line values override -config)