kvm -- Kernel-based Virtual Machine

1、虚拟机类型: 类型1 硬件上直接安装hp

       类型2 硬件上安装HOST 上面跑VMM

2、kvm概要

  kvm 不算类型1也不算类型二。两种特性都有,他是linux的一个内核模块,内核中本身没有hv,当装上kvm时,内核就会变成hv了。此时硬件驱动就不用借助于别人,内核本身就可以使用这些驱动。

  当有了hv时,需要一个管理工具,来创建虚拟机,管理虚拟机。

  本身linux是运行在环0上,当装上kvm后,kvm就运行在环0捕获特权指令,内核运行在环-1上。

  IO设备就需要软件模拟了。但是kvm自己不会模拟,只能借助另一个软件,qemu

3、qemu

qemu是个模拟器,可以管理并创建各种设备

  cpu:模拟器,虚拟化

  qemu (类型2的虚拟化软件) kqemu相当于qemu的二进制翻译。此时qemu性能更好,但是bug很多

  此时kvm出现,取代了kqemu,和qemu配合更好,此时内核变为hv, qemu成为kvm控制台以及管理io设备的工具

4、使用kvm
  如果用的是vm虚拟机要注意,硬件必须支持虚拟化

cat /proc/cpuinfo  | egrep ‘vmx|svm‘modprobe kvm        #装在kvmmodprobe kvm_intel | kvm_amd
lsmode | grep kvm  #查看

/dev/kvm

为虚拟机分配内存

读写vcpu的寄存器

想vcpu注入终端

运行vcpu

qemu进程,

处理器需求:需要一台可以运行最新Linux内核的Intel处理器(含VT虚拟化技术)或AMD处理器(含SVM安全虚拟机技术的AMD处理器,也叫AMD-V)。可以使用如下命令检查:

  #egrep "(vmx|svm)" color=always /proc/cpuinfo

或者使用下面的命令:

    #cat/proc/cpuinfo | egrep ‘vmx|svm‘ 

flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 popcnt aes lahf_lm ida arat dts tpr_shadow vnmi flexpriority ept vpid
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology nonstop_tsc aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 popcnt aes lahf_lm ida arat dts tpr_shadow vnmi flexpriority ept vpid

   会出现一堆这样的 flags

如果输出的结果包含vmx,它是Intel处理器虚拟机技术标志;

如果包含svm,它是AMD处理器虚拟机技术标志;。

如果你甚么都得不到,那应你的系统并没有支持虚拟化的处理,不能使用kvm。

另外Linux发行版本必须在64bit环境中才能使用KVM。

用命令uname-a 查看

x86_64则说明你是64位内核,跑的是64位的系统.

是否支持虚拟化

如果不支持硬件虚拟化,是安装不上kvm-intel 或者 kvm-amd的,如果是虚拟机则要在物理cpu支持虚拟化的前提下开启虚拟机cpu的虚拟化

virtio 驱动,

kvm管理工具站

1、virsh

virsh调用底层的libvirt库来实现管理虚拟机,

virt-manager,virt-viewer 这两个是virsh的图形化工具

可以管理xen与kvm

2、qemu

qemu也是一个管理虚拟机的管理工具,qemu-kvm就是管理kvm的基础

virsh比较完善 ,qemu目前不太完善

3,查看virt工具

yum list all *virt*

centos6以后xen就不能运行在dome0中了,红帽抛弃了xen专项大力研发kvm,所以这套组件在centos6后仅适用于kvm,但是xen源中的libvirt是支持kvm的

时间: 2024-10-08 23:02:55

kvm -- Kernel-based Virtual Machine的相关文章

PatentTips - Safe general purpose virtual machine computing system

BACKGROUND OF THE INVENTION The present invention relates to virtual machine implementations, and in particular to a safe general purpose virtual machine that generates optimized virtual machine computer programs that are executable in a general purp

Virtual Machine Kernel Panic : Not Syncing : VFS : Unable To Mount Root FS On Unknown-Block (0,0)

Virtual Machine Kernel Panic : Not Syncing : VFS : Unable To Mount Root FS On Unknown-Block (0,0) 33192 Share on FacebookShare on Twitter This issue appeared in the Linux virtual machines in the VMware environment after upgrading the guest os, Virtua

setting up kernel debugging on a vmworkstation virtual machine

1.  look up section  Setting Up Kernel-Mode Debugging of a Virtual Machine Manually in windbg help mannual. 2. create COM port & named pipe on the virtual machine https://www.vmware.com/support/ws55/doc/ws_devices_serial_host_app_to_vm.html https://w

[转] Vmware vs Virtualbox vs KVM vs XEN: virtual machines performance comparison

http://www.ilsistemista.net/index.php/virtualization/1-virtual-machines-performance-comparison.html?limitstart=0 Today, "Virtual machine" seems to be a magic words in the computer industry. Why? Simply stated, this technology promise better serv

Reentrant protected mode kernel using virtual 8086 mode interrupt service routines

A method for allowing a protected mode kernel to service, in virtual 8086 mode, hardware interrupts which occur during execution of ring 0 protected mode code. When an interrupt occurs during execution of ring 0 code, the microprocessor copies the?st

PatentTips - System and method to deprivilege components of a virtual machine monitor

BACKGROUND INFORMATION An embodiment of the present invention relates generally to virtualization platforms and, more specifically, to a system and method to run components of a virtual machine monitor at a reduced privilege level. Various mechanisms

Virtual Machine Definition File 2.2

http://archives.opennebula.org/documentation:archives:rel2.2:template#disks_device_mapping A template file consists of a set of attributes that defines a Virtual Machine. The syntax of the template file is as follows: Anything behind the pound or has

PatentTips - Virtual machine management using processor state information

BACKGROUND OF THE INVENTION The invention generally relates to virtual machine management, and more particularly to efficient scheduling of virtual machines using processor state information. Virtualization of machine resources has been of significan

Apache Virtual Hosting IP Based and Name Based Virtual Hosts

As we all are aware that Apache is a very powerful, highly flexible and configurable Web server for Nix OS. Here in this tutorial, we are going to discuss one more feature of Apachewhich allows us to host more than one website on a single Linux machi

Virtualizing physical memory in a virtual machine system

A processor including a virtualization system of the processor with a memory virtualization support system to map a reference to guest-physical memory made by guest software executable on a virtual machine which in turn is executable on a host machin