?

Log in

Setting up a TFTP server, PXE boot server with libvirt and virt-manager for ovirt-node

About
This post is about setup virt-manager to autoinstall oVirt Node as virtual machine via libvirt/PXE. Additionaly, TFTP server will be installed in the host machine which runs the virt-manager.

System
I have created the post based on Fedora 20, fell free to post comments about your experience in others versions or distros.

Installing and Setting packages
# yum install virt-manager tftp tftp-server libvirt livecd-tools -y

Reload libvirtd to create virbr0
# /bin/systemctl restart libvirtd.service

Notice that now you will have the virbr0 interface:
# ip addr
3: virbr0: NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
link/ether 56:14:04:78:c4:f7 brd ff:ff:ff:ff:ff:ff
inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
valid_lft forever preferred_lft forever

1) Configure the XML of the default libvirt network to include the PXE settings:
bootp file='pxelinux.0' server='192.168.122.1'

# virsh net-destroy default
# virsh net-edit default
# virsh net-start default



2) Enable tftp-server
# vi /etc/xinet.d/tftp
Replace:
disable = yes
To:
disable = no

# /bin/systemctl restart xinetd.service

3) Download ovirt-node image and setup tftpboot
Download the last oVirt Node stable available:
# wget http://resources.ovirt.org/releases/3.4.0-ga/iso/ovirt-node-iso-3.0.4-1.0.201401291204.vdsm34.el6.iso

Convert livecd to pxeboot image:
# livecd-iso-to-pxeboot ./ovirt-node-iso-3.0.4-1.0.201401291204.vdsm34.el6.iso

Copy the files generated to tftp directory:
# cp -Rpv tftpboot/* /var/lib/tftpboot/

Edit default file and include ovirt node settings
# vi /var/lib/tftpboot/pxelinux.cfg/default

Example:
DEFAULT pxeboot
TIMEOUT 20
PROMPT 0
LABEL pxeboot
    KERNEL vmlinuz0
    APPEND rootflags=loop initrd=initrd0.img root=live:/ovirt-node-iso-3.0.4-1.0.201401291204.vdsm34.el6.iso rootfstype=auto ro liveimg check RD_NO_LVM rd_NO_MULTIPATH rootflags=ro crashkernel=128M elevator=deadline install quiet max_loop=256 rhgb rd_NO_LUKS rd_NO_MD rd_NO_DM firstboot storage_init=/dev/vda ssh_pwauth=1 adminpw=ovonFQQPIAM9o management_server=192.168.100.228 BOOTIF=link
IPAPPEND 2


Where:
- firstboot: first boot
- adminpw: Sets an encrypted, temporary password for admin (ovonFQQPIAM9o is ovirt encrypted)
- management_server: Specifies - the management server to be used.
- storage_init: Initialize a local storage device. (Depending can be vda/sda)
- ssh_pwauth: Enable ssh
- BOOTIF: specify network for bridge (link = autodetect)

Setting Firewalld
firewall-cmd --permanent --add-service=tftp
firewall-cmd --reload

Virt-manager
First, check if your host has enabled the nested-kvm, if not, enable it and via virt-manager interface copy the Processor flags to the virtual-machine. After that, create your new virtual machine for oVirt Node based on PXE boot.



Links related to this topic
http://www.ovirt.org/Node_PXE
http://www.ovirt.org/Node_Autoinstall
http://dougsland.livejournal.com/122359.html
http://dummdida.blogspot.com.br/2012/06/doing-pxe-with-libvirt-virt-manager.html
https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Virtualization_Host_Configuration_and_Guest_Installation_Guide/chap-Virtualization_Host_Configuration_and_Guest_Installation_Guide-Libvirt_network_booting.html#idp18883360

Comments

So, you say this is how you test rhev-h?
I definitely think I can find this useful.
And - I can do it on my Fedora 20, you say.

I was struggling recently (this whole week so far!) testing rhev-h ISO.. heh..

Thank you for sharing.

October 2016

S M T W T F S
      1
2345678
9101112131415
16171819202122
23242526272829
3031     

Tags

Powered by LiveJournal.com