5. Storage Design Examples : 5.1 vApp Snapshot : 5.1.3 Example
   
5.1.3 Example
The following figure shows the basic structure of the two-tier vApp. It contains a Web virtual machine and a database virtual machine, with both running.
Figure 26. Two-Tier vApp
 
These virtual machines appear in the vSphere Client as shown in Figure 27. The vSphere Client is used only for illustration. The vCloud Director user interface is used to create, revert, and delete the snapshots.
Figure 27. Two-Tier vApp as Seen in vCenter
You can take a snapshot of the entire vApp while the vApp is running. Right-click the vApp and select Create Snapshot as shown in Figure 28. All virtual machines in the vApp have snapshots.
Figure 28. The Process of Creating a vApp Snapshot
 
While the vApp is running, vCloud Director can take a snapshot of its memory or quiesce its file system. Quiescing the file system requires VMware Tools in both virtual machines. This is shown in Figure 29.
Figure 29. Snapshot Options
 
The snapshots for the two virtual machines contained in the vApp are created in vSphere. In Figure 30, the database virtual machine snapshot has just been taken and the Web virtual machine snapshot is about to complete.
Figure 30. Snapshot Creation
 
The virtual machines are in snapshot mode and the consumer can start making changes to those virtual machines. If the consumer determines during testing that an additional snapshot should be taken for the Web virtual machine, the consumer can select the single virtual machine in vCloud Director, right-click, and again select Create Snapshot. This is illustrated in Figure 31.
Note: vCloud Director supports only a single snapshot for each virtual machine. If you create a snapshot for a virtual machine that already has an existing snapshot it deletes the existing snapshot and creates a new one. This has the effect of committing the changes from the first snapshot to the guest OS image or VMDK.
Figure 31. Creation of an Additional Snapshot for the Web Virtual Machine
After the tests are completed and the consumer determines that the Web virtual machine is working, the snapshots can be deleted. This process saves and consolidates all of the post-snapshot changes to the guest OS in the VMDK. In vCloud Director, as in vSphere, deleting a snapshot commits the changes and removes the virtual machine from snapshot mode.
Conversely, the consumer might determine that the database virtual machine must be rolled back to its original state at the time the snapshot was created. To roll back the snapshot, the consumer right-clicks the database virtual machine and selects Revert to Snapshot, as shown in Figure 32. Rolling back removes the virtual machine from snapshot mode, bringing the virtual machine back to the point in time of the snapshot, and starts a new snapshot file. To completely leave snapshot mode you must delete the snapshot.
Figure 32. The Consumer Rolls Back the DB Virtual Machine
 
To roll back or revert a running virtual machine, vSphere must power it off, remove the snapshot, and restart the virtual machine from the original VMDK file, but with a new snapshot disk to which changes are logged. This is shown in Figure 33.
Figure 33. vSphere Tasks When Reverting a Snapshot
The consumer can issue the snapshot command at either the vApp level or the virtual machine level from within vCloud Director.
In this example, the consumer has taken a vApp level snapshot and then manipulated the individual virtual machines because each virtual machine required different operations. If a vApp level snapshot command is issued, the same command is propagated to all the virtual machines that comprise the vApp.