基本概念
Driver capabilities XML format
virsh # capabilities
<capabilities>
<host>
<cpu>
<arch>i686</arch>
<model>n270</model>
<topology sockets='1' cores='2' threads='1'/>
<feature name='lahf_lm'/>
<feature name='lm'/>
<feature name='xtpr'/>
<feature name='cx16'/>
<feature name='tm2'/>
<feature name='est'/>
<feature name='vmx'/>
<feature name='ds_cpl'/>
<feature name='pbe'/>
<feature name='tm'/>
<feature name='ht'/>
<feature name='ss'/>
<feature name='acpi'/>
<feature name='ds'/>
<feature name='pse36'/>
</cpu>
<migration_features>
<live/>
<uri_transports>
<uri_transport>tcp</uri_transport>
</uri_transports>
</migration_features>
<secmodel>
<model>apparmor</model>
<doi></doi>
</secmodel>
</host>
<guest>
<os_type>hvm</os_type>
<arch name='i686'>
<wordsize>32</wordsize>
<emulator>/usr/bin/qemu</emulator>
<machine>pc-0.12</machine>
<machine canonical='pc-0.12'>pc</machine>
<machine>pc-0.11</machine>
<machine>pc-0.10</machine>
<machine>isapc</machine>
<domain type='qemu'>
</domain>
<domain type='kvm'>
<emulator>/usr/bin/kvm</emulator>
<machine>pc-0.12</machine>
<machine canonical='pc-0.12'>pc</machine>
<machine>pc-0.11</machine>
<machine>pc-0.10</machine>
<machine>isapc</machine>
</domain>
</arch>
<features>
<cpuselection/>
<pae/>
<nonpae/>
<acpi default='on' toggle='yes'/>
<apic default='on' toggle='no'/>
</features>
</guest>
<guest>
<os_type>hvm</os_type>
<arch name='x86_64'>
<wordsize>64</wordsize>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<machine>pc-0.12</machine>
<machine canonical='pc-0.12'>pc</machine>
<machine>pc-0.11</machine>
<machine>pc-0.10</machine>
<machine>isapc</machine>
<domain type='qemu'>
</domain>
</arch>
<features>
<cpuselection/>
<acpi default='on' toggle='yes'/>
<apic default='on' toggle='no'/>
</features>
</guest>
</capabilities>
- host: 宿主机的硬件特性列表
- guest: 宾客主机的特性列表
os_type:
- hvm: 全虚拟化openstack, kvm, qemu-kvm 以及 libvirt 之间的关系
- xen: Xen 虚拟化架构(常见于半虚拟化架构)
- domain: 详见libvirt 架构说明,宾客操作系统(虚拟机操作系统)类型,如:qemu、kvm、xen 等
存储管理
http://libvirt.org/formatstorage.html
- pool: 存储介质池,可选的 type 值包括:dir, fs, netfs, disk, iscsi, logical
<pool type="iscsi">
<name>virtimages</name>
<uuid>3e3fce45-4f53-4fa7-bb32-11f34168b82b</uuid>
<allocation>10000000</allocation>
<capacity>50000000</capacity>
<available>40000000</available>
...
- volume: 文件或硬件设备提供的存储介质。
<volume>
<name>sparse.img</name>
<key>/var/lib/xen/images/sparse.img</key>
<allocation>0</allocation>
<capacity unit="T">1</capacity>
...
虚拟网络
网络模式
- NAT 模式
- 路由模式
- 隔离模式
- 支持 IPv6 网络的隔离模式
- 使用物理主机的桥接网卡
- 使用 macvtap 的直连模式
参考文献
- http://wiki.libvirt.org/page/Main_Page#Networking
- http://wiki.libvirt.org/page/VirtualNetworking
- libvirt 里的网络配置方法(XML 语法及实例)
- http://www.tldp.org/HOWTO/BRIDGE-STP-HOWTO/set-up-the-bridge.html
- https://help.ubuntu.com/community/NetworkConnectionBridge
- libvirt 里的虚拟网络拓扑示意图
- 网络虚拟化技术: TUN/TAP MACVLAN MACVTAP
防火墙
guest os 的 vnc 配置
示例 1:
<graphics type='vnc' port='-1' autoport='yes' listen='10.6.9.142' passwd='your_password_here' sharePolicy='allow-exclusive'>
<listen type='address' address='10.6.9.142'/>
</graphics>