KVM虚拟机典型配置文件xml
<domain type='kvm'>
<name>vm64-1</name> //虚拟机名称
<memory unit='MiB'>2300</memory> //最大内存,单位M
<currentMemory unit='MiB'>2300</currentMemory> //可用内存,单位M
<vcpu>3</vcpu> //虚拟cpu个数
<os>
<type arch='x86_64' machine='pc'>hvm</type>
<boot dev='hd'/> //硬盘启动
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<clock offset='localtime'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/libexec/qemu-kvm</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
<source file='/home/kvm/images/vm64-1.raw'/> //目的镜像路径
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> /*硬盘使用virtio驱动后识别为pci总线*/
</disk>
<disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
<source file='/home/kvm/images/ex.img'/> //目的镜像路径
<target dev='vdb' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x10' function='0x0'/> /*硬盘使用virtio驱动后识别为pci总线*/
</disk>
<interface type='bridge'> //虚拟机网络连接方式
<source bridge='vm1_br_debug'/> //当前主机网桥的名称 vm-eth0
<virtualport type='openvswitch'/>
<model type='virtio'/>
<driver name='vhost' queues='8'/>
<mac address="00:16:3E:64:01:00"/> //为虚拟机分配mac地址,务必唯一,否则dhcp获得同样ip,引起冲突
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</interface>
<interface type='bridge'> //虚拟机网络连接方式
<source bridge='vm1_br_protocol'/> //当前主机网桥的名称 vm-eth1
<virtualport type='openvswitch'/>
<model type='virtio'/>
<driver name='vhost' queues='8'/>
<mac address="00:16:3E:64:01:01"/> //为虚拟机分配mac地址,务必唯一,否则dhcp获得同样ip,引起冲突
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</interface>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes' listen = '0.0.0.0' keymap='en-us'/>//vnc方式登录,端口号自动分配,自动加1,可以通过virsh vncdisplay来查询
</devices>
</domain>
范例2
<domain type='kvm'> //如果是Xen,则type=‘xen’
<name>vm0</name> //虚拟机名称,同一物理机唯一
<uuid>fd3535db-2558-43e9-b067-314f48211343</uuid> //同一物理机唯一,可用uuidgen生成
<memory>524288</memory>
<currentMemory>524288</currentMemory> //memory这两个值最好设成一样
<vcpu>2</vcpu> //虚拟机可使用的cpu个数,查看物理机可用CPU个数:cat /proc/cpuinfo |grep processor | wc -l
<os>
<type arch='x86_64' machine='pc-i440fx-vivid'>hvm</type> //arch指出系统架构类型,machine 则是机器类型,查看机器类型:qemu-system-x86_64 -M ?
<boot dev='hd'/> //启动介质,第一次需要装系统可以选择cdrom光盘启动
<bootmenu enable='yes'/> //表示启动按F12进入启动菜单
</os>
<features>
<acpi/> //Advanced Configuration and Power Interface,高级配置与电源接口
<apic/> //Advanced Programmable Interrupt Controller,高级可编程中断控制器
<pae/> //Physical Address Extension,物理地址扩展
</features>
<clock offset='localtime'/> //虚拟机时钟设置,这里表示本地本机时间
<on_poweroff>destroy</on_poweroff> //突发事件动作
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices> //设备配置
<emulator>/usr/bin/kvm</emulator> //如果是Xen则是/usr/lib/xen/binqemu-dm
<disk type='file' device='disk'> //硬盘
<driver name='qemu' type='raw'/>
<source file='/opt/vm/vmdev/fdisk.img'/>
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/> //域、总线、槽、功能号,slot值同一虚拟机上唯一
</disk>
<disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
<source file='/opt/vm/vmdev/fdisk2.img'/>
<target dev='vdb' bus='virtio'/>
</disk>
<disk type='file' device='cdrom'>//光盘
<driver name='qemu' type='raw'/>
<source file='/opt/vm/vmiso/ubuntu-15.10-server-amd64.iso'/>
<target dev='hdc' bus='ide'/>
<readonly/>
</disk> /* 利用Linux网桥连接网络 */
<interface type='bridge'>
<mac address='fa:92:01:33:d4:fa'/>
<source bridge='br100'/> //配置的网桥网卡名称
<target dev='vnet0'/> //同一网桥下相同
<alias name='net0'/> //别名,同一网桥下相同
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> //注意slot值唯一
</interface> /* 利用ovs网桥连接网络 */
<interface type='bridge'>
<source bridge='br-ovs0'/>
<virtualport type='openvswitch'/>
<target dev='tap0'/>
<model type='virtio'/>
</interface> /* 配置成pci直通虚拟机连接网络,SR-IOV网卡的VF场景 */
<hostdev mode='subsystem' type='pci' managed='yes'>
<source>
<address domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
</source>
</hostdev> /* 利用vhostuser连接ovs端口 */
<interface type='vhostuser'>
<mac address='fa:92:01:33:d4:fa'/>
<source type='unix' path='/var/run/vhost-user/tap0' mode='client'/>
<model type='virtio'/>
<driver vringbuf='2048'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface> <interface type='network'> //基于虚拟局域网的网络
<mac address='52:54:4a:e1:1c:84'/> //可用命令生成,见下面的补充
<source network='default'/> //默认
<target dev='vnet1'/> //同一虚拟局域网的值相同
<alias name='net1'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> //注意slot值
</interface>
<graphics type='vnc' port='5900' autoport='yes' listen='0.0.0.0' keymap='en-us'/> //配置vnc,windows下可以使用vncviewer登录,获取vnc端口号:virsh vncdisplay vm0
<listen type='address' address='0.0.0.0'/>
</graphics>
</devices>
</domain>
范例3
<domain type='kvm'>
<name>vm64-1</name> //虚拟机名称
<memory unit='MiB'>2300</memory> //最大内存,单位M
<currentMemory unit='MiB'>2300</currentMemory> //可用内存,单位M
<vcpu>3</vcpu> //虚拟cpu个数
<os>
<type arch='x86_64' machine='pc'>hvm</type>
<boot dev='hd'/> //硬盘启动
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<clock offset='localtime'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/libexec/qemu-kvm</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
<source file='/home/kvm/images/vm64-1.raw'/> //目的镜像路径
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> /*硬盘使用virtio驱动后识别为pci总线*/
</disk>
<disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
<source file='/home/kvm/images/ex.img'/> //目的镜像路径
<target dev='vdb' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x10' function='0x0'/> /*硬盘使用virtio驱动后识别为pci总线*/
</disk>
<interface type='bridge'> //虚拟机网络连接方式
<source bridge='vm1_br_debug'/> //当前主机网桥的名称 vm-eth0
<virtualport type='openvswitch'/>
<model type='virtio'/>
<driver name='vhost' queues='8'/>
<mac address="00:16:3E:64:01:00"/> //为虚拟机分配mac地址,务必唯一,否则dhcp获得同样ip,引起冲突
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</interface>
<interface type='bridge'> //虚拟机网络连接方式
<source bridge='vm1_br_protocol'/> //当前主机网桥的名称 vm-eth1
<virtualport type='openvswitch'/>
<model type='virtio'/>
<driver name='vhost' queues='8'/>
<mac address="00:16:3E:64:01:01"/> //为虚拟机分配mac地址,务必唯一,否则dhcp获得同样ip,引起冲突
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</interface>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes' listen = '0.0.0.0' keymap='en-us'/>//vnc方式登录,端口号自动分配,自动加1,可以通过virsh vncdisplay来查询
</devices>
</domain>
<domain type='kvm'>
<name>vm64-1</name> //虚拟机名称
<memory unit='MiB'>2300</memory> //最大内存,单位M
<currentMemory unit='MiB'>2300</currentMemory> //可用内存,单位M
<vcpu>3</vcpu> //虚拟cpu个数
<os>
<type arch='x86_64' machine='pc'>hvm</type>
<boot dev='hd'/> //硬盘启动
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<clock offset='localtime'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/libexec/qemu-kvm</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
<source file='/home/kvm/images/vm64-1.raw'/> //目的镜像路径
<target dev='vda' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> /*硬盘使用virtio驱动后识别为pci总线*/
</disk>
<disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
<source file='/home/kvm/images/ex.img'/> //目的镜像路径
<target dev='vdb' bus='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x10' function='0x0'/> /*硬盘使用virtio驱动后识别为pci总线*/
</disk>
<interface type='bridge'> //虚拟机网络连接方式
<source bridge='vm1_br_debug'/> //当前主机网桥的名称 vm-eth0
<virtualport type='openvswitch'/>
<model type='virtio'/>
<driver name='vhost' queues='8'/>
<mac address="00:16:3E:64:01:00"/> //为虚拟机分配mac地址,务必唯一,否则dhcp获得同样ip,引起冲突
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</interface>
<interface type='bridge'> //虚拟机网络连接方式
<source bridge='vm1_br_protocol'/> //当前主机网桥的名称 vm-eth1
<virtualport type='openvswitch'/>
<model type='virtio'/>
<driver name='vhost' queues='8'/>
<mac address="00:16:3E:64:01:01"/> //为虚拟机分配mac地址,务必唯一,否则dhcp获得同样ip,引起冲突
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</interface>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes' listen = '0.0.0.0' keymap='en-us'/>//vnc方式登录,端口号自动分配,自动加1,可以通过virsh vncdisplay来查询
</devices>
</domain>
KVM虚拟机典型配置文件xml的更多相关文章
- kvm虚拟机日常管理和配置操作命令梳理
KVM虚拟机的管理主要是通过virsh命令对虚拟机进行管理.1)查看KVM虚拟机配置文件及运行状态KVM虚拟机默认配置文件位置: /etc/libvirt/qemu/autostart目录是配置kvm ...
- KVM 虚拟机基本管理及常用命令
KVM的基本管理 1.查看KVM虚拟机配置文件 #Kvm虚拟机默认配置文件位置 [root@kvm qemu]# pwd /etc/libvirt/qemu [root@kvm qemu]# ll t ...
- linux kvm虚拟机使用
安装配置kvm 1.安装kvm软件包 [root@kvm ~]# yum install kvm python-virtinst libvirt tunctl bridge-utils virt-ma ...
- kvm虚拟机中鼠标不同步的问题解决方法
环境:Centos7.6安装kvm创建windows虚拟机,通过novnc连接到虚拟机上发现存在鼠标位置偏移问题 解决方法: 方法一: 经测试,windows系列虚拟机关闭鼠标加速亦可缓解该问题,不过 ...
- kvm虚拟机日常操作命令梳理
KVM虚拟机的管理主要是通过virsh命令对虚拟机进行管理.废话不多说,下面列出kvm日常管理中的命令 1)查看KVM虚拟机配置文件及运行状态 KVM虚拟机默认配置文件位置: /etc/libvirt ...
- KVM虚拟机的日常管理与配置
1. 查看KVM虚拟机配置文件及运行状态(1) KVM虚拟机默认配置文件位置: /etc/libvirt/qemu/ autostart目录是配置kvm虚拟机开机自启动目录. (2) virsh命令帮 ...
- Linux下KVM虚拟机基本管理及常用命令(转)
说明:可能有重复 一.KVM的基本管理 1.查看KVM虚拟机配置文件 #Kvm虚拟机默认配置文件位置 [root@kvm qemu]# pwd /etc/libvirt/qemu [root@kvm ...
- kvm虚拟机命令梳理
kvm虚拟机命令梳理 )查看KVM虚拟机配置文件及运行状态 KVM虚拟机默认配置文件位置: /etc/libvirt/qemu/ autostart目录是配置kvm虚拟机开机自启动目录. virsh命 ...
- kvm虚拟化学习笔记(四)之kvm虚拟机日常管理与配置
KVM虚拟化学习笔记系列文章列表----------------------------------------kvm虚拟化学习笔记(一)之kvm虚拟化环境安装http://koumm.blog.51 ...
随机推荐
- javascript 关于赋值、浅拷贝、深拷贝的个人理解
关于赋值.浅拷贝.深拷贝,以前也思考良久,很多时候都以为记住了,但是,我太难了.今天我特地写下笔记,希望可以完全掌握这个东西,也希望可以帮助到任何想对学习这个东西的同学. 一.栈.堆.指针地址 栈内存 ...
- 【IDE_IntelliJ IDEA】IDEA中使用Junit插件自动创建测试用例到test目录
第一步 从插件资源库中搜索JunitGenerator V2.0插件并安装 第二步 配置测试用例的生成目录 1.打开File->Settings 2.搜索junit,找到JUnit Genera ...
- Java面试题:JVM中的类加载机制
JVM 的类加载机制是指 JVM 把描述类的数据从 .class 文件加载到内存,并对数据进行校验.转换解析和初始化,最终形成可以被虚拟机直接使用的 Java 类型,这就是 JVM 的类加载机制. 类 ...
- 基于 webdriver 的测试代码日常调试方python 篇
看到论坛有人写了JAVA的测试代码日常设计,就给大家分享一下偶自己平时是如何测试测试代码的.主要基于python语言.基于 webdriver 的日常调试在 python交互模式下非常方便,打开pyt ...
- shell 之for循环几种写法
参见博客 http://blog.csdn.net/babyfish13/article/details/52981110 ,此博客写的非常清晰明了.
- zookeper分布式搭建1
1.zookeper的下载与安装,见:https://www.cnblogs.com/wanerhu/p/11144815.html 2.准备三台centos,进入etc/hosts 3.编辑内容 映 ...
- Python学习笔记6 函数式编程_20170619
廖雪峰python3学习笔记: # 高阶函数 将函数作为参数传入,这样的函数就是高阶函数(有点像C++的函数指针) def add(x, y): return x+y def mins(x, y): ...
- Kubernetes 集群分析查看内存,CPU
Kubernetes方式 top命令查看所有pod,nodes中内存,CPU使用情况 查看pod root @ master ➜ ~ kubectl top pod -n irm-server NAM ...
- HTTPS各版本安全策略HTTPS1_1_TLS1_0、HTTPS2_TLS1_0、HTTPS2_TLS1_2
来自阿里云 https://help.aliyun.com/document_detail/115169.html HTTPS安全策略 更新时间:2019-04-26 14:49:12 分组 ...
- GDB 调试C++
原来比较熟悉用gdb调试C程序,没有用过gdb调试C++程序,原理上没有什么区别.在形式上有一些区别,因为C++支持名字空间和class等机制,把函数的可见域做了隔离. 拿envoy的代码作个例子: ...