当前位置: 首页 > news >正文

qemu基础-xml详解

通过virsh list可以查看虚机的名字和状态,使用virsh dominfo查看虚机部分详细信息,默认我们每创建一个虚拟机,就会生成一个对应名字.xml 的文件,默认路径是在 /etc/libvirt/qemu/,这个xml文件就可以理解是就是这个虚拟机的元数据,这里的部分信息是我们创建虚拟机里面注入的参数,比如cpu,内存,硬盘,名字等。部分参数则是系统自动生成的,比如键盘鼠标支持等。

<domain type='kvm'><name>MyVM</name><uuid>c47e19d5-b25c-4581-8a95-fcb1cb02fd04</uuid><memory unit='KiB'>524288</memory><currentMemory unit='KiB'>524288</currentMemory><vcpu placement='static'>1</vcpu>##这里上面注意定义资源大小,名字等信息,是创建的时候输入的参数,可修改<os><type arch='x86_64' machine='pc-i440fx-rhel7.0.0'>hvm</type><boot dev='hd'/></os><features><acpi/><apic/></features><cpu mode='custom' match='exact' check='partial'><model fallback='allow'>Broadwell-noTSX-IBRS</model><feature policy='require' name='md-clear'/><feature policy='require' name='spec-ctrl'/><feature policy='require' name='ssbd'/></cpu><clock offset='utc'><timer name='rtc' tickpolicy='catchup'/><timer name='pit' tickpolicy='delay'/><timer name='hpet' present='no'/></clock>##这上面的信息是系统自动生成的,一般不要去修改<on_poweroff>destroy</on_poweroff><on_reboot>restart</on_reboot><on_crash>destroy</on_crash>##这里定义了虚拟机某些行为会触发的动作<pm><suspend-to-mem enabled='no'/><suspend-to-disk enabled='no'/></pm>##定义了对于虚拟机的挂起状态的开关<devices><emulator>/usr/libexec/qemu-kvm</emulator><disk type='file' device='disk'><driver name='qemu' type='raw'/><source file='/data/image_file.img'/><target dev='hda' bus='ide'/><address type='drive' controller='0' bus='0' target='0' unit='0'/></disk><disk type='file' device='cdrom'><driver name='qemu' type='raw'/><target dev='hdb' bus='ide'/><readonly/><address type='drive' controller='0' bus='0' target='0' unit='1'/></disk>##上面部分内容定义了磁盘内容,包括光盘ios和系统盘所对于的img##如果还有多块磁盘,则这里也会显示,也可以通过这里添加磁盘定义,来实现添加磁盘的功能。<controller type='usb' index='0' model='ich9-ehci1'><address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x7'/></controller><controller type='usb' index='0' model='ich9-uhci1'><master startport='0'/><address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0' multifunction='on'/></controller><controller type='usb' index='0' model='ich9-uhci2'><master startport='2'/><address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x1'/></controller><controller type='usb' index='0' model='ich9-uhci3'><master startport='4'/><address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x2'/></controller><controller type='pci' index='0' model='pci-root'/><controller type='ide' index='0'><address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/></controller>##定义了一些插入设备的操作,一般不需要修改<interface type='bridge'><mac address='52:54:00:8c:ed:f9'/><source bridge='virbr0'/><model type='rtl8139'/><address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/></interface>##定义了网卡配置,如果修改网络连接,可以在这里重新调整,##比如修改mac,修改桥接网卡。<serial type='pty'><target type='isa-serial' port='0'><model name='isa-serial'/></target></serial><console type='pty'><target type='serial' port='0'/></console>#定义了终端的一些操作说明<input type='mouse' bus='ps2'/><input type='keyboard' bus='ps2'/><graphics type='vnc' port='-1' autoport='yes'><listen type='address'/>##定义了vnc的信息##如果要修改端口或者修改监听地址,需要在这里修改。</graphics><video><model type='cirrus' vram='16384' heads='1' primary='yes'/><address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/></video><memballoon model='virtio'><address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/></memballoon>##定义了声音鼠标等外设配置,一般不需要修改</devices>
</domain>
http://www.jsqmd.com/news/673779/

相关文章:

  • Qwen2.5-VL-7B-Instruct部署避坑指南:显存不足报错、端口冲突、路径权限问题汇总
  • 自媒体人,别再纠结文笔了,读者想看的是“解决方案”
  • Dev-C++也能做图形界面?用C++写一个带界面的五子棋对战程序(含AI人机对战)
  • 别再搞混了!STSW-LINK004/007/009到底该用哪个?一张图帮你选对ST-Link工具
  • 超越风险比:用R语言RMST重新审视临床生存数据,以肝硬化研究为例
  • 从Docker到Kubernetes:深入理解容器资源限制背后的systemd cgroups机制
  • 蓝队视角:彻底理解PTH/PTK/PTT,手把手配置检测与防御规则(含Sigma/YARA)
  • 告别黑屏:手把手教你用C语言在Linux下玩转framebuffer画图(附完整代码)
  • Blender3mfFormat插件:3D打印工作流的完整解决方案
  • 避坑指南:在Windows/Mac本地用Diffusers库跑通Stable Diffusion U-Net推理的完整流程
  • Windows平台Termius进阶:从安装激活到个性化汉化实战
  • OAuth2.0实战避坑:C# WebAPI资源服务器如何优雅验证Bearer Token(附RefreshToken自动刷新方案)
  • 神经网络 —— 搭建神经网络(实例)
  • 从Altium到CAM350:Gerber文件生成与DFM检查全流程实战
  • 从心电图到电机控制:拆解仪表放大器(INA)在医疗与工业中的真实应用电路
  • 【深度补全实战】从RGBD相机到算法落地:非激光雷达场景下的深度图修复技术选型与避坑指南
  • 用STM32C8T6做个遥控小车?手把手教你驱动PS2手柄(附完整代码)
  • Multi-Agent 调度器的三种类型:集中调度、分布式协商、Token Bus
  • 别再死记硬背MPC公式了!用Python+CVXOPT带你直观理解模型预测控制
  • Redis 慢查询日志分析
  • 量子张量图解指南:用NumPy可视化高维量子比特操作(从入门到放弃)
  • 蓝桥杯CT107D单片机实战:用定时器T0搞定按键长短按,数码管计数不卡顿
  • 3分钟快速上手:Win11Debloat让你的Windows系统焕然一新
  • Go语言的sync.Cond源码
  • 从洛谷P2802『回家』聊聊算法竞赛中的『状态』设计:以Java DFS为例
  • 电力系统仿真PSSE入门:手把手教你从零编写.raw潮流数据文件(附IEEE 5节点实例)
  • 软件冲刺待办列表管理中的任务列表
  • 金刚石结构的各向异性:从晶面原子排布到半导体工艺应用
  • 5分钟快速上手TVBoxOSC:手机变身智能电视控制中心终极指南
  • FPGA异步复位设计避坑指南:从Vivado FDCP警告看亚稳态预防