17 KVM虚拟机配置-XML配置文件示例


17 KVM虚拟机配置-XML配置文件示例17.1 概述17.2 示例一17.3 示例二


17.1 概述

本节给出一个基本的AArch64虚拟机和一个x86_64虚拟机的XML配置文件示例,仅供参考。

17.2 示例一

一个包含基本元素的AArch64架构虚拟机的XML配置文件,其内容示例如下:

type='kvm'>
  openEulerVM
  unit='GiB'>8
  4
 
arch='aarch64' machine='virt'>hvm
readonly='yes' type='pflash'>/usr/share/edk2/aarch64/QEMU_EFI-pflash.raw
/var/lib/libvirt/qemu/nvram/openEulerVM.fd
 
 

version='3'/>
 
  mode='host-passthrough'>
      sockets='2' cores='2' threads='1'/>
 
  1
  offset='utc'/>
  destroy
  restart
  restart
 
/usr/libexec/qemu-kvm
type='file' device='disk'>
  name='qemu' type='qcow2' iothread="1"/>
  file='/mnt/openEuler-image.qcow2'/>
  dev='vda' bus='virtio'/>
  order='1'/>

type='file' device='cdrom'>
  name='qemu' type='raw'/>
  file='/mnt/openEuler-22.03-LTS-aarch64-dvd.iso'/>
 
  dev='sdb' bus='scsi'/>
  order='2'/>

type='bridge'>
  bridge='br0'/>
  type='virtio'/>

type='pty'/>
     
          type='virtio'/>
     
      type='scsi' index='0' model='virtio-scsi'/>
type='usb' model='ehci'/>
type='tablet' bus='usb'/>
type='keyboard' bus='usb'/>
type='vnc' listen='0.0.0.0' passwd='n8VfjbFK'/>
 
  type='dynamic' model='dac' relabel='yes'/>

17.3 示例二

一个包含基本元素及总线元素x86_64架构虚拟机的XML配置文件,其配置示例如下:

type='kvm'>
openEulerVM
unit='KiB'>8388608
unit='KiB'>8388608
placement='static'>4
1

  arch='x86_64' machine='pc-i440fx-4.0'>hvm


 

mode='host-passthrough' check='none'>
  sockets='2' cores='2' threads='1'/>

offset='utc'/>
destroy
restart
restart

  /usr/libexec/qemu-kvm
  type='file' device='disk'>
    name='qemu' type='qcow2' iothread='1'/>
    file='/mnt/openEuler-image.qcow2'/>
    dev='vda' bus='virtio'/>
    order='1'/>
   
type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
 
  type='scsi' index='0' model='virtio-scsi'>
 
  type='virtio-serial' index='0'>
 
  type='usb' index='0' model='ehci'>
 
  type='sata' index='0'>
 
  type='pci' index='0' model='pci-root'/>
  type='bridge'>
    address='52:54:00:c1:c4:23'/>
    bridge='virbr0'/>
    type='virtio'/>
 
  type='pty'>
    type='isa-serial' port='0'>
      name='isa-serial'/>
   
 
  type='pty'>
    type='serial' port='0'/>
 
  type='tablet' bus='usb'>
   
type='usb' bus='0' port='1'/>
 
  type='keyboard' bus='usb'>
   
type='usb' bus='0' port='2'/>
 
  type='mouse' bus='ps2'/>
  type='keyboard' bus='ps2'/>
  type='vnc' port='-1' autoport='yes' listen='0.0.0.0'>
    type='address' address='0.0.0.0'/>
 
 
    type='vga' vram='16384' heads='1' primary='yes'/>
   
type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
 
  model='virtio'>
 


? 点赞,你的认可是我创作的动力!

⭐️ 收藏,你的青睐是我努力的方向!


有什么吐槽或反馈意见,直接告诉我!

温馨提示:如出现二维码失效也可直接添加微信号:ysc13803862469

请使用浏览器的分享功能分享到微信等