Introduction to the relationship between http://xanpeng.github.io/wiki/virt/kvm-virtulization-echosystem-intro.html KVM and qemu/qemu-kvm in the kvm virtualization technology Ecosystem
Qemu vs. qemu-KVM:
- From qemu 1.3, KVM userspace code is maintained in qemu mainline (GIT clone https://git.kernel.org/pub/scm/virt/kvm/qemu-kvm.git, ref)
- Qemu: http://git.qemu.org /? P = qemu. Git; A = tags
- Qemu-KVM: http://git.kernel.org/cgit/virt/kvm/qemu-kvm.git/refs/tags
- From qemu release_0_5_1 fork: http://git.kernel.org/cgit/virt/kvm/qemu-kvm.git/commit? Id = be26a5288e43d3177908a92251c526d54fbb936d
- Qemu v1.3.0: http://git.qemu.org /? P = qemu. Git; A = commit; H = capacity "as of the 1.3 release all qemu-KVM features have been merged into upstream qemu" (http://wiki.qemu.org/KVM)
- :
Qemu vs. KVM:
- Qemu by itself isn't very fast, as it does a lot of emulation even when running on the hardware compatible with the guest operating system.To make it perform better, qemu has a kernel module called KVMThat allows much of the guest OS's code to run directly on the host processor when running on x86 or x86-64 processors with virtualisation extensions under Linux.
- KVM is in the kernel, git clone https://git.kernel.org/pub/scm/virt/kvm/kvm.git.
KVM architecture and details
KVM (kernel-based Virtual Machine), by RedHat.
- Utilizing Modern CPU virtualization technology, Intel-VT, AMD-V
- The user-mode driver is qemu and processor is used by the user-mode driver.
- The hardware layer is simulated by qemu.
- KVM can also not use CPU virtualization technology, but in that case, it is equivalent to full simulation through qemu.
KVM @ kernel:
- KVM core framework
- Arch related KVM Codes
- ARCH/x86/KVM/* 37076
- ARCH/ARM/KVM/* 7751
- ARCH/PowerPC/KVM/* 29307
- ARCH/s390/KVM/* 4198
- ARCH/IA64/KVM/* 12328
- ARCH/MIPS/KVM/* 5628
- ARCH/Tile/KVM/* 37
- Drivers/s390/KVM/* 1447
- KVM header files
- ARCH//Include/ASM/KVM7179
- Include/Linux/KVM1238
- Include/ASM-generic/KVM21
- KVM docs
- Documentation/virtual/KVM/* 4774
- Documentation//KVM. Txt 249
Qemu architecture and details
- Install the required Library: glib-2.12 (http://www.gtk.org/download/linux.php)
- You can simulate an OS without KVM:
- Modprobe-r KVM
- Qemu-system-x86_64-name "qemutest"-M pc-0.12-M 1024-SMP 2-boot D-drive file =/home/root/KVM/images/opensuse11/disk0.raw, if = virtio, index = 0, media = disk, format = raw-drive file =/dev/sr0, Index = 1, media = CDROM-net Nic, model = virtio, macaddr = 52: 54: 00: 05: 11: 11-VGA cirrus-balloon virtio
- Lsmod | grep KVM detected that KVM. Ko was not loaded
- The system is running. The startup speed and execution speed are slower than that of the KVM virtual machine.
- Supported image formats (http://en.wikibooks.org/wiki/QEMU/Images#Image_types ):
- Qcow2: "native" and most flexible, (cow, encryption, compression, Vm snapshots)
- Raw: Plain binary image of disc image
- Cow: Copy-on-write format, supported for historical reasons
- Qcow: The old qemu cow format has been replaced by qcow2
- Vmdk: VMWare 3/4/6 image format
- VDI: virtualbox 1.1 image format
- Use Windows VM:
- Make win7 VM image (http://en.wikibooks.org/wiki/QEMU/Images#Creating_an_image)
- Qemu-IMG create-F qcow2 win7-x86_64-sp1.img 16g (requirement> 8576 m)
- Insert an installation CD for Windows 7
- Qemu-system-x86_64-M 2048-hda win7-x86_64-sp1.img-CDROM/dev/sr0-boot D (limited memory size), start the normal system installation process
- After the installation is complete, shut down the VM. Run win7 image. The size is 7.4 GB.
- Start win7 VM: qemu-system-x86_64-M 2048 win7-x86_64-sp1.img
- Configuration
Qemu-1.5.1:
- Main program related: Vl. C, cpu-exec.c, Exec. C, translate-all.c, Thunk. C, disas. c
- Command Translation: TCG/
- Hardware simulation: HW/
- Network Transmission: slirp/
- Image Protocol: block/
- Block/sheepdog. c
- Block/RBD. c
How can sheepdog and RBD be supported:
- Write sheepdog/RBD in libvirt XML file
- Libvirt parses XML and sends the corresponding command to qemu
- Qemu calls sheepdog/RBD driver
Location, architecture, and implementation of libvirt
Libvirt is the most widely used tool and API for managing KVM virtual machines, and some common Virtual Machine management tools (such as virsh, virt-install, virt-manager, etc) and the cloud computing framework Platform (such as openstack, opennebula, and eucalyptus) All use libvirt application interfaces at the underlying layer.
Libvirt is an application interface, daemon process, and management tool designed to manage platform virtualization technology more conveniently. It provides the following functions:
- Management of virtual clients
- Management of virtual networks and storage
- Supports a variety of virtualization solutions, including KVM, qemu, xen, VMWare, virtualbox, and other platform virtualization solutions
- Supports Linux container virtualization systems such as openvz and lxc
- Supports user-mode Linux (UML) Virtualization
- Provides a QMF proxy for a message system (such as Apache qpid) based on amqp (Advanced Message Queue Protocol, this makes it easier to implement message communication between the host and the client, and between the client and the client in the cloud computing management system.
- Provides security measures such as encryption and authentication for secure remote management of virtual clients
Code features:
- Provides a set of stable C language application interfaces
- Other popular programming languages also provide binding to libvirt. libvirt libraries can be directly used in advanced programming languages such as Python, Perl, Java, Ruby, PHP, and ocaml.
- Support for a variety of different hypervisor is achieved through a driver-based architecture. In the libvirt source code, you can easily find driver source code files such as qemu_driver.c, xen_driver.c, xenapi_driver.c, vmware_driver.c, and vbox_driver.c.
- Several important concepts: node, domain, and hypervisor. node indicates the physical node, and domain indicates the operating OS instance.
- Management functions:
- Domain Management: start, stop, pause, save, recover, and dynamic migration; hot swapping of various device types, including disks, NICS, memory, and CPU ;...
- Remote node Management
- Storage Management: Create client images of different formats; mount the NFS shared storage system, view existing LVM volume groups, create new LVM volume groups and logical volumes, partition disk devices, and mount iSCSI shared storage.
- Network Management: displays network interface cards, configures network interfaces, creates virtual network interfaces, bridges network interfaces, manages VLANs, sets Nat networks, and assigns virtual network interfaces to clients.
Community features:
- The free open-source software license is lgpl, and software programs linked using the libvirt library do not need to be open-source and comply with the GPL license.
- At present, libvirt is developed mainly by RedHat as a powerful support company. As RedHat gradually prefers to support KVM (rather than xen) in virtualization ), therefore, libvirt's support for qemu/KVM is very mature and stable.
- IBM, Novell, and other companies as well as a large number of individual developers contribute a lot to the code of the libvirt project.
MATERIALS:
1. Slide: KVM, kernel-based virtual machine, internals, code and more, which are very clear.
2. Slide: KVM: virtualisation the Linux way, which focuses on the background.
3. Chris [email protected]: KVM: Linux-based virtualization, overview.