I have just replicated some virtual machines (with snapshots) created in 2 CPU ESX 3.5 host to QuadCore ESX 3.5 host. Now on the new host when I try to revert to any snapshot from VC I get an error as below
Error encountered while trying to restore CPU state from file.
Now from community I found a workaround for this issue
1. Select the virtual machine from the inventory and take a snapshot (fresh migrated snapshot)
2. Now revert to any previous snapshot, you will receive the error and machine will be in suspended state
3. Edit the VMX file for that virtual machine and remove the line “checkpoint.vmState” and save the file.
4. Now power on the virtual machine, take a new snapshot at that state and delete the older snapshot at that state.
Since I have around 50 virtual machines with each having 7-8 snapshots, its a huge manual task. So just wanted to know if there are commands in ESX through which I can
1. display all the existing snapshots for a vm
2. revert to a particular snapshot from the list.
With snaphunter I actually could not find a way in which I could revert to a previous snapshot. To be specific I have a virtual machine "CentOS_5.2" with snapshot names
1. FreshVMNoTools11Dec
2. Jbossworking13Dec
3. MigratedFresh23Dec
Now I want to be able to run a script to execute this sequence in a loop like -
Revert to FreshVMNoTools11Dec (Due to error in snapshot it gets suspended)
Change VMX
Power on
Save this as FreshVMNoTools11Dec_working
Delete older snapshot FreshVMNoTools11Dec
Revert to Jbossworking13Dec (Again in suspended mode now)
Power on
Change VMX
Save this as Jbossworking13Dec_working
and so on...
Using RCLI as an appliance and with the snapshotmanager.pl script I am able to list,create and revert to particular snapshots.
./snapshotmanager.pl --server 10.99.130.22 --username root --operation create --snapshotname "Apache Upgraded 2" --vmname CentOS_52 --powerstatus poweredOn
./snapshotmanager.pl --server 10.99.13.22 --username root --operation list --vmname CentOS_52
Enter password:
Snapshots for Virtual Machine CentOS_52 under host esx22.abc.com
Name Date State Quiesced
Apache Installed 2009-01-04T22:19 poweredOff N
Apache Upgraded 2009-01-04T22:19 poweredOff N
Apache Upgraded 2 2009-01-04T22:24 poweredOff N
Now how do I preserve the power state of the virtual machine when I take a new snapshot. I see no options for "quiesce" or "memory" with the script???
Take a look at this flag:
--powerstatus (variable powerstatus)
State of the virtual machine: poweredOff, poweredOn
You also have the option of using "vmsnapshot.pl", both these exists on VMware VIMA or is part of the RCLI
=========================================================================
--William
i tried using the powerstatus switch with both the scipts, but i am not able to capture the power state.
./vmsnapshot.pl --server 10.99.13.22 --username root --password vmware1 -sname "Snapshot 01" --powerstatus poweredOn --vmname CentOS_52
Snapshot 'Snapshot 01' completed for VM CentOS_52 under host esx22.abc.com
./snapshotmanager.pl --server 10.99.13.22 --username root --operation list --vmname CentOS_52
Enter password:
Snapshots for Virtual Machine CentOS_52 under host esx22.abc.com
Name Date State Quiesced
Snap00 2009-01-05T03:02 poweredOff N
You're right, I've actually tried both "snapshotmanager.pl" and "vmsnapshot.pl" and neither takes a snapshot correctly when passing in the powerOn state, possibly a bug.
$ ./vmsnapshot.pl --server himalaya.primp-industries.com --powerstatus poweredOn --sname TEST-SNAP --vmname WILLIAM-LC-18
Snapshot 'TEST-SNAP' completed for VM WILLIAM-LC-18 under host himalaya.primp-industries.com
$ ./snapshotmanager.pl --operation create --powerstatus poweredOn --snapshotname TEST-SNAP --target himalaya.primp-industries.com --vmname WILLIAM-LC-18 --server 172.30.0.60 --username primp
Enter password:
Operation :: Snapshot TEST-SNAP for virtual machine WILLIAM-LC-18 created sucessfully under host himalaya.primp-industries.com
May want to open an SR with VMware regarding this command, doesn't seem to work as expected with the --powerstatus flag
=========================================================================
--William
The powerstatus flag is actually something different..The issue is resolved now. Follow the link for resolution.