Friday, July 15, 2016

Snapshots and Clones of Virtual machines in VMWare 
Snapshots are stored as changes from the parent state. To create a fully independent copy of a virtual machine from a snapshot, we make a clone. Both of them don’t require any downtime of the original Virtual machine.  A lease on the other hand cannot be taken without powering off the virtual machine. A lease is necessary to export the virtual machine. Exporting a virtual machine disk means it can be used elsewhere and not just at the origin datacenter. While the lease is held, the operations that alter the state of the virtual machines covered by the lease are blocked. Examples of blocked operations are PowerOn, Destroy, Migrate, etc. 
A snapshot preserves the state and data of a virtual machine at a specific point of time. The state refers to such things as the virtual machine’s powered on state.  The data refers to all the files that make up the virtual machine. Changes from the original virtual machine disk are saved as child disks. Hence the snapshots form a chain of disks.  When a snapshot is created, the file system can be quiesced. Queiscing is a process of bringing on the on-disk data of a physical or virtual computer into a state suitable for backups. This process might include such operations as flushing dirty buffers from the operating system’s in-memory cache to disk, or other higher level application specific tasks. Any process that is running and can alter the state of a virtual machine particularly those that modify the information stored on a disk during a backup, to guarantee a consistent and usable backup. Quiescing is not necessary for memory snapshots and is primarily used for backups.  
A collection of <vm>-<number>.vmdk and <vm>-<number>-delta.vmdk comprise the snapshot.  This is taken for each virtual disk connected to the virtual machine at the time of the snapshot. These files are referred to as child disks, redo logs or delta links. These child disks can later be considered parent disks for future child disks. From the original parent disk, each child constitutes a redo log pointing back from the present state of the virtual disk, one step at a time, to the original. The snapshots may also consist of <vm>.vmsd file which is a database of the virtual machine’s snapshot information and the primary source of the information for the Snapshot Manager. Snapshots may also include a <vm>Snapshot<number>.vmsn file which is a file that mentions the current configuration and optionally the active state of the virtual machine. With non memory snapshots, you can also revert to a turned off virtual machine state. 
The common operations allowed on snapshots are Create Snapshot, Remove snapshot, Remove All snapshots, RevertToSnapshot and Consolidate. For each operation, if the memory option is specified, the destination is memory rather than disk.  Similarly, if the quiesce operation is specified, the guest operating system is notified to do so. The child disk which is created with a snapshot is a sparse disk. Sparse disks employ the copy on write (COW) mechanism, in which the virtual disk contains no data in places, until copied there by a write. This optimization saves storage space. Sparse disks are measured in grains which is a block of sectors containing virtual disk data.
#codingexercise
Give a function rev(int i) which reverses the segment of array ar[] from 0-i,  
List<int> rev(List<int> ar, int i)
{
var sub = ar.GetRange(0,i);
sub.reverse();
return sub.Union(ar.GetRange(i,ar.Count()-i)).ToList();
}
Give a function reverselatter(int i) which reverses the segment of array ar[] from i to last
List<int> rev(List<int> ar, int i)
{
var sub = ar.GetRange(i,ar.Count()-i);
sub.reverse();
return sub.GetRange(0,i).Union(sub).ToList();

}

No comments:

Post a Comment