Pass kickstart file to virtual manager xml file

2019-07-30 00:09发布

问题:

I need to pass kickstart file to xml for creating a virtual device using virt-install.

<os>
    <type arch="x86_64" machine="pc-i440fx-xenial">hvm</type>
    <loader>/usr/lib/xen/boot/hvmloader</loader>
    <kernal>/boot/vmlinuz-3.10.0-327.el7.x86_64</kernal>
    <initrd>/boot/initrd.img-4.4.0-59-generic</initrd>
    <cmdline>ks=http://ipaddr/try.cfg ip=ip netmask=255.255.255.0</cmdline>
    <bootmenu enable="yes" />
</os>

Is this the right way? I followed the steps given in this tutorial. But I get the following error:

File "/usr/lib64/python2.7/site-packages/libvirt.py", line 1029, in create

if ret == -1: raise libvirtError ('virDomainCreate() failed', dom=self) libvirt.libvirtError: unable to stat:

/boot/vmlinuz-3.10.0-327.el7.x86_64: No such file or directory

回答1:

The overall syntax you've used is correct, but you've got some mistakes in the data you've provided. In particular you've provided a kernel image for the <initrd> option - that should be pointing to an initrd image. Also, you generally won't want to be using the kernel+initrd from your host OS /boot directory at all. Rather you'd want to get the kernel+initrd for the OS installer. If you were trying to install Fedora in your guest, you'd grab the files from

http://dl.fedoraproject.org/pub/fedora/linux/releases/25/Server/x86_64/os/images/pxeboot/

and put them in /var/lib/libvirt/images/ and point your XML to those.