Server Virtualization Concepts
Kingston Smiler. S (kingstonsmiler@gmail.com)
About Me
Author
•“OpenFlow CookBook”, which is one
of the recognized study material by
ONF (Open Networking Foundation)
•Learning CoreOS
•1 RFC & 2 IETF Drafts in MPLS and
TRILL WG
•Frequent Presenter in various
networking Forums
•Trainer of SDN, NFV and Network
Virtualization Concepts
Experience
•14+ years of Industry Experience
•6+ years of experience in SDN, NFV
and OpenFlow
•Working as a pre-sales consultant
and product manager
•Having Work Experience in all the
three commercial L2, L3 networking
stack (IPInfusion ZebOS, Aricent ISS,
MetaSwitch L2,L3 and MPLS stack)
Levels of Server Virtualization
Types of Server Virtualization
Components of Server Virtualization
HyperVisors
Virtual Machine
Containers
Dockers
Server Virtualization
Wikipedia Definition
Partitioning of physical server into
number of small virtual servers
Uses Virtualization Software and
hardware virtualization techniques
In most cases the servers are not
utilized fully which results in
inefficient usage
Why Server Virtualization
Less Resource Utilization
High Cost
Power Consumption
Server Downtime
High Infrastructure
History of Server Virtualization
IBM Mainframes
with Virtualization
Evolution of
Personal
Computers
(1990s)
Back to
virtualization to
reduce Capex and
Opex
(2000s)
1970s 1990s 2000s
IBM Mainframes
IBM CP-67 (Mid
1960s)
First Virtualized IBM Mainframe
Server
Split the computer into multiple
virtual machines
Different “tasks” can be run separately
and independently on the same
mainframe
If one virtual machine or “task” has a
problem, other virtual machines are
unaffected
Personal Computer Evolution
• Introduction of Intel/AMD servers (x86 architecture)
• Each PC/server runs its own OS (Windows / Unix) and runs application.
• Best approach for personal computers.
• For server and IT infrastructure brings overhead while going for massive
scale.
• Typically in IT and infrastructure deployment one server runs one
application (Email Server, Application Server, DB Server etc)
File
Server
Web
Server
File
Server
Web
Server
File
Server
Domain
Server
App
Server
DNS
Server
Each Server Running
1 Application
Server Virtualization
Physical Server vs Virtual Server
Components of Server Virtualization
Virtual Machine
Software Implementation of a
machine that executes program
like a physical machine.
Host Operating System
Operating System actually
running in the server / hardware
Guest Operating System
The Operating System running
in the simulated virtual machine
HyperVisor or VMM
The Operating System running in the
simulated virtual machine
Host Operating System
Hardware -- “real machine”
Virtual
Machine
Guest Operating
System
APP APP
Virtual
Machine
Guest Operating
System
APP APP
Hypervisor / VMM
Virtual Machine
System Virtual Machine
Full Virtualization VMs run
directly on the server
infrastructure without any
general purpose OS
Hardware -- “real machine”
Virtual Machine Monitor (VMM)
Simulated
Machine
Operating
System
APP APP
Simulated
Machine
Operating
System
APP APP
Hardware -- “real machine”
Host Operating System
Simulated
Machine
Operating
System
APP APP
Simulated
Machine
Operating
System
APP APP
Process Virtual Machine?
Needs host operating system
Virtual Machine running as a
process in the host OS
HyperVisor
Hypervisor
Hypervisor is a variant of supervisor
and is the “Supervisor of Supervisor”
Piece of computer software, firmware
or hardware that creates and runs VM
Presents the guest operating system a
virtual operating platform and
manages the execution of guest OS
Multiple instances of a variety of
operating systems may share the
virtualized hardware resources
Type 1 Hypervisors
• Also known as bare-metal implementation
• They sit directly on the top of hardware, without needing any operating
system.
• Since they can directly communicate with hardware resources, they are
much faster than type 2 hypervisor
Pro’s
• Single virtual machine crash does not
affect rest of guest system.
• More Secure than type2.
• Generate less overhead and fast.
Example
Vmware Esx, Microsoft Hyper-V
Type 2 Hypervisors
• Type 2 hypervisor resides on top of the operating system.
• They cannot directly communicate with the hardware, they are less
efficient than the type 1
Pro’s
• Install is easier.
• OS takes care of all the hardware, that’s
why can support wide range of
hardware.
Con’s
• More points of failure, anything that
affects the stability of base os can also
affect the guest os.
Examples
KVM, VirtualBox
Server Virtualization Components
Server
Virtualization
CPU
Virtualization
Memory
Virtualization
I/O Device
Virtualization
CPU Virtualization
CPU Virtualization
What is CPU Virtualization?
• Single CPU acting as if there are more than 1 CPU in the
system.
• Most instructions are executed directly on the physical CPU
• The Hypervisor / VMM safely performs privileged instructions
X86 Architecture Privileges
• Four Levels of Privileges as Ring
0, 1, 2, 3 for both kernel space
(OS) and user space
applications
• These privileges are meant for
accessing the hardware
resources by the OS and user
space applications
• User Apps run in Ring 3 and OS
runs in Ring 0
• The AMD-V and Intel-VT CPUs
use a new privilege level called
Ring -1 for the VMM
Server Virtualization Components
CPU
Virtualization
Full
Virtualization
Bare Metal /
Type1
Hypervisor
Type 2
Hypervisor
Para
Virtualization
Type 2
Hypervisor
Hardware
Assisted
Virtualization
Bare Metal /
Type1
Hypervisor
Type 2
Hypervisor
Full Virtualization
User Apps
Guest OS
VMM
System Hardware
Ring 3
Ring 2
Ring 1
Ring 0
Full Virtualization
Requires no hardware assist or OS
assist for virtualization support
Guest OS is not aware of whether it is
running in VM or physical server.
The Guest OS runs in Ring 1 privilege
Hypervisor runs in Ring 0 privilege
Bare Metal Execution Methodology
• Guest user apps can’t tamper
with the guest OS due to ring
protections. However user level
code can be directly executed
on the processor for high
performance virtualization.
• Guest user apps and guest OS
can’t tamper with VMM due to
ring protections
• When the guest OS executes a
privileged instruction, it will
trap into the VMM
• When a guest app generates a
system call or exception, the
app will trap into the VMM
• VMM’s trap handler uses a
policy to decide what to do
(e.g., emulate the instruction)
User Apps
Guest OS
VMM
System Hardware
Ring 3
Ring 2
Ring 1
Ring 0
Direct Execution of
virtualizable instructions
Binary Translation of non-
virtualizable instructions
Bare Metal
Full Virtualization – Execution Methodology
• Guest user apps can’t tamper
with the guest OS due to ring
protections. However user level
code can be directly executed
on the processor for high
performance virtualization.
• Guest user apps and guest OS
can’t tamper with VMM due to
ring protections
• Any instruction either privileged
or non-privileged will trap into
the VMM
• When a guest app generates a
system call or exception, the
app will trap into the VMM
• VMM’s trap handler uses a
policy to decide what to do
(e.g., emulate the instruction)
User Apps
Guest OS
Host OS
System Hardware
Ring 3
Ring 2
Ring 1
Ring 0
Binary Translation of All
Instructions
Host Based VM
Full Virtualization – Drawbacks
Low Performance, typically
in the range of 80 – 97%
Running I/O intensive
applications will be
challenging
Code cache increases the
performance with the cost
of memory
Para Virtualization
Para Virtualization
Requires communication between the
guest OS and hypervisor to improve
performance and efficiency
Guest OS should be aware of whether
it is running in VM or physical server
Guest OS kernel needs to be modified
to replace non virtualizable
instructions with hypercalls that
communicate directly with the
hypervisor
The Guest OS runs in Ring 1 privilege.
Hypervisor runs in Ring 0 privilege
User Apps
Guest OS
Instrumented
Host S
System Hardware
Ring 3
Ring 2
Ring 1
Ring 0
Virtualization Layer
Para Virtualization – Execution Methodology
• Guest user apps can’t tamper
with the guest OS due to ring
protections. However user level
code can be directly executed
on the processor for high
performance virtualization.
• Guest user apps and guest OS
can’t tamper with VMM due to
ring protections
• As the guest OS kernel is
modified to replace non
virtualizable instructions with
hypercalls that communicate
directly with the hypervisor
• it will issue a hypercall to the
VMM
• VMM’s trap handler uses a
policy to decide what to do
(e.g., execute the instruction)
Hardware Assisted Virtualization
Hardware Assisted
Virtualization
Techniques like Intel VT-X, AMD-V
facilitates the hardware assisted
virtualization
Privileged and sensitive calls are set to
automatically trap to the hypervisor
and handled by hardware
The Guest OS runs in Ring 1 privilege
Hypervisor runs in Ring 0 privilege
User Apps
Guest OS
System Hardware
Ring 3
Ring 2
Ring 1
Ring 0
VMMRing -1
Multithread Vs Multicore Vs CPU Virtualization
Memory Virtualization
What is Memory Virtualization?
• Abstracts the physical memory resources in a virtualized
server.
• Handles the physical memory, virtual memory of both guest
and host OS and maintains mapping between these entities.
I/O Virtualization
I/O
Virtualization
Emulated I/O
Para-
virtualized
I/O
Direct I/O
Emulated I/O
Guest VM
Guest OS
Host OS
(Linux)
KVM (kernel module)
QEMU
vCPU vCPU
User space
Kernel space
I/O
emulation
I/O operation
MMIO or PIO
Trap
Native drivers
Interrupt
• Software emulates real hardware device
• VMs run same driver for the emulated hardware device
• Trap  hypervisor  I/O emulator (e.g., QEMU)
• Every I/O operation generates trap and emulation
• Poor performance
Para-Virtualized I/O
• Split driver model
• Front-end driver in a guest VM
• Virtual driver to forward an I/O request to its back-end driver
• Back-end driver in a host OS
• Request a forwarded I/O to HW via native driver
Guest VM
Guest OS
Host OS
(Linux)
KVM (kernel module)
QEMU
vCPU vCPUUser space
Kernel space
VirtIO
Backend
I/O operation
Native drivers
VirtIO
Frontend
Shared descriptor ring:
Optimization by batching
I/O requests
 Reducing VMM
intervention cost
Direct I/O
Guest VM
Guest OS
Host OS
(Linux)
KVM (kernel module)
QEMU
vCPU vCPU
User space
Kernel space
I/O
emulation
I/O operation
MMIO or PIO
Native drivers
33/32
• Directly assign device to Guest
• High performance and low CPU utilization
KVM, QEMU, LibVirt
Agenda
Introduction
KVM, QEMU, LibVirt
KVM Virtualization
CPU Virtualization in KVM
Memory Virtualization in VM
Para Virtualized Drivers and Network Device Virtualization
Example QEMU, LibVirt commands
KVM (Kernel Virtual Machine)
By itself, KVM does not perform any emulation. It exposes
/dev/kvm interface for virtualization
KVM (Kernel VM)
Hardware Assisted Virtualization infra
for linux on X86
Requires hardware containing
virtualization extensions (Intel VT or
AMD-V)
Open Source Software under GPL
license
Two Components: Kernel Component
part of mainline linux for 2.6.20. User
Component (part of Qemu)
Why KVM
Hardware Based Virtualization
Native Support for any guest OS
Better Performance
Open Source & Flexible
Enhanced Security
KVM
QEMU (Quick Emulator)
QEMU (Quick
EMUlator)
Generic and open source machine
emulator and virtualizer
QEMU can run programs made for one
machine (for example: an ARM board)
on a different machine
Hosted hypervisor/VMM that
performs hardware virtualization
Work along with KVM for providing
Hardware Assisted Virtualization
Emulation Vs Virtualization
 Both can act as a hypervisor
 Virtualization
 Slice the underlying hardware into multiple disjoint virtual
devices
 The ISA of host and guest typically are same
 Guest operations can be directly dispatched to hardware
 Emulation
 Host and Guest may have different ISA
 Guest ISA is managed in software
 Guest operations needs translation
Usage of QEMU
QEMU
Emulation
System
Emulation
Device
Emulation
Virtualization
Standalone KVM
KVM vs QEMU
 Both are hypervisors
 Stand alone QEMU uses
paravirtualization where as
KVM provides infra for
hardware virtualization
 KVM virtualizes only CPU
and memory whereas Qemu
virtualizes all other devices
 When QEMU and KVM are
working together we get
hardware assisted
virtualization
KVM – Components
 KVM.ko
 Core KVM kernel module
 Implements vCPU and MMU
 Emulates few virtual devices in
kernel
 Provides ioctls for
communications
 Kvm-intel.ko / kvm-amd.ko
 Provide support for Intel VMX
and AMDs SVM support
 qemu-kvm
 Based on Qemu emulator
 Implements much of virtual
devices
 Provides user interface to KVM
44
KVM – High Level Overview
45
KVM – High Level Overview
libvirt
Libvirt
Provides Open Source API for
managing the various hypervisors
The management task includes
provision, creation, modification,
monitoring, control, migration etc
Various cloud orchestration platforms
uses libvirt libraries for instantiating
the VMs
Any libvirt client can remotely connect
to the libvirt running in a host server
Libvirt and QEMU
KVM Virtualization
KVM Concepts
 KVM converts the Linux Kernel to provide Hypervisor
support
 However there is no change introduced in the Linux
kernel to provide the Hypervisor support.
 Instead new kernel modules are introduced.
 Linux kernel already does all the process, memory and
i/o management for the process running in the host OS
 KVM introduces a new mode called guest mode along
with the User Mode and Kernel Mode
KVM Virtualization
CPU
• CPU Virtualization
Memory
• Memory Virtualization
IO Device
• I/O Virtualization
Intel Hardware Support For Virtualization
Intel Virtualization
Support
For processor virtualization, Intel
offers the VT-x . VT-X adds the guest
mode or ring –1 privilege for KVM
For memory virtualization, Intel offers
the EPT, which translates the virtual
address to the machine's physical
addresses to improve performance
For I/O virtualization, Intel
implements VT-d and VT-c
CPU Virtualization
 Every VM is a normal application
process in the host machine.
 The VM process in the host machine
can be scheduled to run on the CPU by
the host OS (like normal process).
 However KVM allows the quest code /
OS to run directly into the host CPU
(although the quest OS / code runs as
an application process) using the guest
mode execution
 For scheduling, memory management,
and other services KVM uses the linux
kernel however it helps the user
program to make use of the hardware
virtualization
CPU Modes
Mode Transitions
Virtual Memory Virtualization
 Virtual Memory Virtualization is similar to Virtual Memory concept.
 In virtual memory concept the operating system maintains mappings of
virtual memory to machine memory using page tables.
 However in VM environment, virtual memory virtualization involves
mapping between virtual memory of guest operating system to physical
memory of guest operating system along with the mapping of physical
memory of guest operating system to the machine memory
 The first mapping will be maintained by guest OS and the second
mapping will be maintained by the hypervisor
KVM Device Virtualization
Device
Virtualization
Emulation
Para
Virtualization
KVM Emulated Device Virtualization
 QEMU in user space provides the emulated device which is a software
implementation of the hardware.
 The guest VM is not aware that it is an emulated device and interacts
with the device
 When there is any I/O operation by the guest VM, the hypervisor
intercepts all I/O requests from the guest operating system and
emulates the operation of the real I/O hardware
KVM Para Device Virtualization / VirtIO
 Para-virtualized devices are software implementations of hardware
devices
 Para-virtualization requires that the guest operating system be modified
to communicate with the hypervisor.
 It’s a split driver implementation with front-end driver sitting in VM and
backend driver sitting in KVM
 The frontend and backend drivers communicate through a path that is
nothing but virtio
 The frontend driver manages the I/O requests of the guest OSes and the
backend driver is responsible for managing the real I/O devices and
multiplexing the I/O data of different VMs
KVM Para Device Virtualization / VirtIO
KVM Network Virtualization
Network
Virtualization
Network
Device
Virtualization
NIC
TUN/TAP
Interface
Bridge OVS
Network
backend
User
Networking
Private Virtual
Bridge
Public Bridge
Routing with
iptables
vNIC, TUN/TAP Interface
vNIC
A VNIC is a virtualized Network Interface Card, used by a Virtual Machine as
its network interface.
Linux Bridge
The Linux bridge code implements a subset of the ANSI/IEEE 802.1d standard.
Bridge can be created inside a system and can be used to provide
connectivity across the VM
TAP Interface
TAP simulates a link layer device and it operates with layer 2 packets like
Ethernet frames. Packets sent by an operating system via a TAP device are
delivered to a user-space program which attaches itself to the device
OVS
open-source implementation of a distributed virtual multilayer switch.
Provides a switching stack for hardware virtualization environments
KVM Network Virtualization
Network
backend
User
Networking
Private
Virtual Bridge
Public Bridge
Routing with
iptables
User Networking
When?
• When the virtual machine is required to access to the host, to internet or to
resources available on your local network.
• There is no need to access your guest from the network or from another guest.
Procedure
• Simply run guest without specifying network parameters, which by default will
create user-level (a.k.a slirp) networking
Private Virtual Bridge
When?
• When setting up a private network between 2 or more virtual machines.
• This network won't be seen from the other virtual machines nor from the real
network.
Procedure
• Create a bridge
• Create a tap device
• Attach the tap device to the bridge
Public Bridge
When?
• You want to assign IP
addresses to your virtual
machines and make them
accessible from your local
network
Procedure
• Create a bridge
• Create a tap device
• Attach the tap device to the
bridge
• Attach the host machine
interface to the bridge
Routing With IP Tables
When?
• You want to pass through
all the traffic from VM to
IP tables of Host
Procedure
• Create a bridge
• Create a tap device
• Attach the tap device to
the bridge
• Attach the host machine
interface to the bridge
VirtIO Example (Packet IO)
Handson
KVM Installation
 Check your CPU has hardware virtualization
support – either Intel VT-x or AMD-V.
 egrep -c ‘(svm|vmx)’ /proc/cpuinfo should return a value 1 or more
 Install KVM, lib-virt, linux bridge utilities and GUI
based virt-manager
 sudo apt-get install qemu-kvm libvirt-bin bridge-utils virt-manager
 Run the command to add your user account to
the libvirt group
 sudo adduser name libvirtd
Basic QEMU-KVM CLI Commands
 qemu-kvm options disk_img
 qemu-kvm -name “Telsites" -M pc-0.12 -m 512 -cpu kvm64 -smp 2
/images/telsitessp1.raw
 qemu-kvm -hda /images/selsitessp1.raw -net nic -net user
 qemu-kvm -hda /images/imagei1.raw -hdb /images/image2.raw -hdc 
/images/image3.raw -hdd /images/image4.raw
Thank you
kingstonsmiler@gmail.com

More Related Content

PDF
Lecture5 virtualization
PPT
VMware Presentation
PPTX
Network Virtualization
PPTX
CLOUD COMPUTING UNIT-1
PPSX
Virtualization basics
PPTX
Presentation on Cloud computing
PPTX
Azure Networking (1).pptx
Lecture5 virtualization
VMware Presentation
Network Virtualization
CLOUD COMPUTING UNIT-1
Virtualization basics
Presentation on Cloud computing
Azure Networking (1).pptx

What's hot (20)

PPTX
Server virtualization
PPT
Virtualization in cloud computing ppt
PPTX
Virtual Machine Concept
PDF
Hypervisors and Virtualization - VMware, Hyper-V, XenServer, and KVM
PPTX
Cloud Computing: Virtualization
PPT
Virtualization VMWare technology
PPTX
Virtualization
PPTX
Implementation levels of virtualization
PPTX
PPT
Virtualization.ppt
PPTX
What is Virtualization and its types & Techniques.What is hypervisor and its ...
PPT
Server virtualization by VMWare
PPTX
What is Virtualization
PPTX
Virtualization- Cloud Computing
PDF
Virtualization presentation
PPT
Virtualization
PPTX
Microsoft Hyper-V
PDF
Introduction to virtualization
PPTX
Virtualization 101: Everything You Need To Know To Get Started With VMware
Server virtualization
Virtualization in cloud computing ppt
Virtual Machine Concept
Hypervisors and Virtualization - VMware, Hyper-V, XenServer, and KVM
Cloud Computing: Virtualization
Virtualization VMWare technology
Virtualization
Implementation levels of virtualization
Virtualization.ppt
What is Virtualization and its types & Techniques.What is hypervisor and its ...
Server virtualization by VMWare
What is Virtualization
Virtualization- Cloud Computing
Virtualization presentation
Virtualization
Microsoft Hyper-V
Introduction to virtualization
Virtualization 101: Everything You Need To Know To Get Started With VMware
Ad

Viewers also liked (20)

PPTX
Graduating To Go - A Jumpstart into the Go Programming Language
PDF
[若渴計畫] Challenges and Solutions of Window Remote Shellcode
PDF
Scale Up with Lock-Free Algorithms @ JavaOne
PPTX
Walk through an enterprise Linux migration
PDF
Linux Security APIs and the Chromium Sandbox (SwedenCpp Meetup 2017)
PPTX
Docker Networking
PDF
numPYNQ @ NGCLE@e-Novia 15.11.2017
PPT
DevRomagna / Golang Intro
PPTX
In-Memory Computing Essentials for Architects and Engineers
PDF
OCCIware, an extensible, standard-based XaaS consumer platform to manage ever...
PDF
Advanced memory allocation
PPTX
What in the World is Going on at The Linux Foundation?
PPTX
Communication hardware
PDF
Go Execution Tracer
PPTX
SDN Architecture & Ecosystem
PDF
In-depth forensic analysis of Windows registry files
PPTX
OpenFlow
PDF
Deep dive into Coroutines on JVM @ KotlinConf 2017
PPTX
Introduction to OpenFlow, SDN and NFV
PPTX
Scaling and Transaction Futures
Graduating To Go - A Jumpstart into the Go Programming Language
[若渴計畫] Challenges and Solutions of Window Remote Shellcode
Scale Up with Lock-Free Algorithms @ JavaOne
Walk through an enterprise Linux migration
Linux Security APIs and the Chromium Sandbox (SwedenCpp Meetup 2017)
Docker Networking
numPYNQ @ NGCLE@e-Novia 15.11.2017
DevRomagna / Golang Intro
In-Memory Computing Essentials for Architects and Engineers
OCCIware, an extensible, standard-based XaaS consumer platform to manage ever...
Advanced memory allocation
What in the World is Going on at The Linux Foundation?
Communication hardware
Go Execution Tracer
SDN Architecture & Ecosystem
In-depth forensic analysis of Windows registry files
OpenFlow
Deep dive into Coroutines on JVM @ KotlinConf 2017
Introduction to OpenFlow, SDN and NFV
Scaling and Transaction Futures
Ad

Similar to Server virtualization (20)

PPT
CC_virtualization is in the cloud UNIT 3.1.ppt
PPTX
KIIT_Cloud_scaling and Virtualization.pptx
PPT
virtual machine.ppt
PPTX
Unit-3-Virtualization.pptx
PDF
Cloud Computing Virtualization and containers
PPT
Usenix Invited Talk
PPTX
cloud basics.
PPTX
VIRTULIZATION OF CPU, MEMORY AND IO DEVICES (1).pptx
PDF
Hypervisors
PPTX
CC unit 2.pptx for CC engineering students
PPT
Virtualization
PPTX
Operating system Virtualization_NEW.pptx
PPTX
CC CLOUD RESOURCE VIRTUALIZATION PPT TO REFER
PPTX
Vcp6.7 episode 1
PDF
Unit 3 Virtualization.pdf
PPTX
Chapter 3 - Cloud computing Virtualization-2
PPTX
Virtualization and how it leads to cloud
PPTX
cloudcomputingmodule2virtualizationbossss
PDF
Presentation cloud computing workshop - virtualization
PPTX
Virtualization Cloud computing technology
CC_virtualization is in the cloud UNIT 3.1.ppt
KIIT_Cloud_scaling and Virtualization.pptx
virtual machine.ppt
Unit-3-Virtualization.pptx
Cloud Computing Virtualization and containers
Usenix Invited Talk
cloud basics.
VIRTULIZATION OF CPU, MEMORY AND IO DEVICES (1).pptx
Hypervisors
CC unit 2.pptx for CC engineering students
Virtualization
Operating system Virtualization_NEW.pptx
CC CLOUD RESOURCE VIRTUALIZATION PPT TO REFER
Vcp6.7 episode 1
Unit 3 Virtualization.pdf
Chapter 3 - Cloud computing Virtualization-2
Virtualization and how it leads to cloud
cloudcomputingmodule2virtualizationbossss
Presentation cloud computing workshop - virtualization
Virtualization Cloud computing technology

Recently uploaded (20)

PPTX
WEEK 15.pptx WEEK 15.pptx WEEK 15.pptx WEEK 15.pptx
PPTX
北安普顿大学毕业证UoN成绩单GPA修改北安普顿大学i20学历认证文凭
PPTX
Male_Genital_SystMale_Genital_System_Anatomy_Illustrated.pptxem_Presentation....
PPTX
Introduction: Living in the IT ERA.pptx
PPTX
日本横滨国立大学毕业证书文凭定制YNU成绩单硕士文凭学历认证
PDF
Tailieuhoctiengnhat.com__(N5) 1021 từ vựng tổng hợp.pdf
PPTX
Going_to_Greece presentation Greek mythology
PDF
Technical SEO Explained: How To Make Your Website Search-Friendly
PPTX
Information and Network Security Introduction
PPTX
BIOS-and-VDU-The-Foundations-of-Computer-Startup-and-Display (1).pptx
PPTX
IT-Human Computer Interaction Report.pptx
PDF
ilide.info-huawei-odn-solution-introduction-pdf-pr_a17152ead66ea2617ffbd01e8c...
PDF
B2B Marketing mba class material for study
PPTX
IoT Lecture IoT Lecture IoT Lecture IoT Lecture
DOCX
MLS 113 Medical Parasitology (LECTURE).docx
PPTX
Basic_of_Computer_System.pptx class-8 com
PPTX
LiFi Technology an effective way of Communication
PPTX
REE IN CARBONATITE EEPOSIT AND INCLUDE CASE STUDY ON AMBADUNGAR
PDF
Lesson.-Reporting-and-Sharing-of-Findings.pdf
PPTX
Unguided-Transmission-Media-Wireless-Communication-Explained.pptx
WEEK 15.pptx WEEK 15.pptx WEEK 15.pptx WEEK 15.pptx
北安普顿大学毕业证UoN成绩单GPA修改北安普顿大学i20学历认证文凭
Male_Genital_SystMale_Genital_System_Anatomy_Illustrated.pptxem_Presentation....
Introduction: Living in the IT ERA.pptx
日本横滨国立大学毕业证书文凭定制YNU成绩单硕士文凭学历认证
Tailieuhoctiengnhat.com__(N5) 1021 từ vựng tổng hợp.pdf
Going_to_Greece presentation Greek mythology
Technical SEO Explained: How To Make Your Website Search-Friendly
Information and Network Security Introduction
BIOS-and-VDU-The-Foundations-of-Computer-Startup-and-Display (1).pptx
IT-Human Computer Interaction Report.pptx
ilide.info-huawei-odn-solution-introduction-pdf-pr_a17152ead66ea2617ffbd01e8c...
B2B Marketing mba class material for study
IoT Lecture IoT Lecture IoT Lecture IoT Lecture
MLS 113 Medical Parasitology (LECTURE).docx
Basic_of_Computer_System.pptx class-8 com
LiFi Technology an effective way of Communication
REE IN CARBONATITE EEPOSIT AND INCLUDE CASE STUDY ON AMBADUNGAR
Lesson.-Reporting-and-Sharing-of-Findings.pdf
Unguided-Transmission-Media-Wireless-Communication-Explained.pptx

Server virtualization

  • 2. About Me Author •“OpenFlow CookBook”, which is one of the recognized study material by ONF (Open Networking Foundation) •Learning CoreOS •1 RFC & 2 IETF Drafts in MPLS and TRILL WG •Frequent Presenter in various networking Forums •Trainer of SDN, NFV and Network Virtualization Concepts Experience •14+ years of Industry Experience •6+ years of experience in SDN, NFV and OpenFlow •Working as a pre-sales consultant and product manager •Having Work Experience in all the three commercial L2, L3 networking stack (IPInfusion ZebOS, Aricent ISS, MetaSwitch L2,L3 and MPLS stack)
  • 3. Levels of Server Virtualization Types of Server Virtualization Components of Server Virtualization HyperVisors Virtual Machine Containers Dockers
  • 4. Server Virtualization Wikipedia Definition Partitioning of physical server into number of small virtual servers Uses Virtualization Software and hardware virtualization techniques In most cases the servers are not utilized fully which results in inefficient usage
  • 5. Why Server Virtualization Less Resource Utilization High Cost Power Consumption Server Downtime High Infrastructure
  • 6. History of Server Virtualization IBM Mainframes with Virtualization Evolution of Personal Computers (1990s) Back to virtualization to reduce Capex and Opex (2000s) 1970s 1990s 2000s
  • 7. IBM Mainframes IBM CP-67 (Mid 1960s) First Virtualized IBM Mainframe Server Split the computer into multiple virtual machines Different “tasks” can be run separately and independently on the same mainframe If one virtual machine or “task” has a problem, other virtual machines are unaffected
  • 8. Personal Computer Evolution • Introduction of Intel/AMD servers (x86 architecture) • Each PC/server runs its own OS (Windows / Unix) and runs application. • Best approach for personal computers. • For server and IT infrastructure brings overhead while going for massive scale. • Typically in IT and infrastructure deployment one server runs one application (Email Server, Application Server, DB Server etc) File Server Web Server File Server Web Server File Server Domain Server App Server DNS Server Each Server Running 1 Application
  • 10. Physical Server vs Virtual Server
  • 11. Components of Server Virtualization Virtual Machine Software Implementation of a machine that executes program like a physical machine. Host Operating System Operating System actually running in the server / hardware Guest Operating System The Operating System running in the simulated virtual machine HyperVisor or VMM The Operating System running in the simulated virtual machine Host Operating System Hardware -- “real machine” Virtual Machine Guest Operating System APP APP Virtual Machine Guest Operating System APP APP Hypervisor / VMM
  • 12. Virtual Machine System Virtual Machine Full Virtualization VMs run directly on the server infrastructure without any general purpose OS Hardware -- “real machine” Virtual Machine Monitor (VMM) Simulated Machine Operating System APP APP Simulated Machine Operating System APP APP Hardware -- “real machine” Host Operating System Simulated Machine Operating System APP APP Simulated Machine Operating System APP APP Process Virtual Machine? Needs host operating system Virtual Machine running as a process in the host OS
  • 13. HyperVisor Hypervisor Hypervisor is a variant of supervisor and is the “Supervisor of Supervisor” Piece of computer software, firmware or hardware that creates and runs VM Presents the guest operating system a virtual operating platform and manages the execution of guest OS Multiple instances of a variety of operating systems may share the virtualized hardware resources
  • 14. Type 1 Hypervisors • Also known as bare-metal implementation • They sit directly on the top of hardware, without needing any operating system. • Since they can directly communicate with hardware resources, they are much faster than type 2 hypervisor Pro’s • Single virtual machine crash does not affect rest of guest system. • More Secure than type2. • Generate less overhead and fast. Example Vmware Esx, Microsoft Hyper-V
  • 15. Type 2 Hypervisors • Type 2 hypervisor resides on top of the operating system. • They cannot directly communicate with the hardware, they are less efficient than the type 1 Pro’s • Install is easier. • OS takes care of all the hardware, that’s why can support wide range of hardware. Con’s • More points of failure, anything that affects the stability of base os can also affect the guest os. Examples KVM, VirtualBox
  • 18. CPU Virtualization What is CPU Virtualization? • Single CPU acting as if there are more than 1 CPU in the system. • Most instructions are executed directly on the physical CPU • The Hypervisor / VMM safely performs privileged instructions
  • 19. X86 Architecture Privileges • Four Levels of Privileges as Ring 0, 1, 2, 3 for both kernel space (OS) and user space applications • These privileges are meant for accessing the hardware resources by the OS and user space applications • User Apps run in Ring 3 and OS runs in Ring 0 • The AMD-V and Intel-VT CPUs use a new privilege level called Ring -1 for the VMM
  • 20. Server Virtualization Components CPU Virtualization Full Virtualization Bare Metal / Type1 Hypervisor Type 2 Hypervisor Para Virtualization Type 2 Hypervisor Hardware Assisted Virtualization Bare Metal / Type1 Hypervisor Type 2 Hypervisor
  • 21. Full Virtualization User Apps Guest OS VMM System Hardware Ring 3 Ring 2 Ring 1 Ring 0 Full Virtualization Requires no hardware assist or OS assist for virtualization support Guest OS is not aware of whether it is running in VM or physical server. The Guest OS runs in Ring 1 privilege Hypervisor runs in Ring 0 privilege
  • 22. Bare Metal Execution Methodology • Guest user apps can’t tamper with the guest OS due to ring protections. However user level code can be directly executed on the processor for high performance virtualization. • Guest user apps and guest OS can’t tamper with VMM due to ring protections • When the guest OS executes a privileged instruction, it will trap into the VMM • When a guest app generates a system call or exception, the app will trap into the VMM • VMM’s trap handler uses a policy to decide what to do (e.g., emulate the instruction) User Apps Guest OS VMM System Hardware Ring 3 Ring 2 Ring 1 Ring 0 Direct Execution of virtualizable instructions Binary Translation of non- virtualizable instructions Bare Metal
  • 23. Full Virtualization – Execution Methodology • Guest user apps can’t tamper with the guest OS due to ring protections. However user level code can be directly executed on the processor for high performance virtualization. • Guest user apps and guest OS can’t tamper with VMM due to ring protections • Any instruction either privileged or non-privileged will trap into the VMM • When a guest app generates a system call or exception, the app will trap into the VMM • VMM’s trap handler uses a policy to decide what to do (e.g., emulate the instruction) User Apps Guest OS Host OS System Hardware Ring 3 Ring 2 Ring 1 Ring 0 Binary Translation of All Instructions Host Based VM
  • 24. Full Virtualization – Drawbacks Low Performance, typically in the range of 80 – 97% Running I/O intensive applications will be challenging Code cache increases the performance with the cost of memory
  • 25. Para Virtualization Para Virtualization Requires communication between the guest OS and hypervisor to improve performance and efficiency Guest OS should be aware of whether it is running in VM or physical server Guest OS kernel needs to be modified to replace non virtualizable instructions with hypercalls that communicate directly with the hypervisor The Guest OS runs in Ring 1 privilege. Hypervisor runs in Ring 0 privilege User Apps Guest OS Instrumented Host S System Hardware Ring 3 Ring 2 Ring 1 Ring 0 Virtualization Layer
  • 26. Para Virtualization – Execution Methodology • Guest user apps can’t tamper with the guest OS due to ring protections. However user level code can be directly executed on the processor for high performance virtualization. • Guest user apps and guest OS can’t tamper with VMM due to ring protections • As the guest OS kernel is modified to replace non virtualizable instructions with hypercalls that communicate directly with the hypervisor • it will issue a hypercall to the VMM • VMM’s trap handler uses a policy to decide what to do (e.g., execute the instruction)
  • 27. Hardware Assisted Virtualization Hardware Assisted Virtualization Techniques like Intel VT-X, AMD-V facilitates the hardware assisted virtualization Privileged and sensitive calls are set to automatically trap to the hypervisor and handled by hardware The Guest OS runs in Ring 1 privilege Hypervisor runs in Ring 0 privilege User Apps Guest OS System Hardware Ring 3 Ring 2 Ring 1 Ring 0 VMMRing -1
  • 28. Multithread Vs Multicore Vs CPU Virtualization
  • 29. Memory Virtualization What is Memory Virtualization? • Abstracts the physical memory resources in a virtualized server. • Handles the physical memory, virtual memory of both guest and host OS and maintains mapping between these entities.
  • 31. Emulated I/O Guest VM Guest OS Host OS (Linux) KVM (kernel module) QEMU vCPU vCPU User space Kernel space I/O emulation I/O operation MMIO or PIO Trap Native drivers Interrupt • Software emulates real hardware device • VMs run same driver for the emulated hardware device • Trap  hypervisor  I/O emulator (e.g., QEMU) • Every I/O operation generates trap and emulation • Poor performance
  • 32. Para-Virtualized I/O • Split driver model • Front-end driver in a guest VM • Virtual driver to forward an I/O request to its back-end driver • Back-end driver in a host OS • Request a forwarded I/O to HW via native driver Guest VM Guest OS Host OS (Linux) KVM (kernel module) QEMU vCPU vCPUUser space Kernel space VirtIO Backend I/O operation Native drivers VirtIO Frontend Shared descriptor ring: Optimization by batching I/O requests  Reducing VMM intervention cost
  • 33. Direct I/O Guest VM Guest OS Host OS (Linux) KVM (kernel module) QEMU vCPU vCPU User space Kernel space I/O emulation I/O operation MMIO or PIO Native drivers 33/32 • Directly assign device to Guest • High performance and low CPU utilization
  • 35. Agenda Introduction KVM, QEMU, LibVirt KVM Virtualization CPU Virtualization in KVM Memory Virtualization in VM Para Virtualized Drivers and Network Device Virtualization Example QEMU, LibVirt commands
  • 36. KVM (Kernel Virtual Machine) By itself, KVM does not perform any emulation. It exposes /dev/kvm interface for virtualization KVM (Kernel VM) Hardware Assisted Virtualization infra for linux on X86 Requires hardware containing virtualization extensions (Intel VT or AMD-V) Open Source Software under GPL license Two Components: Kernel Component part of mainline linux for 2.6.20. User Component (part of Qemu)
  • 37. Why KVM Hardware Based Virtualization Native Support for any guest OS Better Performance Open Source & Flexible Enhanced Security
  • 38. KVM
  • 39. QEMU (Quick Emulator) QEMU (Quick EMUlator) Generic and open source machine emulator and virtualizer QEMU can run programs made for one machine (for example: an ARM board) on a different machine Hosted hypervisor/VMM that performs hardware virtualization Work along with KVM for providing Hardware Assisted Virtualization
  • 40. Emulation Vs Virtualization  Both can act as a hypervisor  Virtualization  Slice the underlying hardware into multiple disjoint virtual devices  The ISA of host and guest typically are same  Guest operations can be directly dispatched to hardware  Emulation  Host and Guest may have different ISA  Guest ISA is managed in software  Guest operations needs translation
  • 42. KVM vs QEMU  Both are hypervisors  Stand alone QEMU uses paravirtualization where as KVM provides infra for hardware virtualization  KVM virtualizes only CPU and memory whereas Qemu virtualizes all other devices  When QEMU and KVM are working together we get hardware assisted virtualization
  • 43. KVM – Components  KVM.ko  Core KVM kernel module  Implements vCPU and MMU  Emulates few virtual devices in kernel  Provides ioctls for communications  Kvm-intel.ko / kvm-amd.ko  Provide support for Intel VMX and AMDs SVM support  qemu-kvm  Based on Qemu emulator  Implements much of virtual devices  Provides user interface to KVM
  • 44. 44 KVM – High Level Overview
  • 45. 45 KVM – High Level Overview
  • 46. libvirt Libvirt Provides Open Source API for managing the various hypervisors The management task includes provision, creation, modification, monitoring, control, migration etc Various cloud orchestration platforms uses libvirt libraries for instantiating the VMs Any libvirt client can remotely connect to the libvirt running in a host server
  • 49. KVM Concepts  KVM converts the Linux Kernel to provide Hypervisor support  However there is no change introduced in the Linux kernel to provide the Hypervisor support.  Instead new kernel modules are introduced.  Linux kernel already does all the process, memory and i/o management for the process running in the host OS  KVM introduces a new mode called guest mode along with the User Mode and Kernel Mode
  • 50. KVM Virtualization CPU • CPU Virtualization Memory • Memory Virtualization IO Device • I/O Virtualization
  • 51. Intel Hardware Support For Virtualization Intel Virtualization Support For processor virtualization, Intel offers the VT-x . VT-X adds the guest mode or ring –1 privilege for KVM For memory virtualization, Intel offers the EPT, which translates the virtual address to the machine's physical addresses to improve performance For I/O virtualization, Intel implements VT-d and VT-c
  • 52. CPU Virtualization  Every VM is a normal application process in the host machine.  The VM process in the host machine can be scheduled to run on the CPU by the host OS (like normal process).  However KVM allows the quest code / OS to run directly into the host CPU (although the quest OS / code runs as an application process) using the guest mode execution  For scheduling, memory management, and other services KVM uses the linux kernel however it helps the user program to make use of the hardware virtualization
  • 55. Virtual Memory Virtualization  Virtual Memory Virtualization is similar to Virtual Memory concept.  In virtual memory concept the operating system maintains mappings of virtual memory to machine memory using page tables.  However in VM environment, virtual memory virtualization involves mapping between virtual memory of guest operating system to physical memory of guest operating system along with the mapping of physical memory of guest operating system to the machine memory  The first mapping will be maintained by guest OS and the second mapping will be maintained by the hypervisor
  • 57. KVM Emulated Device Virtualization  QEMU in user space provides the emulated device which is a software implementation of the hardware.  The guest VM is not aware that it is an emulated device and interacts with the device  When there is any I/O operation by the guest VM, the hypervisor intercepts all I/O requests from the guest operating system and emulates the operation of the real I/O hardware
  • 58. KVM Para Device Virtualization / VirtIO  Para-virtualized devices are software implementations of hardware devices  Para-virtualization requires that the guest operating system be modified to communicate with the hypervisor.  It’s a split driver implementation with front-end driver sitting in VM and backend driver sitting in KVM  The frontend and backend drivers communicate through a path that is nothing but virtio  The frontend driver manages the I/O requests of the guest OSes and the backend driver is responsible for managing the real I/O devices and multiplexing the I/O data of different VMs
  • 59. KVM Para Device Virtualization / VirtIO
  • 60. KVM Network Virtualization Network Virtualization Network Device Virtualization NIC TUN/TAP Interface Bridge OVS Network backend User Networking Private Virtual Bridge Public Bridge Routing with iptables
  • 61. vNIC, TUN/TAP Interface vNIC A VNIC is a virtualized Network Interface Card, used by a Virtual Machine as its network interface. Linux Bridge The Linux bridge code implements a subset of the ANSI/IEEE 802.1d standard. Bridge can be created inside a system and can be used to provide connectivity across the VM TAP Interface TAP simulates a link layer device and it operates with layer 2 packets like Ethernet frames. Packets sent by an operating system via a TAP device are delivered to a user-space program which attaches itself to the device OVS open-source implementation of a distributed virtual multilayer switch. Provides a switching stack for hardware virtualization environments
  • 63. User Networking When? • When the virtual machine is required to access to the host, to internet or to resources available on your local network. • There is no need to access your guest from the network or from another guest. Procedure • Simply run guest without specifying network parameters, which by default will create user-level (a.k.a slirp) networking
  • 64. Private Virtual Bridge When? • When setting up a private network between 2 or more virtual machines. • This network won't be seen from the other virtual machines nor from the real network. Procedure • Create a bridge • Create a tap device • Attach the tap device to the bridge
  • 65. Public Bridge When? • You want to assign IP addresses to your virtual machines and make them accessible from your local network Procedure • Create a bridge • Create a tap device • Attach the tap device to the bridge • Attach the host machine interface to the bridge
  • 66. Routing With IP Tables When? • You want to pass through all the traffic from VM to IP tables of Host Procedure • Create a bridge • Create a tap device • Attach the tap device to the bridge • Attach the host machine interface to the bridge
  • 69. KVM Installation  Check your CPU has hardware virtualization support – either Intel VT-x or AMD-V.  egrep -c ‘(svm|vmx)’ /proc/cpuinfo should return a value 1 or more  Install KVM, lib-virt, linux bridge utilities and GUI based virt-manager  sudo apt-get install qemu-kvm libvirt-bin bridge-utils virt-manager  Run the command to add your user account to the libvirt group  sudo adduser name libvirtd
  • 70. Basic QEMU-KVM CLI Commands  qemu-kvm options disk_img  qemu-kvm -name “Telsites" -M pc-0.12 -m 512 -cpu kvm64 -smp 2 /images/telsitessp1.raw  qemu-kvm -hda /images/selsitessp1.raw -net nic -net user  qemu-kvm -hda /images/imagei1.raw -hdb /images/image2.raw -hdc /images/image3.raw -hdd /images/image4.raw

Editor's Notes

  • #11: Courtesy: https://www.veeam.com/blog/why-virtual-machine-backups-different.html
  • #38: http://blog.scalecomputing.com/kvm-or-vmware-why-kvm-is-right-for-the-times-part-1-of-2/
  • #41: http://www.slideshare.net/ChiaweiWang3/qemu-introduction
  • #50: http://www.slideshare.net/ChiaweiWang3/qemu-introduction
  • #51: http://www.slideshare.net/ChiaweiWang3/qemu-introduction
  • #52: http://www.slideshare.net/ChiaweiWang3/qemu-introduction
  • #54: http://www.slideshare.net/ChiaweiWang3/qemu-introduction http://www.linuxjournal.com/magazine/linux-kvm-learning-tool
  • #55: http://www.slideshare.net/ChiaweiWang3/qemu-introduction http://www.linuxjournal.com/magazine/linux-kvm-learning-tool