【发布时间】:2017-10-03 19:47:12
【问题描述】:
2017 年 10 月 4 日更新:请参阅下面的答案。这要归功于 DanielB,因为如果没有 Daniel 的帮助我无法解决问题,所以我会接受他的回答而不是我自己的回答。
我是 libvirt 和系统管理方面的新手,所以如果我问愚蠢的问题,请原谅,尽管我已经尝试尽可能多地做功课。
我的问题是:如何在使用 virsh 创建 VM 后立即从 CDROM 启动以安装来宾操作系统?
我正在开发 Ubuntu Desktop 14.04、virsh 1.2.2。
当我使用 'virt-install' 并将 ISO 文件路径作为其 '--cdrom' 参数传递时,我可以成功打开 virt-viewer 窗口,该窗口允许我安装来宾操作系统。
据我所知,我也可以使用 XML 定义创建 VM,因此我转储了使用“virt-install”创建的 VM 的 XML 定义。然后我希望在我启动 VM 时会自动打开“virt-viewer”窗口,以便我可以安装来宾操作系统。但它没有。
以下是我的虚拟机的 XML 定义。
如果我启用加载程序行,因为我在下面标记为“可疑”,我会收到一条错误消息“错误:内部错误:无法加载 AppArmor 配置文件'libvirt-1092d51d-3b66-46a2-bf9b-71e13dc91799'” .我这样做是因为我正在尝试libvirt's document here 中给出的示例。
但是,如果我禁用“loader”行并运行virsh create def_domain_test.xml,则可以成功创建域并显示为“正在运行”,但是没有打开 virt-viewer 窗口,所以我无法在 VM 上安装来宾操作系统。
谁能帮我解决这个问题?我不明白为什么 'virt-install' 可以调出 virt-viewer 而我的 XML 定义却不能。我可能错误地配置了域 XML 定义,但即使我尝试阅读尽可能多的文档,我也无法弄清楚我错在哪个特定部分。
如果需要,请随时询问更多详细信息。
<!-- Let's call this file 'def_domain_test.xml' -->
<domain type='kvm'>
<name>vm_c2</name>
<memory unit='KiB'>2097152</memory>
<currentMemory unit='KiB'>2097152</currentMemory>
<vcpu placement='static'>1</vcpu>
<os>
<type arch='x86_64' machine='pc-i440fx-trusty'>hvm</type>
<!-- Next line is suspicious! -->
<!-- <loader readonly='yes' secure='no' type='rom'>/usr/lib/xen-4.4/boot/hvmloader</loader> -->
<boot dev='cdrom'/>
<boot dev='hd'/>
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<devices>
<emulator>/usr/bin/kvm-spice</emulator>
<!-- Here is the hard drive that doesn't have OS installed. -->
<disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
<source file='/home/me/me/testing/vm/pool/mvs_vol_c2'/>
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
</disk>
<!-- Here is the Ubuntu ISO. -->
<disk type='file' device='cdrom'>
<driver name='qemu' type='raw'/>
<source file='/home/me/me/testing/vm/ubuntu-14.04.5-server-amd64.iso'/>
<target dev='hdc' bus='ide'/>
<readonly/>
<alias name='ide0-1-0'/>
<address type='drive' controller='0' bus='1' target='0' unit='0'/>
</disk>
<controller type='usb' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
</controller>
<controller type='pci' index='0' model='pci-root'/>
<controller type='ide' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
</controller>
<interface type='network'>
<source network='default'/>
<model type='rtl8139'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
<serial type='pty'>
<target port='0'/>
</serial>
<console type='pty'>
<target type='serial' port='0'/>
</console>
<input type='mouse' bus='ps2'/>
<input type='keyboard' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes'/>
<video>
<model type='cirrus' vram='9216' heads='1'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<memballoon model='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</memballoon>
</devices>
</domain>
【问题讨论】:
标签: installation ubuntu-14.04 kvm libvirt