KVMRS232需要配置那些参数需要什么参数

博客访问: 1920324
博文数量: 1571
博客积分: 19423
博客等级: 上将
技术积分: 16089
注册时间:
分类: 虚拟化 20:27:00
原文地址: 作者:
注:该文档仅仅用于测试虚拟化基本功能,为更好的管理虚拟机,需要使用libvirt等相关虚拟化管理工具,见另一篇笔记:建议首先升级kernel,以便安装新版本的kvm及libvirt,旧版本的有一些bug源:yum makecacheyum list kernelyum install kernel参考:http://wiki.centos.org/HowTos/KVM&uname -aLinux srv4 2.6.18-194.26.1.el5 #1 SMP Tue Nov 9 12:54:20 EST
x86_64 x86_64 GNU/Linux1、检查cpu是否支持虚拟化 egrep '(vmx|svm)' --color=always /proc/cpuinfo check the KVM Guest Support Status for your guest operating system2、安装KVM The KVM package for CentOS is available in the extras repository for versions prior to CentOS 5.4. You may install KVM with: yum install kvm kmod-kvm kvm-qemu-img You probably want to also install QEMU, which is available in the base CentOS repositories, because many of its provided commands can be useful in managing a VM.3、加载模块
modprobe kvm intel:&modprobe kvm-intel amd: & modprobe kvm-amd 非root用户启动kvm,查看上面提到的参考。 关于: modprobe kvm-amd/kvm-intel FATAL: Error inserting kvm_amd (/lib/modules/2.6.18-194.el5/weak-updates/kmod-kvm/kvm-amd.ko): Unknown symbol in module, or unknown parameter (see dmesg) 分析: ll&/lib/modules/2.6.18-194.el5/weak-updates/kmod-kvm lrwxrwxrwx 1 root root 49 Apr 18 11:47 ksm.ko -> /lib/modules/2.6.18-238.el5/extra/kmod-kvm/ksm.ko lrwxrwxrwx 1 root root 53 Apr 18 11:47 kvm-amd.ko -> /lib/modules/2.6.18-238.el5/extra/kmod-kvm/kvm-amd.ko lrwxrwxrwx 1 root root 55 Apr 18 11:47 kvm-intel.ko -> /lib/modules/2.6.18-238.el5/extra/kmod-kvm/kvm-intel.ko 可以看到,这几个文件连接到了2.6.18-238.el5对应的模块。 这是应为在yum install kvm-mod安装时,安装的源中的kvm-mod对应的内核已经升级到2.6.18-238.el5。 解决: 安装对应的内核 yum install kernel 修改/etc/grub.conf,使用新的内核启动 重启系统,reboot 再次加载模块: intel:&modprobe kvm-intel amd: & modprobe kvm-amd 关于无法加载: FATAL: Error inserting kvm_amd (/lib/modules/2.6.18-238.9.1.el5/weak-updates/kmod-kvm/kvm-amd.ko): Operation not supported 查看是否是因为bios中关闭了cpu的虚拟化支持 # dmesg | grep kvm kvm: disabled by bios 关于dell 服务器远程开启CPU VT支持,见后面的文章。 4、启动虚拟机,安装系统& & 4.1 创建disk image qemu-img create -f raw disk.img 20G、 建议使用raw格式,raw格式的性能比qcow2的性能要好 创建一个可以达到20G的disk image,It will only use the amount of space that it needs though.The -f qcow2 is the standard modern qemu image format.&& & 4.2 启动虚拟机,安装系统 /usr/libexec/qemu-kvm -hda ./disk.img -cdrom /usr/local/CentOS-5.6-x86_64/CentOS-5.6-x86_64-bin-1of8.iso &-m 512 &-smp 2 -boot d 其中:-smp
:分配的cpu内核数 -boot d & :-boot [a|c|d|n] boot on floppy (a), hard disk (c), CD-ROM (d), or network (n) 启动windows虚拟机,必须添加-localtime参数,否外使用utc时间。& & 4.3 关于换盘 进入qemu的控制台,在鼠标聚焦到qemu界面时候,按住 Ctrl+Alt+2 进入控制台(将显示输出到vnc时,操作相同): (qemu) change cdrom /usr/local/CentOS-5.6-x86_64/CentOS-5.6-x86_64-bin-2of8.iso 关于错误:"device not found"。可能是设备映射出错,解决: (qemu) info block ... (qemu) change ide1-cd0 iso文件、
ctrl+alt+1 返回
关于组合键: Ctrl-Alt-f 全屏 Ctrl-Alt-n n=1:目标系统显示 n=2:监视器 n=3:串口
在通常情况下,Qemu使用SDL来显示VGA输出,使用-nographic,禁止所有的图形输出,这样Qemu只是一个简单的命令行程序。模拟的串口将会重定向到命令行,所以我们依然可以在Qemu平台上使用串口命令来调试linux内核。 在启动时,如果我们使用了‘-nographic’参数,我们可以使用Ctrl-a h来得到终端命令: Ctrl-a h &打印帮助信息 Ctrl-a x & 退出模拟 Ctrl-a s & 将磁盘信息写入文件(如果为-snapshot) Ctrl-a b & 发出中断 Ctrl-a c & 在控制台与监视器间进行切换 Ctrl-a Ctrl-a 发送Ctrl-a5、系统安装完成,启动虚拟机: /usr/libexec/qemu-kvm -hda ./disk.img -m 512 &-smp 2 -boot c
关于:Could not initialize SDL - exiting 该错误与鼠标有关,解决办法:在图形界面启动,或者添加参数-nographic,或者在vnc显示图形界面,如果添加了-nographic,则不会启动vnc。关于vnc,详细的方法见后面的介绍。 6、查看disk image信息: qemu-img &info disk2.img7、复制disk image: <font color="#f002:错误,-b:If base_image is specified, then the image will record only the differences from base_image.&qemu-img create -b ./disk.img &./centvm3.img -f raw 10G 错误,该方法不是复制磁盘 启动后记得更改主机名。 :不要使用creat,creat会在磁盘文件的info中创建backing file。这个会造成以后再次使用这个磁盘创建新的磁盘时出现错误,qemu-img : could not open 磁盘文件
可以使用convert创建磁盘: 关于qemu-img convert: 会创建新格式的磁盘,旧格式的磁盘仍然存在。 8、关于网络 参考:http://www.linux-kvm.org/page/Networking 参考:http://wiki.centos.org/HowTos/KVM8.1、kvm默认使用NAT网络,guest获得一个10.0.2.x的地址,可以访问host服务器所在的LAN及subnet。虽然guest的IP为10.0.2.x,仍然可以通过ssh及samba访问host(或在网络上的host),而且可以访问internet。vpn客户端可能不能工作. 8.2、桥接网络(Bridged Tap Networking) 如果你希望guest以另外一个host出现在LAN上,对网络上的其他host可见。你需要是用桥接网络。网络上有很多QEMU howto,但是大多数已经太旧了,因为已经在2.6.18内核时更改了。8.3、部署桥接网络: 很多howto的建议是在/etc目录下建立一个qemu-ifup脚本。此处使用的不建议这样做。
8.3.1、yum install bridge-utils tunctl 8.3.2、建立文件:/etc/udev/rules.d/90-kvm-rules KERNEL=="kvm", & & & & &NAME="%k", GROUP="kvm", MODE="0660" KERNEL=="tun", & & & & &NAME="net/%k", GROUP="kvm", MODE="0660"& 设置权限,并加到/etc/rc.d/rc.locl脚本中 chown root:kvm /dev/net/tun chmod 0660 /dev/net/tun 8.3.3、启动br0 方法1:修改配置文件 Edit /etc/sysconfig/network-scripts/ifcfg-eth0 注释掉 BOOTPROTO 添加 & BRIDGE=br0 DEVICE=eth0 #BOOTPROTO=static ONBOOT=yes BRIDGE=br0 Create /etc/sysconfig/network-scripts/ifcfg-br0 The content should be: DEVICE=br0 BOOTPROTO=static IPADDR=192.168.0.2 NETMASK=255.255.255.0 GATEWAY=192.168.0.1 ONBOOT=yes TYPE=Bridge /etc/init.d/networking restart The bridge br0 should get the ip address (either static/dhcp) while the physical eth0 is left without ip address. 注:此时会丢失原来的eth0的连接,不建议远程操作。或者在你可以通过另一块网卡连接到该服务器时,可以这样操作。 对于rhel6和centos6,需要关闭NetworkManager& service NetworkManager stop chkconfig --level 35 NetworkManager off
方法2:使用命令行 brctl addbr br0 ifconfig eth0 0.0.0.0 brctl addif br0 eth0 ifconfig br0 192.168.1.120 netmask 255.255.255.0 up route add -net 192.168.1.0 netmask 255.255.255.0 br0 route add default gw 192.168.1.1 br0 8.3.4、启动用于client的tap网卡 创建tap0 tunctl -b -u root #第一次运行,创建tap0,第二次,创建tap1,一次类推 启动tap0 ifconfig tap0 up #不要为该网卡配置地址 将tap0添加到 brctl addif br0 tap0
其中: tunctl is used to set up and maintain persistent TUN/TAP network interfaces, enabling user applications to simulate network traffic. Such interfaces is useful for VPN software, virtualization, emulation, simulation, and a number of other applications
查看tap设备: ip addr show
8.3.5、与鼠标有关 export SDL_VIDEO_X11_DGAMOUSE=0
8.3.6、iptables iptables -I RH-Firewall-1-INPUT -i br0 -j ACCEPT 8.3.7、VLANs(必须,否则guest服务器只能与host通信) When using VLANs on a setup like this and no traffic is getting through to your guest(s), you might want to do: #cd /proc/sys/net/bridge # ls bridge-nf-call-arptables &bridge-nf-call-iptables bridge-nf-call-ip6tables &bridge-nf-filter-vlan-tagged # for f in bridge-nf-*; do echo 0 > $f; done 原值为1. 并写到/etc/sysctl.con中net.bridge.bridge-nf-call-ip6tables = 0 net.bridge.bridge-nf-call-iptables = 0 net.bridge.bridge-nf-call-arptables = 0 net.bridge.bridge-nf-filter-vlan-tagged = 0
8.3.8、以桥接方式启动虚拟机mac=`printf 'DE:AD:BE:EF:%02X:%02X\n' $((RANDOM%256)) $((RANDOM%256))` /usr/libexec/qemu-kvm \ -hda ./disk.img \ -m 1024 \ -smp 2 \ -boot c \ -net nic,macaddr=$mac \ -net tap,ifname=tap0,script=no,downscript=no
启动guset以后,修改ip地址,不要把mac地址写进去,因为后面启动的脚本里添加了每次启动时,使用随机的mac地址,另外,为了在启动时不知为何,网卡获取ip地址方式被改为DHCP,为ifcfg-eth0文件添加禁止修改的属性 chattr +i /etc/sysconfig/network-scripts/ifcfg-eth0 如果将mac地址写进来,会造成guest启动后,文件中的mac和实际的mac不符,不能启动eth0的问题。 8.3.9、关于错误: /etc/qemu-ifup: could not launch network script Could not initialize device 'tap' 启动时添加参数script=no8.4 关于NAT网络 以下为启动windows服务器的例子,将host主机的3389端口映射到guest主机的3389端口,用于远程桌面连接。并开启vnc mac=`printf &'DE:AD:BE:EF:%02X:%02X\n' $((RANDOM%256)) $((RANDOM%256))`/usr/libexec/qemu-kvm \ -hda ./win2003.img \ -m 1024 \ -smp 2 \ -boot c \ -vnc host-ip:1,password \-daemonize&\ -net nic,macaddr=$mac \ -net user \ -redir tcp:windows服务器的网卡需要配置为通过dhcp获取IP。9、关于将虚拟机的显示输出到vnc 注意:如果添加了-nographic,则不会启动vnc。 启动时添加参数: -vnc host-ip:1,password & (或2,3....) 关于启动时报错: libgcrypt initialization error 在报错时,我的libgcrypt.i386、libgcrypt.x86_64、libgcrypt-devel.x86_64版本为:1.2.4-1.el5 yum install&libgcrypt* 以后解决问题 libgcrypt.i386、libgcrypt.x86_64、libgcrypt-devel.x86_64,libgcrypt-devel.i386版本为:1.4.4-5.el5 -vnc一般和-daemonize参数一起使用: -daemonize daemonize QEMU after initializing 类似于将虚拟机启动在后台。 将显示输出到vnc,将虚拟机起在后台。 关于vnc连接: 我在使用realvnc 的viewer连接时,画面闪一下,不能连接,推荐使用一个单独的可执行文件(exe),无需安装。 & 或从本地下载: && 或者下载新版本的vncviwer,4.1.3的可以连接。注,不要通过vnc address book连接,直接使用vncviewer
注:关于上面提到的reanlvnc的问题 在选项里选择always use best available colour quality即可,即adapt to network speed 到best quality关于&error: unknown OS type hvmbios中关闭了cpu虚拟化关于DELL 2950服务器开启CPU的VT支持:本地操作: 1 在 POST 屏幕中按
键以转至“BIOS setup”。 2 导航至“CPU Information”。 3 按
键,并导航至“Virtualization Technology”。 4 通过切换左右箭头,选择“Enabled”。 5 保存选择内容,并退出“BIOS setup”远程操作: 1、安装:Dell OpenManage Server Administrator http://content.dell.com/us/en/enterprise/d/solutions/openmanage-server-administrator.aspx新的Dell OpenManage 需要提供快速服务编码下载,或者从产品列表中选择相应的型号,从下载列表中下载:ftp://ftp.dell.com/sysman/OM-SrvAdmin-Dell-Web-LX-6.5.0-.tar.gz注:也可以通过安装dell的yum源来使用yum安装,详细查看:
静默安装,linux/supportscripts/srvadmin-install.sh -x对于RHEL5,静默安装可以自动解决包的依赖问题关于6.5的依赖关系&Please check the manual of OM. For example, if you are installing the dependent RPMs on Red Hat Enterprise Linux 5.3, then select the following files from srvadmin\linux\RPMS\supportRPMS\opensource-components\RHEL5:* libcmpiCppImpl0-2.0.0Dell-1.1.rhel5.i386.rpm* libwsman1-2.1.5Dell-33.1.rhel5.i386.rpm* openwsman-client-2.1.5Dell-33.1.rhel5.i386.rpm* openwsman-server-2.1.5Dell-33.1.rhel5.i386.rpm* sblim-sfcb-1.3.2Dell-13.1.rhel5.i386.rpm* sblim-sfcc-2.1.5Dell-6.1.rhel5.i386.rpmThanks登陆时:connection error?访问:https://localhost:1311对于rhel6libcmpiCppImpl0.x86_64openwsman-server.x86_64openwsman-client.x86_64sblim-sfcb.x86_64直接yum安装即可rhel5,需要从omsa中查找对应的包进行安装。error: Failed dependencies:& & & & perl(LWP::UserAgent) is needed by sblim-sfcb-1.3.7-1.6.4.el5.x86_64rpm --nodeps -ivh sblim-sfcb-1.3.7-1.6.4.el5.x86_64.rpm关于libstdc++.so.5 is needed by srvadmin-omacore-6.1.0-648.i38yum install compat-libstdc++* 2、我的系统CENTOS5.3 更改/etc/redhat-releasesetup.sh通过关键词来判断操作系统的版本elif [ -f /etc/redhat-release ] && [ `grep -c "Tikanga" /etc/redhat-release` -gt 0 ]; then
GBL_OS_TYPE=${GBL_OS_TYPE_RHEL5}
GBL_OS_TYPE_STRING="RHEL5"
PATH_TO_RPMS_SUFFIX=RHEL5
elif [ -f /etc/redhat-release ] && [ `grep -c "Santiago" /etc/redhat-release` -gt 0 ]; then
if [ "${DISTRO}" = "x86_64" ]; then # 32bit is not supported for rhel6.
GBL_OS_TYPE=${GBL_OS_TYPE_RHEL6}
GBL_OS_TYPE_STRING="RHEL6"
PATH_TO_RPMS_SUFFIX=RHEL6 3、解压后: linux/supportscripts/srvadmin-install.sh 4、安装后 linux/supportscripts/srvadmin-services.sh start
启动后1311端口无监听? /etc/srvadmin/iws/config/iws.ini ip_address = * 更改为 ip_address = 127.0.0.1 重启: /opt/dell/srvadmin/iws/bin/linux/dsm_om_connsvc restart 5、访问: https://localhost:1311/ 切忌:是https 用户名密码为系统的用户名和密码 6、更改BIOS设置。 一篇不错的文章 :http://www.cyberciti.biz/faq/centos-rhel-linux-kvm-virtulization-tutorial/
阅读(9360) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~
请登录后评论。qemu-kvm命令行参数
qemu-kvm命令行参数
1.cpu相关参数
-cpu:指定cpu模型,默认的为qemu64,可以通过&-cpu ?&查询当前支持的cpu模型
-smp:设置的pu个数。后面还可以加cores threads socke.
2.内存相关参数
-m:设置虚拟机内存大小,默认单位为MB。
-mem-pathpatch:指定从path路径表示的临时文件中为guest分配内存。
-mem-prealloc:启动时即分配全部内存,而不是根据guest请求动态分配,与-mem-path参数配合使用。
-balloon:开全内存balloon功能,俗称内存气球。
3.磁盘相关参数
-hda、-hdb和cdrom等:设置虚拟机的IDE磁盘和光盘设置。
-driver:配置驱动器。
-boot:设置虚拟机的启动选项
4.网络相关参数
-netnic:为虚拟机创建一个nic网卡
-netuser:让虚拟机使用不需要管理权限的用户模式网络(user mode network).
-nettap:使用host的tap网络接口来帮助guest建立网络。
-netnone:不配置任何网络设备。
5.图形显示参数
-sdl:使用sdl方式显示客户机。
-vnc:使用vnc方式显示客户机。
-vga:设置虚拟机中的vga显卡类型,默认为&-vga cirrus&.
-nographic:关闭qemu的图形化界面输出。
6.其他常用参数
-h:显示帮助手册
#qemu-system-x86_64-h:会显示所有参数
-noreboot:guest执行reboot操作时,关闭后退出qemu-kvm,而不会再启动虚拟机。
-no-shutdown:虚拟机shutdown后,系统关闭后,不退出qemu-kvm进程,保持这个进程存在,他的monitor仍然可以用。
-loadvm:加载快照状态,与monitor中的&loadvm&命令类似
-nodefaults:不创建默认的设备。默认会创建一些显卡、串口、控制台等设备
-readconfig:从文件中读虚拟机设备的配置信息。
-writeconfig:将虚拟机的配置信息写到文件中。
-nodedefconfig:不加载默认的配置文件。默认会加载/use/local/share/qemu下的文件。
-no-user-config:不加载用户自定义的配置文件。
libvirt透传命令到qemu。如透传-s到qemu,xml格式如下:&domain type='kvm' id='29'&
//domain 是一个所有虚拟机都需要的根元素,它有两个属性,
//type定义使用哪个虚拟机管理程序,值可以是:xen、kvm、qemu、lxc、kqemu,
//第二个参数是id,它唯一的标示一个运行的虚拟机,不活跃的客户端没有id。
&name&i-000039&/name&
//name参数为虚拟机定义了一个简短的名字,必须唯一。
&uuid&d59b03ce-2e78-4d35-b731-09d9ca9653af&/uuid&
//uid为虚拟机定义了一个全球唯一的标示符,uuid的格式必须遵循RFC 4122指定的格式,当创建虚拟机没有指定uuid时会随机的生成一个uuid。
&memory unit='KiB'&4194304&/memory&
&currentMemory unit='KiB'&4194304&/currentMemory&
&hard_limit unit='KiB'&4194304&/hard_limit&
&/memtune&
//memory 定义客户端启动时可以分配到的最大内存,内存单位由unit定义,单位可以是:K、KiB、M、MiB、G、GiB、T、TiB。默认是KiB。
&vcpu placement='static'&1&/vcpu&
//vcpu的内容是为虚拟机最多分配几个cpu,值处于1~maxcpu之间,可选参数:cpuset参数指定虚拟cpu可以映射到那些物理cpu上,物理 cpu用逗号分开,单个数字的标示单个cpu,
//也可以用range符号标示多个cpu,数字前面的脱字符标示排除这个cpu,current参数指定虚拟 机最少,placement参数指定一个domain的cpu的分配模式,值可以是static、auto。
&shares&1024&/shares&
&period&100000&/period&
&quota&-1&/quota&
&/cputune&
&resource&
&partition&/machine&/partition&
&/resource&
//操作系统启动介绍
&type arch='x86_64' machine='pc-i440fx-2.8'&hvm&/type&
//type参数指定了虚拟机操作系统的类型,内容:hvm表明该OS被设计为直接运行在裸金属上面,需要全虚拟化,
//而linux(一个不好的名字)指OS支 持XEN3hypervisor的客户端ABI,
//type同样有两个可选参数:arch指定虚拟机的CPU构架,machine指定机器的类型。
//&boot dev='hd'/&dev属性的值可以是:fd、hd、cdrom、network,它经常被用来指定下一次启动。boot的元素可以被设置多个用来建立一个启动优先规则。
&bootmenu enable='yes' timeout='0'/&
&bios useserial='yes'/&
Hypervisor的特性
&features&
&/features&
Hypervisors允许特定的CPU/机器特性打开或关闭,所有的特性都在fearures元素中,以下介绍一些在全虚拟化中常用的标记:
pae:扩展物理地址模式,使32位的客户端支持大于4GB的内存
acpi:用于电源管理
hap:Enable use of Hardware Assisted Paging if available in the hardware.
&topology sockets='1' cores='1' threads='1'/&
&cell id='0' cpus='0' memory='4194304' unit='KiB'/&
&clock offset='variable' adjustment='0' basis='utc'&
&timer name='rtc' track='guest'/&
客户端的时间初始化来自宿主机的时间,大多数操作系统期望硬件时钟保持UTC格式,UTC也是默认格式,然而Windows机器却期望它是&localtime&
clock的offset属性支持四种格式的时间:UTC localtime timezone variable
UTC:当引导时客户端时钟同步到UTC时钟
localtime:当引导时客户端时钟同步到主机时钟所在的时区
timezone:The guest clock will be synchronized to the requested timezone using the timezone attribute.
//控制周期:
&on_poweroff&destroy&/on_poweroff&
&on_reboot&restart&/on_reboot&
&on_crash&preserve&/on_crash&
&on_lockfailure&poweroff&/on_lockfailure&
//当一个客户端的OS触发lifecycle时,它将采取新动作覆盖默认操作,具体状态参数如下:
//on_poweroff:当客户端请求poweroff时执行特定的动作
//on_reboot:当客户端请求reboot时执行特定的动作
// on_crash:当客户端崩溃时执行的动作
//每种状态下可以允许指定如下四种行为:
//destory:domain将会被完全终止,domain的所有资源会被释放
//restart:domain会被终止,然后以相同的配置重新启动
//preserver:domain会被终止,它的资源会被保留用来分析
//rename-restart:domain会被终止,然后以一个新名字被重新启动
//所有的设备都是一个名为devices元素的子设备(All devices occur as children of the main devices element.),以下是一个简单的配置:
//&emulator&/usr/bin/kvm&/emulator&
//emulator元素指定模拟设备二进制文件的全路径
&emulator&/usr/libexec/qemu-kvm&/emulator&
&disk type='file' device='cdrom'&
&backingStore/&
&target dev='hdd' bus='ide'/&
&readonly/&
&boot order='2'/&
&alias name='ide0-1-1'/&
&address type='drive' controller='0' bus='1' target='0' unit='1'/&
&disk type='file' device='disk'&
&driver name='qemu' type='qcow2' cache='none'/&
&source file='/datastore/6ee684f1-8b25-4f0a-9721-fe/ae386362-eed6-43a8-b5a8-11a42fabc0ed'/&
&backingStore/&
&target dev='vda' bus='virtio'/&
&boot order='1'/&
&alias name='virtio-disk0'/&
&address type='pci' domain='0x0000' bus='0x01' slot='0x01' function='0x0'/&
&controller type='usb' index='0' model='ich9-ehci1'&
&alias name='usb'/&
&address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/&
&/controller&
&controller type='usb' index='1' model='pci-ohci'&
&alias name='usb1'/&
&address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/&
&/controller&
&controller type='ide' index='0'&
&alias name='ide'/&
&address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/&
&/controller&
&controller type='scsi' index='0' model='virtio-scsi'&
&alias name='scsi0'/&
&address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/&
&/controller&
&controller type='virtio-serial' index='0'&
&alias name='virtio-serial0'/&
&address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/&
&/controller&
&controller type='pci' index='0' model='pci-root'&
&alias name='pci.0'/&
&/controller&
&controller type='pci' index='1' model='pci-bridge'&
&model name='pci-bridge'/&
&target chassisNr='1'/&
&alias name='pci.1'/&
&address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/&
&/controller&
&lockspace&6ee684f1-8b25-4f0a-9721-fe&/lockspace&
&key&ae386362-eed6-43a8-b5a8-11a42fabc0ed&/key&
&target path='/datastore/6ee684f1-8b25-4f0a-9721-fe/.6ee684f1-8b25-4f0a-9721-fe/.leases' offset='4194304'/&
网络接口:
有好几种网络接口访问客户端:Virtual network、Bridge to LAN、Userspace SLIRP stack、Generic ethernet connection、Direct attachment to physical interface。
Virtual network:这种推荐配置一般是对使用动态/无线网络环境访问客户端的情况。
Bridge to LAN:这种推荐配置一般是使用静态有限网络连接客户端的情况。
&interface type='bridge'&
&mac address='00:16:3e:bd:8e:f3'/&
&source bridge='vxlansw-000003'/&
&virtualport type='openvswitch'&
&parameters interfaceid='1fb6d3e0-c0c0-4fdd-9edb-c64b1327763f'/&
&/virtualport&
&target dev='vnd59b03ce0'/&
&model type='virtio'/&
&boot order='3'/&
&alias name='net0'/&
&address type='pci' domain='0x0000' bus='0x00' slot='0x10' function='0x0'/&
&/interface&
&interface type='bridge'&
&mac address='00:16:3e:59:09:2d'/&
&source bridge='vxlansw-000003'/&
&virtualport type='openvswitch'&
&parameters interfaceid='f8a225e1-028f-9f5b77152c'/&
&/virtualport&
&target dev='vnd59b03ce1'/&
&model type='rtl8139'/&
&alias name='net1'/&
&address type='pci' domain='0x0000' bus='0x00' slot='0x11' function='0x0'/&
&/interface&
&interface type='bridge'&
&mac address='00:16:3e:97:5b:c0'/&
&source bridge='vxlansw-000003'/&
&virtualport type='openvswitch'&
&parameters interfaceid='f688fbc6-c4e3-dc903dab06'/&
&/virtualport&
&target dev='vnd59b03ce2'/&
&model type='virtio'/&
&alias name='net2'/&
&address type='pci' domain='0x0000' bus='0x00' slot='0x12' function='0x0'/&
&/interface&
//串行端口
&serial type='pty'&
&source path='/dev/pts/14'/&
&target port='0'/&
&alias name='serial0'/&
在每组指令中,最顶层的指令(parallel, serial, console, channel)描述设备怎样出现在客户端中,客户端接口通过target配置。
The interface presented to the host is given in the type attribute of the top-level element. The host interface is configured by the source element
&console type='pty' tty='/dev/pts/14'&
&source path='/dev/pts/14'/&
&target type='serial' port='0'/&
&alias name='serial0'/&
&/console&
&channel type='unix'&
&source mode='bind' path='/var/lib/libvirt/qemu/channels/i-000039.com.inspur.ics.vmtools'/&
&target type='virtio' name='com.inspur.ics.vmtools' state='disconnected'/&
&alias name='channel0'/&
&address type='virtio-serial' controller='0' bus='0' port='1'/&
&/channel&
&channel type='unix'&
&source mode='bind' path='/var/lib/libvirt/qemu/channels/i-000039.com.inspur.ics.agent'/&
&target type='virtio' name='org.qemu.guest_agent.0' state='disconnected'/&
&alias name='channel1'/&
&address type='virtio-serial' controller='0' bus='0' port='2'/&
&/channel&
&input type='tablet' bus='usb'&
&alias name='input0'/&
&address type='usb' bus='0' port='1'/&
&input type='mouse' bus='ps2'&
&alias name='input1'/&
&input type='keyboard' bus='ps2'&
&alias name='input2'/&
输入设备:
输入设备允许使用图形化界面和虚拟机交互,当有图形化framebuffer的时候,输入设备会被自动提供的。
&input type='mouse' bus='ps2'/&
input元素:input元素含有一个强制的属性,type属性的值可以是mouse活tablet,前者使用想对运动,后者使用绝对运动。bus属性指定一个明确的设备类型,值可以是:xen、ps2、usb。
&graphics type='vnc' port='5905' autoport='yes' listen='0.0.0.0' keymap='en-us' sharePolicy='force-shared'&
&listen type='address' address='0.0.0.0'/&
&/graphics&
graphics元素:graphics含有一个强制的属性type,type的值可以是:sdl、vnc、rdp、desktop。vnc则启动vnc 服务,port属性指定tcp端口,如果是-1,则表示自动分配,vnc的端口自动分配的话是从5900向上递增。listen属性提供一个IP地址给服 务器监听,可以单独在listen元素中设置。passwd属性提供一个vnc的密码。keymap属性提供一个keymap使用。
Rather than putting the address information used to set up the listening socket for graphics types vnc and spice in the &graphics& listen attribute, a separate subelement of &graphics&, called &listen& can be specified (see the examples above)since 0.9.4. &listen& accepts the following attributes:
listen元素:listen元素专门针对vnc和spice设置监听端口等。它包含以下属性:type、address、network。type的 值可以是address或network。如果设置了type=address,那么address属性设置一个ip地址或者主机名来监听。如果 type=network,则network属性设置一个网络名称在libvirt&s的网络配置文件中。
字符设备提供同虚拟机进行交互的接口,Paravirtualized consoles, serial ports, parallel ports and channels 都是字符设备,它们使用相同的语法。
&model type='cirrus' vram='16384' heads='1' primary='yes'/&
&alias name='video0'/&
&address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/&
video元素:是描述声音设备的容器,为了向后完全兼容,如果没有设置video但是有graphics在xml配置文件中,这时libvirt会按照 客户端类型增加一个默认的video,。model元素有一个强制的type属性,它的值可以是:vga、cirrus、vmvga、xen、vbox、 qxl。例如一个客户端类型为kvm,那么默认的type值是cirrus。
&memballoon model='virtio'&
&alias name='balloon0'/&
&address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/&
&/memballoon&
&panic model='isa'&
&address type='isa' iobase='0x505'/&
&/devices&
&seclabel type='none' model='none'/&
&seclabel type='dynamic' model='dac' relabel='yes'&
&label&+0:+0&/label&
&imagelabel&+0:+0&/imagelabel&
&/seclabel&
阅读(...) 评论()}

我要回帖

更多关于 参数配置 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信