我正在尝试设置一个虚拟机我正在引用this question的问题,当我尝试启动此虚拟机时,它无法与kickstart一起使用
def makeKvm(name, conn):
xmldesc = """
<domain type="kvm">
<name>""" + name + """</name>
<memory unit='GB'>1</memory>
<vcpu>1</vcpu>
<os>
<type arch='x86_64' machine='pc'>hvm</type>
<kernel>/var/lib/libvirt/media/./casper/vmlinuz.efi</kernel>
<initrd>/var/lib/libvirt/media/./casper/initrd.lz</initrd>
<cmdline>console=ttyS0 ks=https://pastebin.com/raw/6TznVUuN</cmdline>
</os>
<iothreads>1</iothreads>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>preserve</on_crash>
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
<source file='/var/lib/libvirt/pool/""" + name + """.img'/>
<target dev='vda' bus='virtio'/>
</disk>
<disk type='file' device='cdrom'>
<driver name='qemu' type='raw'/>
<source file='/var/lib/libvirt/iso/ubuntu-16.04.3-desktop-amd64.iso'/>
<target dev='hdb' bus='virtio'/>
<readonly/>
</disk>
<interface type='bridge'>
<source bridge='br0'/>
<model type='virtio'/>
</interface>
<input type='mouse' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes' listen='0.0.0.0' keymap='en-us'/>
</devices>
</domain>
"""
dom = conn.defineXML(xmldesc)
return dom
这不起作用。当我尝试打开VM时,它仍然停留在Booting from ROM
答案 0 :(得分:2)
该元素旨在包含Linux压缩内核映像。您已经提供了ISO映像的路径,因此这永远不会起作用。
如果要安装ISO映像,请配置指向ISO映像的虚拟CDROM,而不是使用kernel / initrd元素。