使用 virsh 输出客户机虚拟机的 XML 配置文件:
virsh dumpxml {guest-id, guestname or uuid}
# virsh dumpxml {guest-id, guestname or uuid}
Copy to Clipboard
Copied!
Toggle word wrap
Toggle overflow
此命令将 guest 虚拟机的 XML 配置文件输出到标准输出(stdout)。您可以通过将输出传送到文件来保存数据。将输出传送至名为 guest.xml 的文件的示例:
virsh dumpxml GuestID > guest.xml
# virsh dumpxml GuestID > guest.xml
Copy to Clipboard
Copied!
Toggle word wrap
Toggle overflow
virsh dumpxml 输出的示例:
virsh dumpxml guest1-rhel6-64
# virsh dumpxml guest1-rhel6-64
<domain type='kvm'>
<name>guest1-rhel6-64</name>
<uuid>b8d7388a-bbf2-db3a-e962-b97ca6e514bd</uuid>
<memory>2097152</memory>
<currentMemory>2097152</currentMemory>
<vcpu>2</vcpu>
<os>
<type arch='x86_64' machine='rhel6.2.0'>hvm</type>
<boot dev='hd'/>
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/libexec/qemu-kvm</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='raw' cache='none' io='threads'/>
<source file='/home/guest-images/guest1-rhel6-64.img'/>
<target dev='vda' bus='virtio'/>
<shareable/<
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</disk>
<interface type='bridge'>
<mac address='52:54:00:b9:35:a9'/>
<source bridge='br0'/>
<model type='virtio'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
<serial type='pty'>
<target port='0'/>
</serial>
<console type='pty'>
<target type='serial' port='0'/>
</console>
<input type='tablet' bus='usb'/>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes'/>
<sound model='ich6'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</sound>
<video>
<model type='cirrus' vram='9216' heads='1'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<memballoon model='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
</memballoon>
</devices>
</domain>
Copy to Clipboard
Copied!
Toggle word wrap
Toggle overflow
请注意,设置了 <shareable/> 标志。这表示在域间应该共享该设备(假设管理程序和操作系统支持),这意味着应该为该设备取消激活缓存。