Provision KVM VM without DHCP » History » Version 1
Trey Dockendorf, 11/15/2011 09:50 PM
| 1 | 1 | Trey Dockendorf | h1. Provision KVM VM without DHCP |
|---|---|---|---|
| 2 | |||
| 3 | This method is similar to the [[gPXE]] provisioning method, but the parameters are passed as kernel boot options. |
||
| 4 | |||
| 5 | h2. Prerequisites |
||
| 6 | |||
| 7 | In order to use direct kernel booting, the *vmlinuz* and *initrd.img* files need to exist in a storage pool. |
||
| 8 | |||
| 9 | I downloaded the two available for CentOS 6.0. |
||
| 10 | |||
| 11 | <pre> |
||
| 12 | cd /var/lib/libvirt/images |
||
| 13 | wget http://mirror.centos.org/centos/6/os/x86_64/isolinux/vmlinuz |
||
| 14 | wget http://mirror.centos.org/centos/6/os/x86_64/isolinux/initrd.img |
||
| 15 | </pre> |
||
| 16 | |||
| 17 | h2. Using virt-manager |
||
| 18 | |||
| 19 | 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 |
||
| 20 | |||
| 21 | *Kernel path*: /var/lib/libvirt/images/vmlinuz |
||
| 22 | *Initrd path*: /var/lib/libvirt/images/initrd.img |
||
| 23 | *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 |
||
| 24 | |||
| 25 | h2. command line using virsh |
||
| 26 | |||
| 27 | To make these changes edit the virtual machine's XML file through virsh |
||
| 28 | |||
| 29 | <pre> |
||
| 30 | virsh edit domain |
||
| 31 | </pre> |
||
| 32 | |||
| 33 | Below are the relevant lines, replace the IPs with those of your setup |
||
| 34 | |||
| 35 | <pre> |
||
| 36 | <os> |
||
| 37 | <type arch='x86_64' machine='rhel6.0.0'>hvm</type> |
||
| 38 | <kernel>/var/lib/libvirt/images/vmlinuz</kernel> |
||
| 39 | <initrd>/var/lib/libvirt/images/initrd.img</initrd> |
||
| 40 | <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> |
||
| 41 | <boot dev='hd'/> |
||
| 42 | </os> |
||
| 43 | </pre> |