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. Both virtual machines are running.
Figure 27. Two-Tier vApp
These virtual machines display in the vSphere Client as shown in the following figure. The vSphere Client is used here only for illustration—it is the vCloud Director UI that is used to create, revert, and delete the snapshots.
Figure 28. Two-Tier vApp as Seen in vCenter
 
To take a snapshot of the entire vApp while the vApp is running
1. In the vCloud Director UI, click the My Cloud tab, then right-click the vApp and select Create Snapshot. All virtual machines in the vApp have snapshots.
 
2. Select the snapshot options you want and click OK. While the vApp is running, vCloud Director can take a snapshot of its memory and/or quiesce its file system. Quiescing the file system requires that both virtual machines have VMware Tools installed.
 
3. In the vSphere Client, see the Recent Tasks section to monitor progress. The snapshots for the two virtual machines contained in the vApp are created in vSphere. In the following screenshot, the database virtual machine snapshot has just been taken and the Web virtual machine snapshot is about to complete.
 
4. 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.
 
NotevCloud 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.

5. 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.
Alternatively, 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. 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.
 
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. The following screenshot shows the tasks performed in vSphere 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 took a vApp level snapshot and then updated 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.