使用libvirt和kickstart安装Ubuntu 16.04

我正在尝试设置一个VM,当我尝试启动此vm时,我正在引用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时,它仍然停留在从ROM启动时

解决方法:

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

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

上一篇:Openstack Queen版本之guestfish修改centos7云镜像解决ssh无法连接VM实例


下一篇:python – libvirt – 确定域通过API使用的卷