Skip to main content

虚拟机XML文件

虚拟机XML文件

AMD架构的虚拟机XML文件(Legacy)

<domain type='kvm'>

  <name>uos</name>

  <memory unit='KiB'>4194304</memory>

  <currentMemory unit='KiB'>4194304</currentMemory>

  <vcpu placement='static'>1</vcpu>

  <iothreads>1</iothreads>

  <os>

    <type arch='x86_64' machine='q35'>hvm</type>

  </os>

  <features>

    <acpi/>

  </features>

<cpu mode='host-passthrough' />

  <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='qcow2' iothread='1'/>

      <source file='/uos/uos.qcow2'/>

      <target dev='vda' bus='virtio'/>

      <boot order='1'/>

      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>

    </disk>

    <disk type='file' device='cdrom'>

    <driver name='qemu' type='raw'/>

    <source file='/uos/uos-server-20-1070e-amd64.iso'/>

    <readonly/>

    <target dev='sdb' bus='scsi'/>

    <boot order='2'/>

</disk>

    <controller type='scsi' index='0' model='virtio-scsi'>

    </controller>

    <controller type='virtio-serial' index='0'>

    </controller>

    <controller type='usb' index='0' model='ehci'>

    </controller>

    <controller type='sata' index='0'>

    </controller>

    <controller type='pci' index='0' model='pci-root'/>

    <interface type='bridge'>

      <source bridge='br0'/>

      <model type='virtio'/>

    </interface>

    <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='tablet' bus='usb'>

      <address type='usb' bus='0' port='1'/>

    </input>

    <input type='keyboard' bus='usb'>

      <address type='usb' bus='0' port='2'/>

    </input>

    <input type='mouse' bus='ps2'/>

    <input type='keyboard' bus='ps2'/>

    <graphics type='vnc' port='-1' autoport='yes' listen='0.0.0.0'>

      <listen type='address' address='0.0.0.0'/>

    </graphics>

    <video>

      <model type='vga' vram='16384' heads='1' primary='yes'/>

      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>

    </video>

    <memballoon model='virtio'>

    </memballoon>

  </devices>

</domain>

AMD架构的虚拟机XML文件(UEFI)

<domain type='kvm'>

  <name>uos</name>

  <memory unit='KiB'>4194304</memory>

  <currentMemory unit='KiB'>4194304</currentMemory>

  <vcpu placement='static'>1</vcpu>

  <iothreads>1</iothreads>

  <os>

    <type arch='x86_64' machine='q35'>hvm</type>

     <loader type='rom'>/usr/share/edk2/ovmf/OVMF.fd</loader>

  </os>

  <features>

    <acpi/>

  </features>

<cpu mode='host-passthrough' />

  <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='qcow2' iothread='1'/>

      <source file='/uos/uos.qcow2'/>

      <target dev='vda' bus='virtio'/>

      <boot order='1'/>

      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>

    </disk>

    	<disk type='file' device='cdrom'>

	    <driver name='qemu' type='raw'/>

	    <source file='/uos/uos-server-20-1070e-amd64.iso'/>

	    <readonly/>

	    <target dev='sdb' bus='scsi'/>

	    <boot order='2'/>

	</disk>

    <controller type='scsi' index='0' model='virtio-scsi'>

    </controller>

    <controller type='virtio-serial' index='0'>

    </controller>

    <controller type='usb' index='0' model='ehci'>

    </controller>

    <controller type='sata' index='0'>

    </controller>

    <controller type='pci' index='0' model='pci-root'/>

    <interface type='bridge'>

      <source bridge='br0'/>

      <model type='virtio'/>

    </interface>

    <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='tablet' bus='usb'>

      <address type='usb' bus='0' port='1'/>

    </input>

    <input type='keyboard' bus='usb'>

      <address type='usb' bus='0' port='2'/>

    </input>

    <input type='mouse' bus='ps2'/>

    <input type='keyboard' bus='ps2'/>

    <graphics type='vnc' port='-1' autoport='yes' listen='0.0.0.0'>

      <listen type='address' address='0.0.0.0'/>

    </graphics>

    <video>

      <model type='vga' vram='16384' heads='1' primary='yes'/>

      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>

    </video>

    <memballoon model='virtio'>

    </memballoon>

  </devices>

</domain>

ARM架构的虚拟机XML文件(UEFI)

<domain type='kvm'>

    <name>uos</name>

    <memory unit='GiB'>8</memory>

    <currentMemory unit='GiB'>8</currentMemory>

    <vcpu placement='static'>6</vcpu>

    <os>

        <type arch='aarch64' machine='virt-4.1'>hvm</type>

        <loader readonly='yes' type='pflash'>/usr/share/edk2/aarch64/QEMU_EFI-pflash.raw</loader>

        <boot dev='hd'/>

        <boot dev='cdrom'/>

    </os>

    <features>

        <acpi/>

        <gic version='3'/>

    </features>

    <cpu mode='host-passthrough'/>

    <iothreads>1</iothreads>

    <clock offset='utc'/>

    <on_poweroff>destroy</on_poweroff>

    <on_reboot>restart</on_reboot>

    <on_crash>restart</on_crash>

    <devices>

        <channel type='unix'>

            <target type='virtio' name='org.qemu.guest_agent.0'/>

            <address type='virtio-serial' controller='0' bus='0' port='1'/>

        </channel>

        <memballoon model='virtio'/>

        <emulator>/usr/libexec/qemu-kvm</emulator>

        <disk type='file' device='disk'>

            <driver name='qemu' type='qcow2' iothread="1"/>

            <source file='/uos/uos.qcow2'/>

            <target dev='vda' bus='virtio'/>

        </disk>

        <disk type='file' device='cdrom'>

            <driver name='qemu' type='raw'/>

            <source file='/uos/uos-server-20-1070e-arm64.iso'/>

            <readonly/>

            <target dev='sdb' bus='scsi'/>

        </disk>

        <interface type='bridge'>

            <source bridge='br0'/>

            <model type='virtio'/>

<address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>

        </interface>

        <console type='pty'/>

        <controller type='scsi' index='0' model='virtio-scsi'/>

        <controller type='usb' model='ehci'/>

        <input type='keyboard' bus='usb'/>

        <input type='tablet' bus='usb'/>

        <graphics type='vnc' port='-1' autoport='yes' listen='0.0.0.0'/>

    </devices>

</domain>

Loongarch架构的虚拟机XML文件(UEFI)

<domain type='kvm'>

  <name>uos</name>

  <memory unit='GiB'>8</memory>

  <currentMemory unit='GiB'>8</currentMemory>

  <vcpu placement='static'>4</vcpu>

  <os>

    <type arch='loongarch64' machine='loongson7a_v1.0'>hvm</type>

    <loader readonly='yes' type='rom'>/usr/share/qemu-kvm/loongarch_bios.bin</loader>

  </os>

  <clock offset='utc'/>

  <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='qcow2'/>

      <source file='/home/uos.qcow2'/>

      <target dev='vda' bus='virtio'/>

      <boot order='1'/>

    </disk>

    <disk type='file' device='cdrom'>

      <driver name='qemu' type='raw'/>

      <source file='/home/uos-server-20-1070-loongarch64.iso'/>

      <target dev='sda' bus='sata'/>

      <readonly/>

    </disk>

    <serial type='pty'>

      <target port='0'/>

    </serial>

    <console type='pty'>

      <target type='serial' port='0'/>

    </console>

    <channel type='unix'>

      <target type='virtio' name='org.qemu.guest_agent.0'/>

      <address type='virtio-serial' controller='0' bus='0' port='1'/>

    </channel>

    <channel type='spicevmc'>

      <target type='virtio' name='com.redhat.spice.0'/>

      <address type='virtio-serial' controller='0' bus='0' port='2'/>

    </channel>

    <input type='tablet' bus='usb'>

      <address type='usb' bus='0' port='1'/>

    </input>

    <input type='keyboard' bus='usb'>

      <address type='usb' bus='0' port='2'/>

    </input>

    <graphics type='spice' autoport='yes'>

      <listen type='address'/>

      <image compression='off'/>

    </graphics>

    <sound model='ich6'>

      <address type='pci' domain='0x0000' bus='0x03' slot='0x01' function='0x0'/>

    </sound>

    <video>

      <model type='virtio' 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='0x08' slot='0x00' function='0x0'/>

    </memballoon>

  </devices>

</domain>

SW架构的虚拟机XML文件(UEFI)

<domain type="kvm">

  <name>uos</name>

  <memory unit='GiB'>16</memory>

  <currentMemory unit='GiB'>8</currentMemory>

  <vcpu>8</vcpu>

  <os>

    <type arch="sw_64" machine="core3">hvm</type>

    <boot dev="cdrom"/>

    <boot dev="hd"/>

  </os>

  <clock offset="utc"/>

  <devices>

    <emulator>/usr/local/bin/qemu-system-sw64</emulator>

    <disk type="file" device="disk">

      <driver name="qemu" type="qcow2"/>

      <source file="/home/uos.qcow2"/>

      <target dev="vda" bus="virtio"/>

    </disk>

    <disk type="file" device="cdrom">

      <driver name="qemu" type="raw"/>

      <source file="/home/uos-server-20-1070-sw64.iso"/>

      <target dev="sda" bus="sata"/>

      <readonly/>

    </disk>

    <controller type="usb" index="0" model="qemu-xhci"/>

    <interface type="bridge">

      <source bridge="br0"/>

      <mac address="52:54:00:ad:ae:af"/>

      <model type="virtio"/>

    </interface>

    <console type="pty"/>

    <input type='tablet' bus='usb'/>

    <input type='keyboard' bus='usb'/>

    <graphics type="vnc" port="-1" listen="0.0.0.0"/>

    <video>

      <model type="virtio"/>

    </video>

  </devices>

</domain>