通过
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>
