Virtualization is the first step towards building cloud architecture. It involves transformation of classical data center to a virtualized data center. Virtualization is done at compute, network and storage stage.
Compute Virtualization
It is a technique of masking or abstracting the physical compute hardware and enabling multiple operating systems to run concurrently on a single or clustered physical machines.
Virtualization layer resides between VMs and hardware, and is called as hypervisor. After virtualization, you can run multiple OS per machine concurrently. It makes OS and apps hardware independent. It also helps avoid conflicts between different VMs, essentially isolating each of them. Resource utilization is greatly enhanced. Virtualization offers flexible infrastructure at low cost.
Hypervisor is a software that allows multiple operating systems to run concurrently on physical machine and to interact directly with physical hardware. It has 2 components - kernel and VMM (Virtual Machine Monitor). Kernel is responsible for resourec scheduling, I/O, overall management etc. VMM is responsible for actually executing commands on CPU. Each VM has its own VMM.
Types of Hypervisors
Bare metal Hypervisor
It is essentially an OS. It installs and runs on the x86 hardware (requires certified hardware).
Hosted Hyervisor
It installs and runs as an application. It relies on OS running on physical machine for device support and physical resource management.
Benefits of Compute Virtualization
Server consolidation - resource requirement of actual physical machine is greatly reduced. Isolation - Each VM is independent of each other. Encapsulation - package set which can be encapsulated and transferred to another physical machine. Hardware independence. Reduced cost.
There are 4 levels of privilege - denoted as Ring 0, Ring 1 , Ring 2 and Ring 3. Ring 3 is where user applications operate, ring 0 is where OS resides, closest to hardware.
Full Virtualization
In full virtualization, Ring 0 is hypervisor and Ring 1 is guest OS. Guest OS is unaware of being virtualized. VMM runs in privileged Ring 0. VMM decouples the guest OS from underlying hardware.
Binary Translation - Translating execution commands of guest OS by hypervisor for the hardware. In full virtualization, there can be many guest operating systems, oblivious to the type of existing hardware. Hypervisor bridges the gap by binary translation, enabling the OS to execute its commands on the hardware.
Para Virtualization
Guest OS knows that it is virtualized. It runs in Ring 0. Hypervisor is between Ring 0 and x86 hardware. For paravirtualization, modifiable guest OS kernel is used such as Linux and Open BSD. Unmodifiable OS such as MS Windows is not supported.
Hardware Assisted Virtualization
Achieved by using hypervisor-aware CPU to handle privilege instructions. Reduces virtualization overhead caused due to full and para virtualization. CPU and memory virtualization is provided in hardware. Enabled by AMD-V support and Intel VT technology in x86 processor architecture. Ring ) has guest OS, and VMM is between guest OS and physical machine x86 hardware.
Virtual Machine
User view - Runs on OS and apps just like a physical machine.
Hypervisor's perspective - discrete set of files such as configuration file, virtual disk files, virtual BIOS fle, virtual swap file, log file etc.
Virtual BIOS file - stores state of VM's BIOS.
Virtual swap file - VM's paging file which backs up VM RAM contents, exists only when VM is running.
Virtual Disk file - stores content of VM's disk drives.
Log file - keeps log of VM activity, useful for troubleshooting.
Configuration file - stores configuration information of VM. Includes information such as number of CPUs, memory, number and types of network adapter and disk types.
File System to Manage VM files
VMFS
Cluster file system that allows multiple physical machine to perform read/write on same storage device concurrently. Deployed on FC and iSCSI storage apart from local storage.
NFS
Enables storing VM files on remote file server (NAS device). NFS client is built into hypervisor.