根据报错信息,XML中缺少操作系统类型的定义。在<domain>标签内添加<os>标签,并在其中定义操作系统类型,例如:

<os>
  <type arch='x86_64' machine='pc-i440fx-2.9'>hvm</type>
  <loader type="bios"></loader>
</os>

其中,arch属性指定CPU架构,machine属性指定虚拟机使用的机器类型,type标签的内容指定操作系统类型。

完整的XML示例:

<domain>
  <name>hulian</name>
  <memory unit="MB">4096</memory>
  <vcpu>2</vcpu>
  <os>
    <type arch='x86_64' machine='pc-i440fx-2.9'>hvm</type>
    <loader type="bios"></loader>
  </os>
  <features>
    <hyperv>
      ... 
    </hyperv>
  </features>
  <devices>
    ...
  </devices>
</domain>
Libvirt 虚拟机创建错误:XML 错误:an os <type> must be specified

原文地址: https://www.cveoy.top/t/topic/f2Pp 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录