Virtualization 3

COMP25212:
Virtualization 3
Subtitle: “What can we do to a VM?”
Learning Objectives:
– To understand the VM-handling
mechanisms of a hypervisor
– To understand how many different valueadded services are constructed on top of
VM-handling mechanisms
COMP25212
1
Stopping a VM
Hypervisor stops and
starts VM all the
time:
– to share CPUs
– to serialize access to
resources
Applications
Applications
Guest A
Operating System
Guest B
Operating System
Virtual Machine Monitor/Hypervisor
• Stop by:
– Saving CPU
registers into
Hypervisor data area
COMP25212
Host Hardware
Virtualized
2
Starting a VM
• Hypervisor:
– gains control (e.g.
clock tick)
– saves previous
VM’s CPU registers
– loads next VM’s
CPU registers
– jumps to next VM’s
next-PC (in correct
privilege state)
Applications
Applications
Guest A
Operating System
Guest B
Operating System
Virtual Machine Monitor/Hypervisor
COMP25212
Host Hardware
Virtualized
3
VM State While
Stopped
VM State:
– Memory (all guest
physical memory)
• includes Application
state, OS state
Applications
Applications
Guest A
Operating System
Guest B
Operating System
Virtual Machine Monitor/Hypervisor
– CPU state
(registers)
– Small amount of I/O
state
• Let’s stop VM when
I/O is quiescent!
COMP25212
Host Hardware
Virtualized
4
“Freeze” a VM
• Once suspended, the
VM image is selfcontained
– VM can be (e.g.)
copied to a file
Applications
Guest A
Operating System
CPU registers
I/O state
(LARGE file!)
• Now, what else can
we do with this?
COMP25212
5
Move a VM
Applications
Applications
Applications
Applications
Guest A
Operating System
Guest B
Operating System
Guest B
Operating System
Guest C
Operating System
Virtual Machine Monitor/Hypervisor
Virtual Machine Monitor/Hypervisor
Host Hardware X
Host Hardware Y
Virtualized
Virtualized
COMP25212
6
Snapshot and Rollback
a VM
Applications
Applications
Applications
Guest A
Operating System
Guest B
Operating System
Guest B
Operating System
Virtual Machine Monitor/Hypervisor
…
Host Hardware
Applications
Virtualized
Guest B
Operating System
Think: Optimizations?
COMP25212
7
Archive a VM
Applications
Guest B
Operating System
COMP25212
8
Rapid Provisioning
Applications
Guest B
Operating System
Applications
Guest C
Operating System
Virtual Machine Monitor/Hypervisor
Host Hardware
Virtualized
COMP25212
9
Virtual Appliances
• http://www.vmware.com/appliances/directory/
• over 1000 downloadable appliances
Applications
Applications
Applications
Applications
Guest
Guest B
B
Applications
Guest
B
Applications
Guest
B System
Operating
Operating
Applications
Operating
Guest
B
Applications
Operating
Guest
B
System
Guest
BSystem
Operating
Guest
BSystem
Operating
Operating
System
Operating
System
System
System
• e.g.:
• mail server
• web server
• hotel system
• virus scanner
• firewall
COMP25212
10
Deploying Secure
Desktops
Applications
Guest Operating
System
Virtual Machine Monitor/Hypervisor
Host Hardware
Virtualized Desktop Machine
COMP25212
11
Live Migration
• Optimizing migration from “source” to “destination”
VMM:
– Repeat:
• Suspend VM on “source” machine
• Reset all “dirty” bits in VMM’s page tables
• Resume VM on “source” machine
• Copy all non-“dirty” pages to destination machine
– Until only minimal subset of pages left
– Suspend VM on “source”
– Copy remaining pages to “destination”
– Resume VM on “destination”
COMP25212
12
Load Balancing
• Management software monitors “load”
on all physical machines
• If loads are mismatched, migrate a VM
from a loaded to a less-loaded machine
Independent of Application!
Independent of Operating System!
COMP25212
13
High Availability
• For critical applications, keep a standby VM
available on a different hardware system
• Regularly copy active VM image to standby
VM (but don’t activate it)
• Activate standby VM if active VM stops
responding (VM crashes? VMM crashes?
Hardware system fails?)
COMP25212
14