我有一个本地建造的qemu。我正在使用libvirt python API来定义XML。我得到错误:


  libvirt:错误:内部错误:子进程(LC_ALL = C
  路径= / usr / local / sbin:/ usr / local / bin:/ usr / sbin:/ usr / bin:/ sbin:/ bin
  / home / deepti / testqemu / bin / qemu-system-arm -help)意外退出
  状态126:libvirt:错误:无法执行二进制
  / home / deepti / testqemu / bin / qemu-system-arm:权限被拒绝回溯
  (最近一次通话最近):文件“ testcustomQemu.py”,位于第70行
  
      dom = conn.defineXML(xmlconfig)文件“ /home/deepti/.virtualenvs/testlibvirt/local/lib/python2.7/site-packages/libvirt.py”,
  第3685行,在defineXML中
      如果ret为None:raise libvirtError('virDomainDefineXML()failed',conn = self)libvirt.libvirtError:内部错误:子进程
  (LC_ALL = C
  路径= / usr / local / sbin:/ usr / local / bin:/ usr / sbin:/ usr / bin:/ sbin:/ bin
  / home / deepti / testqemu / bin / qemu-system-arm -help)意外退出
  状态126:libvirt:错误:无法执行二进制
  / home / deepti / testqemu / bin / qemu-system-arm:权限被拒绝


/home/deepti/testqemu的所有权是root:root。将权限更改为+x也不起作用。

我想念什么。如何获取我的自定义qemu?

我的脚本和xml如下:

import libvirt
import sys

xmlconfig = """<domain type='qemu' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
  <name>limom_instance</name>
  <uuid>35615c44-b004-4b3f-9f42-da182b9662ef</uuid>
  <memory unit='KiB'>786432</memory>
  <currentMemory unit='KiB'>786432</currentMemory>
  <vcpu>1</vcpu>
  <os>
    <type arch='armv7l' machine='limott'>hvm</type>
    <kernel>/home/deepti/limom/FinalArtifacts/kerneldist1/zImage</kernel>
    <dtb>/home/deepti/limom/FinalArtifacts/dtbdist1/emmc.dtb</dtb>
  </os>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <devices>
    <emulator>/home/deepti/testqemu/bin/qemu-system-arm</emulator>
    <serial type='pty'>
      <target port='0'/>
    </serial>
    <serial type='pty'>
      <target port='1'/>
    </serial>
    <serial type='pty'>
      <target port='2'/>
    </serial>
    <serial type='pty'>
      <target port='3'/>
    </serial>
    <console type='pty'>
      <target type='serial' port='0'/>
    </console>
    <memballoon model='none'/>
  </devices>
  <qemu:commandline>
    <qemu:arg value='-sdl'/>
    <qemu:arg value='-show-cursor'/>
    <qemu:arg value='-nographic'/>
    <qemu:arg value='-sd'/>
    <qemu:arg value='/home/deepti/limom/FinalArtifacts/emmc.dat'/>
  </qemu:commandline>
</domain>"""

conn = libvirt.open('qemu:///system')
if conn == None:
    print('Failed to open connection to qemu:///system')
    exit(1)

uri = conn.getURI()
print('Canonical URI: '+uri)
dom = conn.defineXML(xmlconfig)
if dom == None:
    print('Failed to define a domain from an XML definition')
    exit(1)


conn.close()

最佳答案

在Ubuntu 18上,我必须将自定义二进制文件和固件/ BIOS文件夹的路径添加到

/etc/apparmor.d/abstractions/libvirt-qemu

10-01 06:46
查看更多