Thomas Uphill

thomas@narrabilis.com

Outline

  • Virtualization
  • History/Description/Organisation
  • tools
    • qemu/libvirt/virsh/virt-manager
  • networking
  • migration
  • cloud
    • ovirt/opennebula/ganeti
  • cluster

Virtualization

physical machine

History

  • Israeli startup Qumranet 2005-2008
    • Moshe Bar - XenSource (Xen) 2003
    • Rami Tamir, Benny Schnaider - Ravello Systems
  • RedHat 2008
    • Avi Kivity
    • Marcelo Tosatti
  • LGPL, GPL

Description

full virtualization

physical machine

pci

ethernet

block

kernel

kvm

syscall

Description

paravirtualization - net/block/video

physical machine

pci

ethernet

block

kernel

kvm

virtio

virtio_pci

virtio_net

virtio_blk

virtio_ring

Organisation

  • kvm.ko
  • kvm-intel.ko
  • kvm-amd.ko

(powerpc arm)

  • modified qemu - wiki.qemu.org
    • x86 powerpc s390
  • SEABIOS

processor extensions in specific module, main virtualization in kvm.ko

modified qemu which interfaces with kvm instead of rewriting calls itself (it is an emulator)

uses SEABIOS

Organisation

qemu

kernel

physical machine

pci

ethernet

block

kvm.ko

guest kernel

virtio

kvm-intel.ko

syscall

virtio_pci.ko

virtio_net.ko

virtio_blk.ko

SEABIOS

virtio_ring

qemu

modified qemu uses kvm as hardware

long command lines

really long command lines

no seriously...really long command lines

/usr/libexec/qemu-kvm -S -M rhel6.3.0 -enable-kvm -m 1024 -smp 1,sockets=1,cores=1,threads=1 -name springdale -uuid aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee -nodefconfig -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/springdale.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-shutdown -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -drive file=/dev/springdale_vg/springdale_lv,if=none,id=drive-virtio-disk0,format=raw,cache=none,aio=native -device virtio-blk-pci,scsi=off,bus=pci.0,addr=0x4,drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 -netdev tap,fd=22,id=hostnet0,vhost=on,vhostfd=24 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:00:93:17:f4,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -device usb-tablet,id=input0 -vnc 127.0.0.1:4 -vga cirrus -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x5

desktop

display options:

sound:

  • ac97
  • es1370
  • ich6

  • vnc
  • spice
  • Cirrus
  • QXL
  • VGA
  • VMVGA
  • Xen

desktop

  • fast
  • audio
  • video/audio sync
  • clipboard

desktop

usb:

share devices

pci:

share devices

libvirt

virtualization api

hypervisor agnostic

supports:

      • kvm
      • xen
      • vmware
      • virtualbox

provision, create, modify, monitor, control, migrate and stop domains

libvirt xml

<domain type='kvm' id='2'>

<name>domainname</name>

<uuid>something-unique</uuid>

<memory unit='KiB'>1048576</memory>

<currentMemory unit='KiB'>1048576</currentMemory>

<vcpu placement='static'>1</vcpu>

<os>

<type arch='x86_64' machine='rhel6.3.0'>hvm</type>

<boot dev='hd'/>

</os>

<features>

<acpi/><apic/><pae/>

</features>

<clock offset='utc'/>

<devices>

<emulator>/usr/libexec/qemu-kvm</emulator>

virsh

  • cli interface for libvirt
  • load from xml
  • dump to xml
  • edit xml
  • start/stop/restart domains
  • define storage pools
  • define networks
  • connect to machines
  • connect to other hypervisors

virt-manager

networking

nat uses dnsmasq

networking -bridge

bridge

vireth0

vireth1

vireth2

vireth3

vireth4

eth0

domain0

domain1

domain2

domain3

domain4

ipaddress

production way to go

networking -nat

bridge

vireth0

vireth1

vireth2

vireth3

vireth4

eth0

domain0

domain1

domain2

domain3

domain4

NAT

production way to go

networking -physical device

eth0

domain0

domain1

domain2

domain3

domain4

production way to go

networking

virt-manager

bridge-utils - brctl

dnsmasq - dns and dhcp

virsh/libvirt demo

help

list

dumpxml

console

virsh first:

list domains

dumpxml of the vms

help

then virsh, go to details on the vm, show how to add a drive, or a resource

show about adding usb devices and pci

migration

shared storage

    • same path
    • multipath

qemu same location

    • same syntax/version

network

    • same device/bridge name
    • gratuitous ping

migration

libvirt migration:

    • ssh keys
    • X.509 certificates
    • listen tcp
    • virsh or virt-manager or api

migration

ssh-keys

authorized_keys for root

/root/.ssh/config

-A INPUT -s kvm1 -m state --state NEW -m tcp -p tcp --dport 7800 -j ACCEPT

-A INPUT -s kvm2 -m state --state NEW -m tcp -p tcp --dport 7800 -j ACCEPT

Host kvm1

Port 7800

Host kvm2

Port 7800

migration - example

shared storage

same network

kvm0

kvm1

NFS export

/shared

iscsi target

/dev/shared

iscsi initiator

/dev/shared

bridge kvm

bridge kvm

kvmdemo

kvmdemo

NFS Server

iSCSI target

NFS mount

/shared

cloud/management

several options

manage migration of vms

manage storage pools

manage networking (bridges)

http://www.linux-kvm.org/page/Management_Tools

vagrant

https://github.com/adrahon/vagrant-kvm

ovirt

www.ovirt.org

Fedora centric

ovirt-engine

http://localhost:8080 https://localhost:8443

opennebula

opennebula.org

hypervisor agnostic

supports vmware

ganeti

code.google.com/p/ganeti

google solution

xen or kvm

lvm files drbd

RHEV

RedHat Solution

  • HA Cluster
  • GFS

cluster

Red Hat High Availability

Fedora Cluster Suite

ricci/luci cman dlm fenced - old

corosync/pacemaker - new

shared storage

heartbeat

/etc/cluster/cluster.conf

cluster.conf

xml format

<cluster name="lopsa" config_version="2">
<clusternodes>
<clusternode name="node0.example.com" nodeid="1">
<fence>
</fence>
</clusternode>
<clusternode name="node1.example.com" nodeid="2">
<fence>
</fence>
</clusternode>
<clusternode name="node2.example.com" nodeid="3">
<fence>
</fence>
</clusternode>
</clusternodes>
<fencedevices>
</fencedevices>
<rm>
</rm>
</cluster>

cluster.conf

resources

<vm name="kvm-test" domain="all" path="/cluster/kvm/kvm-test"/>

clusvcadm

clustat

Questions/Comments?

thomas@narrabilis.com

ramblings.narrabilis.com

Thank You for Attending LOPSA-East ‘13

Please fill out the Trainer Evaluation


Rate LOPSA-East ‘13

http://lopsa-east.org/2013/training-survey

http://www.lopsa-east.org/2013/rate-lopsa-east-13

kvm - Google Slides