使用与AppArmor相关的libvirt错误创建虚拟机

Ras*_*esh 5 virtualization qemu libvirt

我正在尝试使用libvirt使用以下命令创建虚拟机:

virsh create file
Run Code Online (Sandbox Code Playgroud)

内容"file"

<domain type='qemu' id='3'>
        <name>testvm</name>
        <memory>100</memory>
        <vcpu>1</vcpu>
        <os>
                <type arch='i686'>hvm</type>
        </os>
        <devices>
                <disk type='file' device='disk'>
                        <source file='/libtmp/VM-linux.0.2.img'/>
                        <target dev='hdc'/>
                </disk>
        </devices>
        <on_reboot>restart</on_reboot>
        <on_poweroff>preserve</on_poweroff>
        <on_crash>restart</on_crash>
</domain>
Run Code Online (Sandbox Code Playgroud)

这是发生的错误。

error: Failed to create domain from file
error: internal error cannot load AppArmor profile 'libvirt-9cb01efc-ed3b-ff8e-4de5-7227d311dd15'
Run Code Online (Sandbox Code Playgroud)

我无需加载映像文件即可创建虚拟机。

每次配置文件名称不断更改。我试图停止它并创建虚拟机,但出现了同样的错误。

任何指针将非常有帮助。

Pet*_*etr 5

我有同样的问题,原因是我有一个不好的主意,将只读CDROM映像放置到/ etc中,如下所示:

<disk type="file" device="cdrom">
  <driver name='qemu' type="raw" />
  <source file="/etc/libvirt/qemu/cdrom.iso" />
  <target dev='hdb' bus='virtio'/>
  <readonly/>
</disk>
Run Code Online (Sandbox Code Playgroud)

移至/ var会删除错误消息,并允许启动虚拟机。这行:

<source file="/var/lib/libvirt/images/cdrom.iso" />
Run Code Online (Sandbox Code Playgroud)


Lar*_*ari 4

这是 libvirt 中的一个错误。请参阅https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/665531

使用“virsh edit domainname”命令编辑虚拟域的 xml 定义。在 xml 定义中将 type='host_device' 替换为 type='raw'。