/docs/MyDocs

To get this branch, use:
bzr branch http://darksoft.org/webbzr/docs/MyDocs

« back to all changes in this revision

Viewing changes to Administration/Server/Virtualization/kvm/libvirt.txt

  • Committer: Suren A. Chilingaryan
  • Date: 2017-04-03 02:45:17 UTC
  • Revision ID: csa@suren.me-20170403024517-dwzj0z0k1cmhxm7u
Restructuring, OpenShift, Ansible, Git

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Libvirt is a virtualization infrastracture
 
2
 daemon: libvirtd
 
3
 configuration: /etc/libvirt
 
4
 control-app: virsh
 
5
 UI client: virt-manager
 
6
    /var/run/libvirt/libvirt-sock - should be accessible by user
 
7
 
 
8
Additional daemons:
 
9
 vde: VDE network to connect with stand-alone qemu (not needed in simple config)
 
10
 dnsmasq: DNS proxy (automatically launched)
 
11
 
 
12
Network
 
13
 - Libvirt network manager (TAP based), creates two interfaces
 
14
    virtbr0 - bridge used by the clients
 
15
    vnet0 - virtual NAT device which masquerades packets from virtbr0
 
16
 this configured using following directive in domain config (networks
 
17
 are defined in /etc/libvirt/qemu/networks):
 
18
    <interface type='network'>
 
19
      <mac address='54:52:00:63:a8:88'/>
 
20
      <source network='default'/>
 
21
    </interface> 
 
22
 - Existing bridges can be used:
 
23
    <interface type='bridge'>
 
24
      <mac address='54:52:00:63:a8:88'/>
 
25
      <source bridge='br0'/>
 
26
    </interface>
 
27
 The bridges are created in /etc/conf.d/net
 
28
    bridge_br0="vlan0"
 
29
    config_br0="ip/mask"
 
30
 and can be checked using 'brctl' tool
 
31
    brctl show 
 
32
 - If virtual machine with configured networking is executed using libvirt,
 
33
 by 'ps | grep kvm' you can see network parameters, something like:
 
34
    -net tap,fd=11,vlan=0
 
35
 Running it directly will never work because libvirt normally sets up the 
 
36
 network connections and passes them as open files to kvm.
 
37
 
 
38
 
 
39
Sharing network with stanalone qemu
 
40
===================================
 
41
 1. We are creating a VDE network
 
42
    - Lets call it 'vlan0'
 
43
    - It should be accessible by users
 
44
        VDE_SOCK_CHMOD="770"
 
45
        VDE_SOCK_CHOWN=":qemu"
 
46
    - The actual IP in /etc/conf.d/vde is not important, it just should not 
 
47
    interfer with other networks
 
48
 2. Creating a bridge to vlan0, and setting it's IP to the network where would
 
49
 reside our virtual machines
 
50
        bridge_br0="vlan0"
 
51
        config_br0=("192.168.28.1/24")
 
52
        brctl_br0=("stp on" )
 
53
 3. Libvirt virtual machines should be configured to use bridge 'br0'
 
54
        <interface type='bridge'>
 
55
            <mac address='54:52:00:63:a8:88'/>
 
56
            <source bridge='br0'/>
 
57
        </interface>
 
58
 4. Qemu is started as follows
 
59
        kvm -net nic,model=rtl8139 -net vde,vlan=0,sock=/var/run/vde.ctl ...
 
60
 
 
61
 Independ how the virtual machine is run, it could have an address from
 
62
 192.168.28.xxx network.
 
63
 
 
64
 The following daemons should be started:
 
65
  - vde daemon
 
66
  - dnsmasq (automatically executed by libvirt, but is needed if only a
 
67
  standalone machines are used and libvirt is not started)
 
68
 
 
69
Problems
 
70
========
 
71
 - There is multiple things which will prevent suspend: SATA/IDE controllers
 
72
 (virtio works fine), passthrough PCI devices (USB is fine), ...
 
73
 - By default libvirt tries to suspend machines on shutdown, if something 
 
74
 prevents machine from suspending, they will crash. So, it is better to 
 
75
 change behavior to shutdown
 
76
 
 
 
b'\\ No newline at end of file'