qemu, kvm, libvirt introduction

  Usually used in a virtual working environment, so to understand under qemu, kvm, libvirt concepts and ties after the technical aspects of the follow-up study in output.

 

QEMU

  Qemu is an emulator, it is to simulate OS the Guest the CPU and other hardware, the Guest OS and think they deal directly with the hardware, in fact, the same simulated the Qemu hardware deal, Qemu translate those commands to the real hardware. Since all instructions pass from the through Qemu hand inside, and therefore poor performance.

  

KVM

  KVM is a linux kernel module, it requires CPU support, the use of hardware-assisted virtualization technology Intel-VT, AMD-V, about the memory such as the Intel EPT and AMD RVI technology, the Guest OS of CPU instructions do not have to go through Qemu translation , direct operation, greatly improves the speed, the KVM through the / dev / kvm expose interfaces, user mode application can access this interface ioctl function. See the following pseudocode:

open("/dev/kvm")
ioctl(KVM_CREATE_VM)
ioctl(KVM_CREATE_VCPU)
for (;;) {
    ioctl(KVM_RUN)
        switch (exit_reason) {
        case KVM_EXIT_IO: 
        case KVM_EXIT_HLT:
    }
}

   KVM kernel module itself can only provide CPU and memory virtualization, so it must be combined with QEMU in order to constitute a complete virtualization technology, which is to say the following qemu-kvm.

 

qemu-kvm

  Qemu the KVM integration came through ioctl call / dev / kvm interface to the relevant part of the CPU instruction referred kernel modules to do. kvm responsible for cpu virtualization + memory virtualization to achieve the cpu and memory virtualization, but kvm can not simulate other devices. qemu analog IO devices (network card, disk, etc.), KVM together we can achieve a real sense of server virtualization after qemu. Because use of the above two things, so called qemu-kvm. Qemu simulate other hardware, such as Network, Disk, which will affect the performance of these devices, so he had a pass through the paravirtualized device virtio_blk, virtio_net, improve equipment performance.

 

 

 libvirt

  libvirt is currently the most widely used of KVM virtual machine management tools and API. Libvirtd is a daemon process, can be a local call virsh can also be remotely virsh call, Libvirtd call qemu-kvm operate virtual machines.

 

 

  kvm art, applied to two things: qemu + kvm

  kvm:负责CPU虚拟化 + 内存虚拟化,实现了CPU和内存的虚拟化,但kvm不能模拟其他设备;kvm在linux内核态。

  qemu:模拟IO设备(网卡,磁盘),kvm 加 qemu之后就能实现真正意义上的服务器虚拟化技术;qemu在用户态。

因为用到了上面两个,所以一般都称为qemu-kvm。

  libvirt:调用虚拟化技术的接口用于管理。用libvirt管理方便,直接用qemu-kvm的接口太繁琐。

 

 

 

 

 

 

  

 

Guess you like

Origin www.cnblogs.com/tjb-home/p/12419818.html