Virtualization is the creation of a virtual (rather than actual) version of something, such as an operating system, a server, a storage device or network resources.
2. Basics first ?
Virtualization is the creation of a virtual (rather than actual)
version of something, such as an operating system, a server, a
storage device or network resources.
When the VM is temporarily stopped, snapshotted, moved, and
then resumed on the new host, this is known as Migration.
A Snapshot is the state of a virtual machine, and generally its
storage devices, at an exact point in time. A snapshot enables
the virtual machine's state at the time of the snapshot to be
restored later, effectively undoing any changes that occurred
afterwards. This capability is useful as a backup technique, for
example, prior to performing a risky operation.
3. VM Migration
VM Migration refers to the process of moving a
running virtual machine or application between
different physical machines without disconnecting
the client or application. Memory, storage, and
network connectivity of the virtual machine are
transferred from the original guest machine to the
destination.
In simpler words, moving a virtual machine from one
host to another.
4. Why is it needed ?
Load Balancing.
Move VMs to a less busy host.
Make Use Of Newly Added Capacity.
Maintenance.
Move VMs off a host before It is shut down.
Recovery From Host Failure.
Restart VM on a different host.
5. VM Migration Types
COLD Migration
Shut down VM on Host 1, restart on Host 2
WARM Migration
Suspend VM on host 1, copy across RAM and CPU
registers, continue on host 2 (some seconds later)
LIVE Migration
Copy across RAM while VM continues to run – Mark
"dirty" (changed) RAM pages & re-copy.
6. VM Memory Migration Techniques
Two techniques for moving the virtual machine's memory state from
the source to the destination are pre-copy memory migration and
post-copy memory migration.
The memory migration in general can be classified into three phases:
1. Push phase
The source VM continues running while certain pages are pushed across
the network to the new destination. To ensure consistency, the pages
modified during the transmission process must be re-sent.
2. Stop-and-copy phase
The source VM is stopped, pages are copied across to the destination VM,
and then the new VM is started.
3. Pull phase
The new VM starts its execution, and if it accesses a page that has not yet
been copied, this page is faulted in, across the network from the source
VM.
7. Pre-copy Memory Migration
Warm-up phase
In pre-copy memory migration, the Hypervisor typically copies all the
memory pages from source to destination while the VM is still running on
the source. If some memory pages change (become 'dirty') during this
process, they will be re-copied
Stop-and-copy phase
After the warm-up phase, the VM will be stopped on the original host,
the remaining dirty pages will be copied to the destination, and the VM
will be resumed on the destination host. The time between stopping the
VM on the original host and resuming it on destination is called "down-
time", and ranges from a few milliseconds to seconds according to the
size of memory and applications running on the VM.
8. How it Happens ?
The approach behind pre-copy is to transfer the
memory to the destination over a series of iterations.
9. Post-copy Memory Migration
Post-copy VM migration is initiated by suspending the VM at the source.
With the VM suspended, a minimal subset of the execution state of the
VM (CPU state, registers and, optionally, non- pageable memory) is
transferred to the target. The VM is then resumed at the target.
Concurrently, the source actively pushes the remaining memory pages of
the VM to the target - an activity known as pre-paging. At the target, if
the VM tries to access a page that has not yet been transferred, it
generates a page-fault.
These faults, known as network faults, are trapped at the target and
redirected to the source, which responds with the faulted page.
Post-copy sends each page exactly once over the network. In contrast,
pre-copy can transfer the same page multiple times if the page is dirtied
repeatedly at the source during migration. On the other hand, pre-copy
retains an up-to-date state of the VM at the source during migration,
whereas with post-copy, the VM's state is distributed over both source and
destination. If the destination fails during migration, pre-copy can
recover the VM, whereas post-copy cannot.
10. How it happens ?
In contrary to pre-copy, post-copy transfers the VCPU and
devices state on the destination in the first step and starts
the execution on destination in the second.
11. Hypervisors
A Hypervisor or virtual machine monitor (VMM) is a piece of
computer software, firmware or hardware that creates and
runs virtual machines. A computer on which a hypervisor is
running one or more virtual machines is defined as a host
machine. Each virtual machine is called a guest machine.
In virtualization technology, hypervisor is a software program
that manages multiple operating systems (or multiple
instances of the same operating system) on a single computer
system. The hypervisor manages the
system's processor, memory, and other resources to allocate
what each operating system requires. Hypervisors are designed
for a particular processor architecture and may also be
called virtualization managers.
12. Hypervisor Types
"Formal Requirements for Virtualizable Third
Generation Architectures" Gerald J.
Popek and Robert P. Goldberg classified two types
of hypervisor.
Type – 1 : Native or Bare – Metal Hypervisors.
Type – 2 : Hosted Hypervisors.
13. Type – 1 Hypervisors
These hypervisors run directly on the host's
hardware to control the hardware and to manage
guest operating systems. For this reason, they are
sometimes called bare metal hypervisors. A guest
operating system runs as a process on the host.
The Type 1 hypervisor is often referred to as a
hardware virtualization engine.
Examples include VMware ESXi Server, Microsoft
Hyper-V, Citrix/Xen Server.
14. Type – 1 : In brief
It works directly on the hardware of the host and can monitor
operating systems that run above the hypervisor.
It is completely independent from the Operating System.
The hypervisor is small as its main task is sharing and
managing hardware resources between different operating
systems.
A major advantage is that any problems in one virtual
machine or guest operating system do not affect the other
guest operating systems running on the hypervisor.
15. Type – 2 Hypervisors
These hypervisors run on a conventional operating
system just as other computer programs do. Type-2
hypervisors abstract guest operating systems from
the host operating system.
Type 2 hypervisors support guest virtual machines
by coordinating calls for CPU, memory, disk,
network and other resources through the physical
host's operating system. This makes it easy for an
end user to run a virtual machine on a personal
computing device.
Examples of this type of hypervisor include VMware
Fusion, Oracle VM, Parallels and VMware
Workstation.
16. Type – 2 : In brief
In this case, the hypervisor is installed on an operating
system and then supports other operating systems above it.
It is completely dependent on host Operating System for its
operations
While having a base operating system allows better
specification of policies, any problems in the base operating
system affects the entire system as well even if the
hypervisor running above the base OS is secure.