【问题标题】:Install Ubuntu 16.04 with libvirt and kickstart使用 libvirt 和 kickstart 安装 Ubuntu 16.04
【发布时间】:2018-02-27 15:51:27
【问题描述】:

我目前正在尝试设置一个虚拟机,当我尝试启动这个虚拟机时,我遇到了引用 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

这不起作用。当我尝试打开虚拟机时,它一直卡在Booting from ROM

【问题讨论】:

  • kernel 不是kernal
  • 现在用“i”:&lt;kirnil&gt;
  • 修正了错字,但仍然出错
  • 现在你用“e”打开了标签,下一步:用“e”关闭标签
  • 我已经完成了,但没有更新问题,但现在完成了

标签: python virtual-machine kvm libvirt


【解决方案1】:

该元素旨在包含 Linux 压缩内核映像。您已经提供了 ISO 映像的路径,所以这永远不会起作用。

如果要安装 ISO 映像,则配置指向 ISO 映像的虚拟 CDROM,不要使用 kernel/initrd 元素。

【讨论】:

  • 但是&lt;cmdline&gt; kickstart 文件无法使用
  • 我已经更新了问题和代码
猜你喜欢
  • 2016-09-27
  • 1970-01-01
  • 2018-07-26
  • 1970-01-01
  • 2017-04-12
  • 2018-01-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多