virt-install是一个使用libvirt库构建新虚拟机的命令行工具,此工具使用串行控制台,SDL(Simple DirectMedia Layer)图形或者VNC客户端/服务器,来支持命令行和图形安装。
1 ubuntu下安装: apt-get install virtinst
[plain] view plain copy
1. # apt-get install virtinst
2. Reading package lists... Done
3. Building dependency tree
4. Reading state information... Done
5. The following extra packages will be installed:
6. adwaita-icon-theme at-spi2-core colord colord-data dconf-gsettings-backend dconf-service fontconfig fontconfig-config
7. fonts-dejavu-core glib-networking glib-networking-common glib-networking-services gsettings-desktop-schemas hicolor-icon-theme
8. ...
9. libxinerama1 libxkbcommon0 libxpm4 libxrandr2 libxrender1 libxtst6 python-libxml2 python-pycurl python-urlgrabber ubuntu-mono
10. virt-viewer x11-common
11. Suggested packages:
12. colord-sensor-argyll cups-common libgd-tools gphoto2 gvfs liblcms2-utils librsvg2-bin avahi-daemon hplip libsane-extras
13. sane-utils python-pycurl-dbg python-pycurl-doc
14. ...
2 virt-install常用参数
-n --name= 客户端虚拟机名称
-r --ram= 客户端虚拟机分配的内存
-u --uuid= 客户端UUID 默认不写时,系统会自动生成
--vcpus= 客户端的vcpu个数
-v --hvm 全虚拟化
-p --paravirt 半虚拟化
-l --location=localdir 安装源,有本地、nfs、http、ftp几种,多用于ks网络安装
--vnc 使用vnc ,另有--vnclient=监听的IP --vncport =VNC监听的端口
-c --cdrom= 光驱 安装途径
--disk= 使用不同选项作为磁盘使用安装介质
-w NETWORK, --network=NETWORK 连接客户机到主机网络
-s --file-size= 使用磁盘映像的大小 单位为GB
-f --file= 作为磁盘映像使用的文件
--cpuset=设置哪个物理CPU能够被虚拟机使用
--os-type=OS_TYPE 针对一类操作系统优化虚拟机配置(例如:‘linux’,‘windows’)
--os-variant=OS_VARIANT 针对特定操作系统变体(例如’rhel6’, ’winxp’,'win2k3')进一步优化虚拟机配置
--host-device=HOSTDEV 附加一个物理主机设备到客户机。HOSTDEV是随着libvirt使用的一个节点设备名(具体设备如’virsh nodedev-list’的显示的结果)
--accelerate KVM或KQEMU内核加速,这个选项是推荐最好加上。如果KVM和KQEMU都支持,KVM加速器优先使用。
-x EXTRA, --extra-args=EXTRA 当执行从"--location"选项指定位置的客户机安装时,附加内核命令行参数到安装程序
--nographics "virt-install" 将默认使用--vnc选项,使用nographics指定没有控制台被分配给客户机
3 安装
Use the virt-installtool to boot the virtual machine through libvirt and connect to the graphical console from a VNC client installed on your local machine.
3.1 查看default网络
[plain] view plain copy
1. # virsh net-list
2. Name State Autostart Persistent
3. ----------------------------------------------------------
4. default active yes yes
If the network is not active, start it by doing:
# virsh net-start default
Starting this network will create a Linux bridge (usually called virbr0), iptables rules, and a dnsmasq process that will serve as a DHCP server.
查看default网络的配置
[plain] view plain copy
1. root@zhaicompute# brctl show
2. bridge name bridge id STP enabled interfaces
3. virbr0 8000.5254000f5c96 yes virbr0-nic
4.
5. root@zhaicompute# ifconfig virbr0
6. virbr0 Link encap:Ethernet HWaddr 52:54:00:0f:5c:96
7. inet addr:192.168.22.1 Bcast:192.168.22.255 Mask:255.255.255.0
8. UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
9. RX packets:0 errors:0 dropped:0 overruns:0 frame:0
10. TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
11. collisions:0 txqueuelen:0
12. RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
13. root@zhaicompute# cat /etc/libvirt/qemu/networks/default.xml
14. <!--
15. WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
16. OVERWRITTEN AND LOST. Changes to this xml configuration should be made using:
17. virsh net-edit default
18. or other application using the libvirt API.
19. -->
20.
21. <network>
22. <name>default</name>
23. <uuid>6acb-ed0a-4ad1-b8dc-527168a2</uuid>
24. <forward mode='nat'/>
25. <bridge name='virbr0' stp='on' delay='0'/>
26. <mac address='52:33:00:0f:5c:96'/>
27. <ip address='192.168.22.1' netmask='255.255.255.0'>
28. <dhcp>
29. <range start='192.168.22.2' end='192.168.22.254'/>
30. </dhcp>
31. </ip>
32. </network>
default网络设置保存在/etc/libvirt/qemu/networks目录下,从配置中可看出具体的网桥virbr0.
3.2 qemu-img和virt-install
qemu-img command to create an empty image file
[plain] view plain copy
1. root@zhaicompute# qemu-img create -f qcow2 zhai-ubuntu14.04.4.qcow2 10G
2. Formatting 'zhai-ubuntu14.04.4.qcow2', fmt=qcow2 size=10737418240 encryption=off cluster_size=65536 lazy_refcounts=off refcount_bits=16
3. root@zhaicompute# ls
4. ubuntu-14.04.3-server-ppc64el.iso zhai-ubuntu14.04.4.qcow2
5. root@zhaicompute# qemu-img info zhai-ubuntu14.04.4.qcow2
6. image: zhai-ubuntu14.04.4.qcow2
7. file format: qcow2
8. virtual size: 10G (10737418240 bytes)
9. disk size: 196K
10. cluster_size: 65536
11. Format specific information:
12. compat: 1.1
13. lazy refcounts: false
14. refcount bits: 16
15. corrupt: false
virt-install command to start up a virtual machine using that image file.
命令行:
[plain] view plain copy
1. virt-install --virt-type kvm --name zhai-ubuntu --ram 1024 \
2. > --cdrom=/var/lib/libvirt/images/zhaipool/ubuntu-14.04.4-server-ppc64el.iso \
3. > --disk /var/lib/libvirt/images/zhaipool/zhai-ubuntu14.04.4.qcow2,format=qcow2 \
4. > --network network=default \
5. > --graphics vnc,listen=0.0.0.0 --noautoconsole \
6. > --os-type=linux --os-variant=ubuntutrusty
其中,--os-variant后面的值使用virt-install --os-variant list查看
[plain] view plain copy
1. root@zhaicompute# virt-install --os-variant list
2. win2k8 : Microsoft Windows Server 2008 (or later)
3. win2k3 : Microsoft Windows Server 2003
4. win7 : Microsoft Windows 7 (or later)
5. vista : Microsoft Windows Vista
6. winxp64 : Microsoft Windows XP (x86_64)
7. winxp : Microsoft Windows XP
8. win2k : Microsoft Windows 2000
9. openbsd4 : OpenBSD 4.x (or later)
10. freebsd9 : FreeBSD 9.x
11. freebsd8 : FreeBSD 8.x
12. freebsd7 : FreeBSD 7.x
13. freebsd6 : FreeBSD 6.x
14. freebsd10 : FreeBSD 10.x (or later)
15. solaris9 : Sun Solaris 9
16. solaris11 : Sun Solaris 11 (or later)
17. solaris10 : Sun Solaris 10
18. opensolaris : Sun OpenSolaris (or later)
19. netware6 : Novell Netware 6 (or later)
20. netware5 : Novell Netware 5
21. netware4 : Novell Netware 4
22. msdos : MS-DOS
23. generic : Generic
24. altlinux : ALT Linux (or later)
25. debianwheezy : Debian Wheezy (or later)
26. debiansqueeze : Debian Squeeze
27. debianlenny : Debian Lenny
28. debianetch : Debian Etch
29. fedora20 : Fedora 20 (or later)
30. fedora19 : Fedora 19
31. fedora18 : Fedora 18
32. fedora17 : Fedora 17
33. fedora16 : Fedora 16
34. fedora15 : Fedora 15
35. fedora14 : Fedora 14
36. fedora13 : Fedora 13
37. fedora12 : Fedora 12
38. fedora11 : Fedora 11
39. fedora10 : Fedora 10
40. fedora9 : Fedora 9
41. fedora8 : Fedora 8
42. fedora7 : Fedora 7
43. fedora6 : Fedora Core 6
44. fedora5 : Fedora Core 5
45. mes5.1 : Mandriva Enterprise Server 5.1 (or later)
46. mes5 : Mandriva Enterprise Server 5.0
47. mandriva2010 : Mandriva Linux 2010 (or later)
48. mandriva2009 : Mandriva Linux 2009 and earlier
49. mageia1 : Mageia 1 (or later)
50. rhel7 : Red Hat Enterprise Linux 7 (or later)
51. rhel6 : Red Hat Enterprise Linux 6
52. rhel5.4 : Red Hat Enterprise Linux 5.4 or later
53. rhel5 : Red Hat Enterprise Linux 5
54. rhel4 : Red Hat Enterprise Linux 4
55. rhel3 : Red Hat Enterprise Linux 3
56. rhel2.1 : Red Hat Enterprise Linux 2.1
57. sles11 : Suse Linux Enterprise Server 11 (or later)
58. sles10 : Suse Linux Enterprise Server
59. opensuse12 : openSuse 12 (or later)
60. opensuse11 : openSuse 11
61. ubuntuutopic : Ubuntu 14.10 (Utopic Unicorn) (or later)
62. ubuntutrusty : Ubuntu 14.04 LTS (Trusty Tahr)
63. ubuntusaucy : Ubuntu 13.10 (Saucy Salamander)
64. ubunturaring : Ubuntu 13.04 (Raring Ringtail)
65. ubuntuquantal : Ubuntu 12.10 (Quantal Quetzal)
66. ubuntuprecise : Ubuntu 12.04 LTS (Precise Pangolin)
67. ubuntuoneiric : Ubuntu 11.10 (Oneiric Ocelot)
68. ubuntunatty : Ubuntu 11.04 (Natty Narwhal)
69. ubuntumaverick : Ubuntu 10.10 (Maverick Meerkat)
70. ubuntulucid : Ubuntu 10.04 LTS (Lucid Lynx)
71. ubuntukarmic : Ubuntu 9.10 (Karmic Koala)
72. ubuntujaunty : Ubuntu 9.04 (Jaunty Jackalope)
73. ubuntuintrepid : Ubuntu 8.10 (Intrepid Ibex)
74. ubuntuhardy : Ubuntu 8.04 LTS (Hardy Heron)
75. mbs1 : Mandriva Business Server 1 (or later)
76. virtio26 : Generic 2.6.25 or later kernel with virtio
77. generic26 : Generic 2.6.x kernel
78. generic24 : Generic 2.4.x kernel
执行过程:
[plain] view plain copy
1. root@zhaicompute# virt-install --virt-type kvm --name zhai-ubuntu --ram 1024 \
2. > --cdrom=/var/lib/libvirt/images/zhaipool/ubuntu-14.04.4-server-ppc64el.iso \
3. > --disk /var/lib/libvirt/images/zhaipool/zhai-ubuntu14.04.4.qcow2,format=qcow2 \
4. > --network network=default \
5. > --graphics vnc,listen=0.0.0.0 --noautoconsole \
6. > --os-type=linux --os-variant=ubuntutrusty
7.
8.
9. Starting install...
10. Creating domain... | 0 B 00:00
11. Domain installation still in progress. You can reconnect to
12. the console to complete the installation process.
13. root@zhaicompute# ps -ef | grep zhai
14. libvirt+ 27531 1 99 03:39 ? 00:00:22 qemu-system-ppc64 -enable-kvm -name zhai-ubuntu -S -machine pseries-2.3,accel=kvm,usb=off -m 1024 -realtime mlock=off -smp 1,sockets=1,cores=1,threads=1 -uuid de480a35-4ab5-42e5-b3b6-a47c8b05d9c8 -no-user-config -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/zhai-ubuntu.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-reboot -boot strict=on -device pci-ohci,id=usb,bus=pci.0,addr=0x2 -device spapr-vscsi,id=scsi0,reg=0x2000 -drive file=/var/lib/libvirt/images/zhaipool/zhai-ubuntu14.04.4.qcow2,if=none,id=drive-scsi0-0-0-0,format=qcow2 -device scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0-0-0-0,id=scsi0-0-0-0,bootindex=2 -drive file=/var/lib/libvirt/images/zhaipool/ubuntu-14.04.4-server-ppc64el.iso,if=none,id=drive-scsi0-0-0-1,readonly=on,format=raw -device scsi-cd,bus=scsi0.0,channel=0,scsi-id=0,lun=1,drive=drive-scsi0-0-0-1,id=scsi0-0-0-1,bootindex=1 -netdev tap,fd=29,id=hostnet0 -device rtl8139,netdev=hostnet0,id=net0,mac=52:54:00:cb:ad:fa,bus=pci.0,addr=0x1 -chardev pty,id=charserial0 -device spapr-vty,chardev=charserial0,reg=0x30000000 -device usb-kbd,id=input0 -device usb-mouse,id=input1 -vnc 0.0.0.0:2 -device VGA,id=video0,vgamem_mb=16,bus=pci.0,addr=0x4 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 -msg timestamp=on
15. root 27540 23850 0 03:40 pts/8 00:00:00 grep --color=auto zhai
从上看出:virt-install执行后,最终调用的是qemu-system-ppc64命令来创建vm。
一个虚拟机占用一个进程,可以通过进程管理和控制虚拟机。
log日志:
[plain] view plain copy
- root@zhaicompute# ls /var/log/libvirt/qemu/
- zhai-ubuntu.log
创建后,查看网络:
[plain] view plain copy
1. root@zhaicompute# brctl show
2. bridge name bridge id STP enabled interfaces
3. virbr0 8000.5254000f5c96 yes virbr0-nic
4. vnet0
可看出
virbr0上多了一下端口vnet0.
[plain] view plain copy
1. virbr0 Link encap:Ethernet HWaddr 52:54:00:0f:5c:96
2. inet addr:192.168.122.1 Bcast:192.168.122.255 Mask:255.255.255.0
3. UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
4. RX packets:10646 errors:0 dropped:0 overruns:0 frame:0
5. TX packets:14645 errors:0 dropped:0 overruns:0 carrier:0
6. collisions:0 txqueuelen:0
7. RX bytes:617571 (617.5 KB) TX bytes:20396983 (20.3 MB)
8.
9. virbr0-nic Link encap:Ethernet HWaddr 52:54:00:0f:5c:96
10. BROADCAST MULTICAST MTU:1500 Metric:1
11. RX packets:0 errors:0 dropped:0 overruns:0 frame:0
12. TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
13. collisions:0 txqueuelen:500
14. RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
15.
16. vnet0 Link encap:Ethernet HWaddr fe:54:00:7e:60:d0
17. inet6 addr: fe80::fc54:ff:fe7e:60d0/64 Scope:Link
18. UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
19. RX packets:10646 errors:0 dropped:0 overruns:0 frame:0
20. TX packets:17480 errors:0 dropped:0 overruns:0 carrier:0
21. collisions:0 txqueuelen:500
22. RX bytes:766615 (766.6 KB) TX bytes:20544635 (20.5 MB)
查看生成的xml配置文件 :
[plain] view plain copy
1. # ls -lrt /etc/libvirt/qemu
2. -rw------- 1 root root 2511 Apr 15 11:25 zhai-ubuntu.xml
zhai-ubuntu.xml内容:
[plain] view plain copy
1. # cat /etc/libvirt/qemu/zhai-ubuntu.xml
2. <!--
3. WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
4. OVERWRITTEN AND LOST. Changes to this xml configuration should be made using:
5. virsh edit zhai-ubuntu
6. or other application using the libvirt API.
7. -->
8.
9. <domain type='kvm'>
10. <name>zhai-ubuntu</name>
11. <uuid>0e5684f5-23aa-8568-ed10-52c844b4d85d</uuid>
12. <memory unit='KiB'>1048576</memory>
13. <currentMemory unit='KiB'>1048576</currentMemory>
14. <vcpu placement='static'>2</vcpu>
15. <os>
16. <type arch='ppc64le' machine='pseries-2.3'>hvm</type>
17. <boot dev='cdrom'/>
18. <boot dev='hd'/>
19. <bootmenu enable='yes'/>
20. </os>
21. <features>
22. <acpi/>
23. <apic/>
24. <pae/>
25. </features>
26. <clock offset='utc'/>
27. <on_poweroff>destroy</on_poweroff>
28. <on_reboot>restart</on_reboot>
29. <on_crash>restart</on_crash>
30. <devices>
31. <emulator>/usr/bin/kvm</emulator>
32. <disk type='file' device='disk'>
33. <driver name='qemu' type='qcow2' cache='none'/>
34. <source file='/var/lib/libvirt/images/zhaipool/zhai-ubuntu14.04.4.qcow2'/>
35. <target dev='vda' bus='virtio'/>
36. <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
37. </disk>
38. <disk type='file' device='disk'>
39. <driver name='qemu' type='raw' cache='none'/>
40. <source file='/var/lib/libvirt/images/zhaipool/ubuntu-14.04.4-server-ppc64el.iso'/>
41. <target dev='sda' bus='usb'/>
42. </disk>
43. <controller type='usb' index='0'>
44. <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
45. </controller>
46. <controller type='pci' index='0' model='pci-root'/>
47. <interface type='network'>
48. <mac address='52:54:00:7e:60:d0'/>
49. <source network='default'/>
50. <model type='virtio'/>
51. <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
52. </interface>
53. <serial type='pty'>
54. <target port='0'/>
55. <address type='spapr-vio' reg='0x30000000'/>
56. </serial>
57. <console type='pty'>
58. <target type='serial' port='0'/>
59. <address type='spapr-vio' reg='0x30000000'/>
60. </console>
61. <input type='tablet' bus='usb'/>
62. <input type='keyboard' bus='usb'/>
63. <input type='mouse' bus='usb'/>
64. <graphics type='vnc' port='-1' autoport='yes'/>
65. <video>
66. <model type='vga' vram='16384' heads='1'/>
67. <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
68. </video>
69. <memballoon model='virtio'>
70. <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
71. </memballoon>
72. </devices>
73. </domain>
基于KVM建立的虚拟机相关文件默认存放位置
kvm虚拟机配置文件位置/etc/libvirt/qemu/ <---都是xml文件
kvm虚拟机文件位置:/var/lib/libvirt/images/ <---可以在建立虚拟机时指定
建立的虚拟机在运行时相关文件及存放位置
在虚拟机运行时,会在/var/run/libvirt/qemu目录下存放虚拟机的pid文件和配置文件,配置文件与/etc/libvirt/qemu目录下对应的虚拟机文件相同,pid文件保存有此虚拟机进程号。虚拟机的日志文件存放在/var/log/libvirt/qemu目录下,每个虚拟机一个,文件名称为:虚拟机名称(或UUID)+“.log”
virt-install在生产虚拟机的最后调用virt-viewer打开虚拟机图形界面
,进行操作系统的安装,可以通过vnc或者virt-manager打开虚拟机图形界面,继续完成guest操作系统的安装即可。
3.3 virsh vncdisplay命令
Use the virsh vncdisplay vm-name command to get the VNC port number.
[plain] view plain copy
1. root@zhaicompute# virsh vncdisplay zhai-ubuntu
2. :2
3. root@zhaicompute# ps -ef | grep vnc
4. libvirt+ 27531 1 99 03:39 ? 00:09:35 qemu-system-ppc64 -enable-kvm -name zhai-ubuntu -S -machine pseries-2.3,accel=kvm,usb=off -m 1024 -realtime mlock=off -smp 1,sockets=1,cores=1,threads=1 -uuid de480a35-4ab5-42e5-b3b6-a47c8b05d9c8 -no-user-config -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/zhai-ubuntu.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-reboot -boot strict=on -device pci-ohci,id=usb,bus=pci.0,addr=0x2 -device spapr-vscsi,id=scsi0,reg=0x2000 -drive file=/var/lib/libvirt/images/zhaipool/zhai-ubuntu14.04.4.qcow2,if=none,id=drive-scsi0-0-0-0,format=qcow2 -device scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0-0-0-0,id=scsi0-0-0-0,bootindex=2 -drive file=/var/lib/libvirt/images/zhaipool/ubuntu-14.04.4-server-ppc64el.iso,if=none,id=drive-scsi0-0-0-1,readonly=on,format=raw -device scsi-cd,bus=scsi0.0,channel=0,scsi-id=0,lun=1,drive=drive-scsi0-0-0-1,id=scsi0-0-0-1,bootindex=1 -netdev tap,fd=29,id=hostnet0 -device rtl8139,netdev=hostnet0,id=net0,mac=52:54:00:cb:ad:fa,bus=pci.0,addr=0x1 -chardev pty,id=charserial0 -device spapr-vty,chardev=charserial0,reg=0x30000000 -device usb-kbd,id=input0 -device usb-mouse,id=input1 -vnc 0.0.0.0:2 -device VGA,id=video0,vgamem_mb=16,bus=pci.0,addr=0x4 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 -msg timestamp=on
3.4 在本机上使用vncviewer或tigervnc连接
qemu不使用Linux下的vncserver提供vnc服务,因此在此服务没有启动的情况下,也能通过vnc客户端连接到虚拟机。
在win7下,打开vnc-viewer,输入virt-install命令所在的服务器IP与所安装的虚拟机据点用的vnc端口号0;
点击“OK”,进入安装界面
virsh start vm-name启动此虚拟机:
[html] view plain copy
1. root@ctler:~# virsh list --all
2. Id Name State
3. ----------------------------------------------------
4. - net shut off
5.
6. root@ctler:~# virsh start net
7. Domain net started
8.
9. root@ctler:~# virsh list --all
10. Id Name State
11. ----------------------------------------------------
12. 5 net running
在linux下:
安装完成后,登录虚机,查看IP
4 本地安装示例
给guest主机划分物理机分区
lvcreate -L20G -n host.demo.com kvm-storage
下载镜像并loop到本地:
wget http://mirrors.manchester.icecolo.com/centos/5.5/isos/x86_64/CentOS-5.5-x86_64-bin-1of8.iso
mkdir /mnt/centos55
mount -o loop CentOS-5.5-x86_64-bin-1of8.iso /mnt/centos55/ 通过location本地安装,并通过console管理:
virt-install
-n host.demo.com
-r 512
--vcpus=1
--os-variant=rhel5.4
--accelerate
--nographics
-v
-l /mnt/centos55/
-w bridge:br1
--disk path=/dev/kvm-storage/host.demo.com
-x "console=ttyS0"
管理时可以通过
#查看guest id、name 及状态
virsh list --all
#通过console连接查看
virsh console id或name
#连接完成后会要求输入用户名和密码
5 virt-manager图形安装
通过图形向导界面也可以完成安装,virt-manager可以通过在终端中输入virt-manager或者从菜单应用程序->系统工具中打开。
参考:
1 virt-install 使用说明: http://blog.csdn.NET/starshine/article/details/6998189
2 kvm, qemu-kvm以及libvirt之间的关系图:http://blog.csdn.net/zhaihaifei/article/details/51018113
3 kvm虚拟化之virt-install: http://www.361way.com/virt-install/2721.html
4 kvm显示VM的IP:http://www.chengxuyuans.com/Unix/83251.html
5 virbr0: http://blog.chinaunix.Net/uid-26000137-id-3723948.html
1 ubuntu下安装: apt-get install virtinst
[plain] view plain copy
1. # apt-get install virtinst
2. Reading package lists... Done
3. Building dependency tree
4. Reading state information... Done
5. The following extra packages will be installed:
6. adwaita-icon-theme at-spi2-core colord colord-data dconf-gsettings-backend dconf-service fontconfig fontconfig-config
7. fonts-dejavu-core glib-networking glib-networking-common glib-networking-services gsettings-desktop-schemas hicolor-icon-theme
8. ...
9. libxinerama1 libxkbcommon0 libxpm4 libxrandr2 libxrender1 libxtst6 python-libxml2 python-pycurl python-urlgrabber ubuntu-mono
10. virt-viewer x11-common
11. Suggested packages:
12. colord-sensor-argyll cups-common libgd-tools gphoto2 gvfs liblcms2-utils librsvg2-bin avahi-daemon hplip libsane-extras
13. sane-utils python-pycurl-dbg python-pycurl-doc
14. ...
2 virt-install常用参数
-n --name= 客户端虚拟机名称
-r --ram= 客户端虚拟机分配的内存
-u --uuid= 客户端UUID 默认不写时,系统会自动生成
--vcpus= 客户端的vcpu个数
-v --hvm 全虚拟化
-p --paravirt 半虚拟化
-l --location=localdir 安装源,有本地、nfs、http、ftp几种,多用于ks网络安装
--vnc 使用vnc ,另有--vnclient=监听的IP --vncport =VNC监听的端口
-c --cdrom= 光驱 安装途径
--disk= 使用不同选项作为磁盘使用安装介质
-w NETWORK, --network=NETWORK 连接客户机到主机网络
-s --file-size= 使用磁盘映像的大小 单位为GB
-f --file= 作为磁盘映像使用的文件
--cpuset=设置哪个物理CPU能够被虚拟机使用
--os-type=OS_TYPE 针对一类操作系统优化虚拟机配置(例如:‘linux’,‘windows’)
--os-variant=OS_VARIANT 针对特定操作系统变体(例如’rhel6’, ’winxp’,'win2k3')进一步优化虚拟机配置
--host-device=HOSTDEV 附加一个物理主机设备到客户机。HOSTDEV是随着libvirt使用的一个节点设备名(具体设备如’virsh nodedev-list’的显示的结果)
--accelerate KVM或KQEMU内核加速,这个选项是推荐最好加上。如果KVM和KQEMU都支持,KVM加速器优先使用。
-x EXTRA, --extra-args=EXTRA 当执行从"--location"选项指定位置的客户机安装时,附加内核命令行参数到安装程序
--nographics "virt-install" 将默认使用--vnc选项,使用nographics指定没有控制台被分配给客户机
3 安装
Use the virt-installtool to boot the virtual machine through libvirt and connect to the graphical console from a VNC client installed on your local machine.
3.1 查看default网络
[plain] view plain copy
1. # virsh net-list
2. Name State Autostart Persistent
3. ----------------------------------------------------------
4. default active yes yes
If the network is not active, start it by doing:
# virsh net-start default
Starting this network will create a Linux bridge (usually called virbr0), iptables rules, and a dnsmasq process that will serve as a DHCP server.
查看default网络的配置
[plain] view plain copy
1. root@zhaicompute# brctl show
2. bridge name bridge id STP enabled interfaces
3. virbr0 8000.5254000f5c96 yes virbr0-nic
4.
5. root@zhaicompute# ifconfig virbr0
6. virbr0 Link encap:Ethernet HWaddr 52:54:00:0f:5c:96
7. inet addr:192.168.22.1 Bcast:192.168.22.255 Mask:255.255.255.0
8. UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
9. RX packets:0 errors:0 dropped:0 overruns:0 frame:0
10. TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
11. collisions:0 txqueuelen:0
12. RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
13. root@zhaicompute# cat /etc/libvirt/qemu/networks/default.xml
14. <!--
15. WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
16. OVERWRITTEN AND LOST. Changes to this xml configuration should be made using:
17. virsh net-edit default
18. or other application using the libvirt API.
19. -->
20.
21. <network>
22. <name>default</name>
23. <uuid>6acb-ed0a-4ad1-b8dc-527168a2</uuid>
24. <forward mode='nat'/>
25. <bridge name='virbr0' stp='on' delay='0'/>
26. <mac address='52:33:00:0f:5c:96'/>
27. <ip address='192.168.22.1' netmask='255.255.255.0'>
28. <dhcp>
29. <range start='192.168.22.2' end='192.168.22.254'/>
30. </dhcp>
31. </ip>
32. </network>
default网络设置保存在/etc/libvirt/qemu/networks目录下,从配置中可看出具体的网桥virbr0.
3.2 qemu-img和virt-install
qemu-img command to create an empty image file
[plain] view plain copy
1. root@zhaicompute# qemu-img create -f qcow2 zhai-ubuntu14.04.4.qcow2 10G
2. Formatting 'zhai-ubuntu14.04.4.qcow2', fmt=qcow2 size=10737418240 encryption=off cluster_size=65536 lazy_refcounts=off refcount_bits=16
3. root@zhaicompute# ls
4. ubuntu-14.04.3-server-ppc64el.iso zhai-ubuntu14.04.4.qcow2
5. root@zhaicompute# qemu-img info zhai-ubuntu14.04.4.qcow2
6. image: zhai-ubuntu14.04.4.qcow2
7. file format: qcow2
8. virtual size: 10G (10737418240 bytes)
9. disk size: 196K
10. cluster_size: 65536
11. Format specific information:
12. compat: 1.1
13. lazy refcounts: false
14. refcount bits: 16
15. corrupt: false
virt-install command to start up a virtual machine using that image file.
命令行:
[plain] view plain copy
1. virt-install --virt-type kvm --name zhai-ubuntu --ram 1024 \
2. > --cdrom=/var/lib/libvirt/images/zhaipool/ubuntu-14.04.4-server-ppc64el.iso \
3. > --disk /var/lib/libvirt/images/zhaipool/zhai-ubuntu14.04.4.qcow2,format=qcow2 \
4. > --network network=default \
5. > --graphics vnc,listen=0.0.0.0 --noautoconsole \
6. > --os-type=linux --os-variant=ubuntutrusty
其中,--os-variant后面的值使用virt-install --os-variant list查看
[plain] view plain copy
1. root@zhaicompute# virt-install --os-variant list
2. win2k8 : Microsoft Windows Server 2008 (or later)
3. win2k3 : Microsoft Windows Server 2003
4. win7 : Microsoft Windows 7 (or later)
5. vista : Microsoft Windows Vista
6. winxp64 : Microsoft Windows XP (x86_64)
7. winxp : Microsoft Windows XP
8. win2k : Microsoft Windows 2000
9. openbsd4 : OpenBSD 4.x (or later)
10. freebsd9 : FreeBSD 9.x
11. freebsd8 : FreeBSD 8.x
12. freebsd7 : FreeBSD 7.x
13. freebsd6 : FreeBSD 6.x
14. freebsd10 : FreeBSD 10.x (or later)
15. solaris9 : Sun Solaris 9
16. solaris11 : Sun Solaris 11 (or later)
17. solaris10 : Sun Solaris 10
18. opensolaris : Sun OpenSolaris (or later)
19. netware6 : Novell Netware 6 (or later)
20. netware5 : Novell Netware 5
21. netware4 : Novell Netware 4
22. msdos : MS-DOS
23. generic : Generic
24. altlinux : ALT Linux (or later)
25. debianwheezy : Debian Wheezy (or later)
26. debiansqueeze : Debian Squeeze
27. debianlenny : Debian Lenny
28. debianetch : Debian Etch
29. fedora20 : Fedora 20 (or later)
30. fedora19 : Fedora 19
31. fedora18 : Fedora 18
32. fedora17 : Fedora 17
33. fedora16 : Fedora 16
34. fedora15 : Fedora 15
35. fedora14 : Fedora 14
36. fedora13 : Fedora 13
37. fedora12 : Fedora 12
38. fedora11 : Fedora 11
39. fedora10 : Fedora 10
40. fedora9 : Fedora 9
41. fedora8 : Fedora 8
42. fedora7 : Fedora 7
43. fedora6 : Fedora Core 6
44. fedora5 : Fedora Core 5
45. mes5.1 : Mandriva Enterprise Server 5.1 (or later)
46. mes5 : Mandriva Enterprise Server 5.0
47. mandriva2010 : Mandriva Linux 2010 (or later)
48. mandriva2009 : Mandriva Linux 2009 and earlier
49. mageia1 : Mageia 1 (or later)
50. rhel7 : Red Hat Enterprise Linux 7 (or later)
51. rhel6 : Red Hat Enterprise Linux 6
52. rhel5.4 : Red Hat Enterprise Linux 5.4 or later
53. rhel5 : Red Hat Enterprise Linux 5
54. rhel4 : Red Hat Enterprise Linux 4
55. rhel3 : Red Hat Enterprise Linux 3
56. rhel2.1 : Red Hat Enterprise Linux 2.1
57. sles11 : Suse Linux Enterprise Server 11 (or later)
58. sles10 : Suse Linux Enterprise Server
59. opensuse12 : openSuse 12 (or later)
60. opensuse11 : openSuse 11
61. ubuntuutopic : Ubuntu 14.10 (Utopic Unicorn) (or later)
62. ubuntutrusty : Ubuntu 14.04 LTS (Trusty Tahr)
63. ubuntusaucy : Ubuntu 13.10 (Saucy Salamander)
64. ubunturaring : Ubuntu 13.04 (Raring Ringtail)
65. ubuntuquantal : Ubuntu 12.10 (Quantal Quetzal)
66. ubuntuprecise : Ubuntu 12.04 LTS (Precise Pangolin)
67. ubuntuoneiric : Ubuntu 11.10 (Oneiric Ocelot)
68. ubuntunatty : Ubuntu 11.04 (Natty Narwhal)
69. ubuntumaverick : Ubuntu 10.10 (Maverick Meerkat)
70. ubuntulucid : Ubuntu 10.04 LTS (Lucid Lynx)
71. ubuntukarmic : Ubuntu 9.10 (Karmic Koala)
72. ubuntujaunty : Ubuntu 9.04 (Jaunty Jackalope)
73. ubuntuintrepid : Ubuntu 8.10 (Intrepid Ibex)
74. ubuntuhardy : Ubuntu 8.04 LTS (Hardy Heron)
75. mbs1 : Mandriva Business Server 1 (or later)
76. virtio26 : Generic 2.6.25 or later kernel with virtio
77. generic26 : Generic 2.6.x kernel
78. generic24 : Generic 2.4.x kernel
执行过程:
[plain] view plain copy
1. root@zhaicompute# virt-install --virt-type kvm --name zhai-ubuntu --ram 1024 \
2. > --cdrom=/var/lib/libvirt/images/zhaipool/ubuntu-14.04.4-server-ppc64el.iso \
3. > --disk /var/lib/libvirt/images/zhaipool/zhai-ubuntu14.04.4.qcow2,format=qcow2 \
4. > --network network=default \
5. > --graphics vnc,listen=0.0.0.0 --noautoconsole \
6. > --os-type=linux --os-variant=ubuntutrusty
7.
8.
9. Starting install...
10. Creating domain... | 0 B 00:00
11. Domain installation still in progress. You can reconnect to
12. the console to complete the installation process.
13. root@zhaicompute# ps -ef | grep zhai
14. libvirt+ 27531 1 99 03:39 ? 00:00:22 qemu-system-ppc64 -enable-kvm -name zhai-ubuntu -S -machine pseries-2.3,accel=kvm,usb=off -m 1024 -realtime mlock=off -smp 1,sockets=1,cores=1,threads=1 -uuid de480a35-4ab5-42e5-b3b6-a47c8b05d9c8 -no-user-config -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/zhai-ubuntu.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-reboot -boot strict=on -device pci-ohci,id=usb,bus=pci.0,addr=0x2 -device spapr-vscsi,id=scsi0,reg=0x2000 -drive file=/var/lib/libvirt/images/zhaipool/zhai-ubuntu14.04.4.qcow2,if=none,id=drive-scsi0-0-0-0,format=qcow2 -device scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0-0-0-0,id=scsi0-0-0-0,bootindex=2 -drive file=/var/lib/libvirt/images/zhaipool/ubuntu-14.04.4-server-ppc64el.iso,if=none,id=drive-scsi0-0-0-1,readonly=on,format=raw -device scsi-cd,bus=scsi0.0,channel=0,scsi-id=0,lun=1,drive=drive-scsi0-0-0-1,id=scsi0-0-0-1,bootindex=1 -netdev tap,fd=29,id=hostnet0 -device rtl8139,netdev=hostnet0,id=net0,mac=52:54:00:cb:ad:fa,bus=pci.0,addr=0x1 -chardev pty,id=charserial0 -device spapr-vty,chardev=charserial0,reg=0x30000000 -device usb-kbd,id=input0 -device usb-mouse,id=input1 -vnc 0.0.0.0:2 -device VGA,id=video0,vgamem_mb=16,bus=pci.0,addr=0x4 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 -msg timestamp=on
15. root 27540 23850 0 03:40 pts/8 00:00:00 grep --color=auto zhai
从上看出:virt-install执行后,最终调用的是qemu-system-ppc64命令来创建vm。
一个虚拟机占用一个进程,可以通过进程管理和控制虚拟机。
log日志:
[plain] view plain copy
1. root@zhaicompute# ls /var/log/libvirt/qemu/
2. zhai-ubuntu.log
创建后,查看网络:
[plain] view plain copy
1. root@zhaicompute# brctl show
2. bridge name bridge id STP enabled interfaces
3. virbr0 8000.5254000f5c96 yes virbr0-nic
4.
- vnet0
可看出
virbr0上多了一下端口vnet0.
[plain] view plain copy
1. virbr0 Link encap:Ethernet HWaddr 52:54:00:0f:5c:96
2. inet addr:192.168.122.1 Bcast:192.168.122.255 Mask:255.255.255.0
3. UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
4. RX packets:10646 errors:0 dropped:0 overruns:0 frame:0
5. TX packets:14645 errors:0 dropped:0 overruns:0 carrier:0
6. collisions:0 txqueuelen:0
7. RX bytes:617571 (617.5 KB) TX bytes:20396983 (20.3 MB)
8.
9. virbr0-nic Link encap:Ethernet HWaddr 52:54:00:0f:5c:96
10. BROADCAST MULTICAST MTU:1500 Metric:1
11. RX packets:0 errors:0 dropped:0 overruns:0 frame:0
12. TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
13. collisions:0 txqueuelen:500
14. RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
15.
16. vnet0 Link encap:Ethernet HWaddr fe:54:00:7e:60:d0
17. inet6 addr: fe80::fc54:ff:fe7e:60d0/64 Scope:Link
18. UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
19. RX packets:10646 errors:0 dropped:0 overruns:0 frame:0
20. TX packets:17480 errors:0 dropped:0 overruns:0 carrier:0
21. collisions:0 txqueuelen:500
22. RX bytes:766615 (766.6 KB) TX bytes:20544635 (20.5 MB)
查看生成的xml配置文件 :
[plain] view plain copy
1. # ls -lrt /etc/libvirt/qemu
2. -rw------- 1 root root 2511 Apr 15 11:25 zhai-ubuntu.xml
zhai-ubuntu.xml内容:
[plain] view plain copy
1. # cat /etc/libvirt/qemu/zhai-ubuntu.xml
2. <!--
3. WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT ARE LIKELY TO BE
4. OVERWRITTEN AND LOST. Changes to this xml configuration should be made using:
5. virsh edit zhai-ubuntu
6. or other application using the libvirt API.
7. -->
8.
9. <domain type='kvm'>
10. <name>zhai-ubuntu</name>
11. <uuid>0e5684f5-23aa-8568-ed10-52c844b4d85d</uuid>
12. <memory unit='KiB'>1048576</memory>
13. <currentMemory unit='KiB'>1048576</currentMemory>
14. <vcpu placement='static'>2</vcpu>
15. <os>
16. <type arch='ppc64le' machine='pseries-2.3'>hvm</type>
17. <boot dev='cdrom'/>
18. <boot dev='hd'/>
19. <bootmenu enable='yes'/>
20. </os>
21. <features>
22. <acpi/>
23. <apic/>
24. <pae/>
25. </features>
26. <clock offset='utc'/>
27. <on_poweroff>destroy</on_poweroff>
28. <on_reboot>restart</on_reboot>
29. <on_crash>restart</on_crash>
30. <devices>
31. <emulator>/usr/bin/kvm</emulator>
32. <disk type='file' device='disk'>
33. <driver name='qemu' type='qcow2' cache='none'/>
34. <source file='/var/lib/libvirt/images/zhaipool/zhai-ubuntu14.04.4.qcow2'/>
35. <target dev='vda' bus='virtio'/>
36. <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
37. </disk>
38. <disk type='file' device='disk'>
39. <driver name='qemu' type='raw' cache='none'/>
40. <source file='/var/lib/libvirt/images/zhaipool/ubuntu-14.04.4-server-ppc64el.iso'/>
41. <target dev='sda' bus='usb'/>
42. </disk>
43. <controller type='usb' index='0'>
44. <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
45. </controller>
46. <controller type='pci' index='0' model='pci-root'/>
47. <interface type='network'>
48. <mac address='52:54:00:7e:60:d0'/>
49. <source network='default'/>
50. <model type='virtio'/>
51. <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
52. </interface>
53. <serial type='pty'>
54. <target port='0'/>
55. <address type='spapr-vio' reg='0x30000000'/>
56. </serial>
57. <console type='pty'>
58. <target type='serial' port='0'/>
59. <address type='spapr-vio' reg='0x30000000'/>
60. </console>
61. <input type='tablet' bus='usb'/>
62. <input type='keyboard' bus='usb'/>
63. <input type='mouse' bus='usb'/>
64. <graphics type='vnc' port='-1' autoport='yes'/>
65. <video>
66. <model type='vga' vram='16384' heads='1'/>
67. <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
68. </video>
69. <memballoon model='virtio'>
70. <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
71. </memballoon>
72. </devices>
73. </domain>
基于KVM建立的虚拟机相关文件默认存放位置
kvm虚拟机配置文件位置/etc/libvirt/qemu/ <---都是xml文件
kvm虚拟机文件位置:/var/lib/libvirt/images/ <---可以在建立虚拟机时指定
建立的虚拟机在运行时相关文件及存放位置
在虚拟机运行时,会在/var/run/libvirt/qemu目录下存放虚拟机的pid文件和配置文件,配置文件与/etc/libvirt/qemu目录下对应的虚拟机文件相同,pid文件保存有此虚拟机进程号。虚拟机的日志文件存放在/var/log/libvirt/qemu目录下,每个虚拟机一个,文件名称为:虚拟机名称(或UUID)+“.log”
virt-install在生产虚拟机的最后调用virt-viewer打开虚拟机图形界面
,进行操作系统的安装,可以通过vnc或者virt-manager打开虚拟机图形界面,继续完成guest操作系统的安装即可。
3.3 virsh vncdisplay命令
Use the virsh vncdisplay vm-name command to get the VNC port number.
[plain] view plain copy
1. root@zhaicompute# virsh vncdisplay zhai-ubuntu
2. :2
3. root@zhaicompute# ps -ef | grep vnc
4. libvirt+ 27531 1 99 03:39 ? 00:09:35 qemu-system-ppc64 -enable-kvm -name zhai-ubuntu -S -machine pseries-2.3,accel=kvm,usb=off -m 1024 -realtime mlock=off -smp 1,sockets=1,cores=1,threads=1 -uuid de480a35-4ab5-42e5-b3b6-a47c8b05d9c8 -no-user-config -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/zhai-ubuntu.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-reboot -boot strict=on -device pci-ohci,id=usb,bus=pci.0,addr=0x2 -device spapr-vscsi,id=scsi0,reg=0x2000 -drive file=/var/lib/libvirt/images/zhaipool/zhai-ubuntu14.04.4.qcow2,if=none,id=drive-scsi0-0-0-0,format=qcow2 -device scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=0,drive=drive-scsi0-0-0-0,id=scsi0-0-0-0,bootindex=2 -drive file=/var/lib/libvirt/images/zhaipool/ubuntu-14.04.4-server-ppc64el.iso,if=none,id=drive-scsi0-0-0-1,readonly=on,format=raw -device scsi-cd,bus=scsi0.0,channel=0,scsi-id=0,lun=1,drive=drive-scsi0-0-0-1,id=scsi0-0-0-1,bootindex=1 -netdev tap,fd=29,id=hostnet0 -device rtl8139,netdev=hostnet0,id=net0,mac=52:54:00:cb:ad:fa,bus=pci.0,addr=0x1 -chardev pty,id=charserial0 -device spapr-vty,chardev=charserial0,reg=0x30000000 -device usb-kbd,id=input0 -device usb-mouse,id=input1 -vnc 0.0.0.0:2 -device VGA,id=video0,vgamem_mb=16,bus=pci.0,addr=0x4 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 -msg timestamp=on
3.4 在本机上使用vncviewer或tigervnc连接
qemu不使用Linux下的vncserver提供vnc服务,因此在此服务没有启动的情况下,也能通过vnc客户端连接到虚拟机。
在win7下,打开vnc-viewer,输入virt-install命令所在的服务器IP与所安装的虚拟机据点用的vnc端口号0;
点击“OK”,进入安装界面
virsh start vm-name启动此虚拟机:
[html] view plain copy
1. root@ctler:~# virsh list --all
2. Id Name State
3. ----------------------------------------------------
4. - net shut off
5.
6. root@ctler:~# virsh start net
7. Domain net started
8.
9. root@ctler:~# virsh list --all
10. Id Name State
11. ----------------------------------------------------
12. 5 net running
在linux下:
安装完成后,登录虚机,查看IP
4 本地安装示例
给guest主机划分物理机分区
lvcreate -L20G -n host.demo.com kvm-storage
下载镜像并loop到本地:
wget http://mirrors.manchester.icecolo.com/centos/5.5/isos/x86_64/CentOS-5.5-x86_64-bin-1of8.iso
mkdir /mnt/centos55
mount -o loop CentOS-5.5-x86_64-bin-1of8.iso /mnt/centos55/
通过location本地安装,并通过console管理:
virt-install
-n host.demo.com
-r 512
--vcpus=1
--os-variant=rhel5.4
--accelerate
--nographics
-v
-l /mnt/centos55/
-w bridge:br1
--disk path=/dev/kvm-storage/host.demo.com
-x "console=ttyS0"
管理时可以通过
#查看guest id、name 及状态
virsh list --all
#通过console连接查看
virsh console id或name
#连接完成后会要求输入用户名和密码
5 virt-manager图形安装
通过图形向导界面也可以完成安装,virt-manager可以通过在终端中输入virt-manager或者从菜单应用程序->系统工具中打开。
参考:
1 virt-install 使用说明: http://blog.csdn.NET/starshine/article/details/6998189
2 kvm, qemu-kvm以及libvirt之间的关系图:http://blog.csdn.net/zhaihaifei/article/details/51018113
3 kvm虚拟化之virt-install: http://www.361way.com/virt-install/2721.html
4 kvm显示VM的IP:http://www.chengxuyuans.com/Unix/83251.html
5 virbr0: http://blog.chinaunix.Net/uid-26000137-id-3723948.html