Project

General

Profile

Provision KVM VM without DHCP » History » Revision 3

Revision 2 (Trey Dockendorf, 11/15/2011 09:52 PM) → Revision 3/5 (Ohad Levy, 11/17/2011 09:46 AM)

{{toc}} 

 h1. Provision KVM VM without DHCP 

 This method is similar to the [[gPXE]] provisioning method, but the parameters are passed as kernel boot options. 

 h2. Prerequisites 

 In order to use direct kernel booting, the *vmlinuz* and *initrd.img* files need to exist in a storage pool. 

 I downloaded the two available for CentOS 6.0. 

 <pre> 
 cd /var/lib/libvirt/images 
 wget http://mirror.centos.org/centos/6/os/x86_64/isolinux/vmlinuz 
 wget http://mirror.centos.org/centos/6/os/x86_64/isolinux/initrd.img 
 </pre> 

 h2. Using virt-manager 

 From within the virtual machine's details, select the *Boot Options*.    Expand *Direct kernel boot* and enter the following information.    Replace the IP addresses with those specific to your setup 

 *Kernel path*: /var/lib/libvirt/images/vmlinuz 
 *Initrd path*: /var/lib/libvirt/images/initrd.img 
 *Kernel arguments*: ks=http://foremanserver.tld/unattended/provision?static=yes ksdevice=bootif network kssendmac ip=192.168.1.2 netmask=255.255.255.0 gateway=192.168.1.1 dns=192.168.1.1 

 h2. command line using virsh 

 To make these changes edit the virtual machine's XML file through virsh 

 <pre> 
 virsh edit domain 
 </pre> 

 Below are the relevant lines, replace the IPs with those of your setup 

 <pre><code class="xml"> <pre> 
   <os> 
     <type arch='x86_64' machine='rhel6.0.0'>hvm</type> 
     <kernel>/var/lib/libvirt/images/vmlinuz</kernel> 
     <initrd>/var/lib/libvirt/images/initrd.img</initrd> 
     <cmdline>ks=http://foremanserver.tld/unattended/provision?static=yes ksdevice=bootif network kssendmac ip=192.168.1.2 netmask=255.255.255.0 gateway=192.168.1.1 dns=192.168.1.1</cmdline> 
     <boot dev='hd'/> 
   </os></code> </os> 
 </pre>