VMware ESX SDK SnapShot Perl Script Part 3
Virtualization - VMware
Written by Allen Sanabria   
Tuesday, 31 March 2009 14:51

This is the 3rd and I think final revision of this script. I added the --list function, which before had to be combined with the --vm_name function. The main reason for creating this script was so that there can be an easy way to manage snapshots, especially automating the deletion, creation, reverting, and listing of snapshots. If you find this script or any of my scripts useful, please let me know.

 

perl vm_snapshot.pl --list
Platinum
name: test1
description:
state: poweredOff
vm type: VirtualMachine
time created: 2009-03-17T10:26:34.605171-04:00

Gold
name: test2
description:
state: poweredOff
vm type: VirtualMachine
time created: 2009-03-17T13:32:05Z

Silver
name: test3
description:
state: poweredOff
vm type: VirtualMachine
time created: 2009-03-17T13:32:22Z 

Remember!!! That in order to use this script you will need the Perl VI SDK installed on your linux box as well as $home/.visdkrc setup correctly

Here is an example .visdkrc...

VI_SERVER = Virtual Console Server
VI_USERNAME = login
VI_PASSWORD = passwd
VI_PROTOCOL = https
VI_PORTNUMBER = 443


You can still run this script with the Virtual Machine Name as well...

perl vm_snapshot.pl --list --vm_name "Platinum"
name: test1
description: test snap
state: poweredOff
vm type: VirtualMachine
time created: 2009-03-18T16:21:45.447627-04:00
 

You can also remove snapshots too...

perl vm_snapshot.pl --vm_name "Platinum" --delete --sn_name "test1"
Snapshot 'test1' removed for VM Development Server of Platinum

You can also revert and do a powerOn as well.

perl vm_snapshot.pl --vm_name "Platinum" --revert --sn_name "new_snap" --vm_on

Operation :: Revert To Snapshot new_snap For Virtual Machine Platinum completed

Virtual machine 'Platinum' has been started

Also you can create snapshots as well...

perl vm_snapshot.pl --vm_name "Platinum" --create --descr "nice" --sn_name "new_snap"
Snapshot 'new_snap' completed for VM The Platinum

You can download the script here



Add this page to your favorite Social Bookmarking websites
Reddit! Del.icio.us! Mixx! Free and Open Source Software News Google! Live! Facebook! StumbleUpon! Yahoo! Free Joomla PHP extensions, software, information and tutorials.
Comments
Search RSS
Only registered users can write comments!

3.22 Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved."

Last Updated on Tuesday, 31 March 2009 19:05