[ovirt-users] Ovirt Node Next mass deploy

Giorgio Biacchi giorgio at di.unimi.it
Fri Jul 22 08:47:39 EDT 2016


On 07/21/2016 01:40 PM, Giorgio Biacchi wrote:
> Hi list,
> starting from here
> (http://lists.ovirt.org/pipermail/devel/2016-January/012073.html) and adjusting
> broken links now I'm able to pxe boot CentOS 7 + kernel arguments:
> 
> LABEL node_4
>  MENU LABEL Ovirt Node 4.0
>  KERNEL centos7/x86_64/vmlinuz
>  APPEND initrd=centos7/x86_64/initrd.img ramdisk_size=100000 ksdevice=link
> inst.ks=http://172.20.22.10/ks/ks_ovirt-node-4.0.cfg
> inst.updates=http://jenkins.ovirt.org/job/ovirt-node-ng_master_build-artifacts-fc22-x86_64/lastSuccessfulBuild/artifact/exported-artifacts/product.img
> inst.stage2=http://mi.mirror.garr.it/mirrors/CentOS/7/os/x86_64/
> 
> I think this method is the best for me because with a custom kickstart I can set
> ssh keys and custom hooks and have a fully automated installation, but I'm not
> sure if the lastSuccessfulBuild/artifact/exported-artifacts/product.img is the
> correct image to pass to have a "stable" node.
> 
> There's any other "stable" product.img I can use?
> 
> Thanks
> 

Hello again,
just found out that the simplest method to obtain a stable product.img and
ovirt-node-ng-image.squashfs.img is to loop mount an ovirt node iso, get the
files from there and make them available via http.

Now with a modified PXE and kickstart file I'm able to automate the installation
process.

Here's my PXE conf and kickstart file, maybe they will be useful for someone...

--- <PXE> ---

LABEL node_4
MENU LABEL Ovirt Node 4.0.2 (testing)
KERNEL centos7/x86_64/vmlinuz
APPEND initrd=centos7/x86_64/initrd.img ramdisk_size=100000 ksdevice=link
inst.ks=http://172.20.22.10/ks/ks_ovirt-node-4.0.cfg
inst.updates=http://172.20.22.10/node-4.0.2/product.img
inst.stage2=http://mi.mirror.garr.it/mirrors/CentOS/7/os/x86_64/

--- </PXE> ---

--- <Kickstart> ---
#
# CentOS 7.2 compatible kickstart for CI auto-installation
#

lang en_US.UTF-8
keyboard us
timezone --utc Etc/UTC --ntpservers=tempo.ien.it
auth --enableshadow --passalgo=sha512
selinux --permissive
network --bootproto=dhcp --onboot=on
firstboot --reconfig

#Set root password
rootpw --iscrypted <place crypted password here>

# or use plain text
#rootpw --plaintext ovirt

reboot

clearpart --all --initlabel --disklabel=gpt
bootloader --timeout=1

# FIXME This should be fixed more elegantly with
https://bugzilla.redhat.com/663099#c14
# At best we could use: autopart --type=thinp
# autopart can not be used in CI currently, because updates.img is not passed to
# the installation

# Manual layout:
reqpart --add-boot
part pv.01 --size=42000 --grow
volgroup HostVG pv.01
logvol swap --vgname=HostVG --name=swap --fstype=swap --recommended
logvol none --vgname=HostVG --name=HostPool --thinpool --size=40000 --grow
logvol / --vgname=HostVG --name=root --thin --poolname=HostPool
--fsoptions="defaults,discard" --size=6000
logvol /var --vgname=HostVG --name=var --thin --poolname=HostPool
--fsoptions="defaults,discard" --size=15000

#
# The trick is to loop in the squashfs image as a device
# from the host
#
liveimg --url="http://172.20.22.10/node-4.0.2/ovirt-node-ng-image.squashfs.img"

%pre
# Assumption: A virtio device with the serial livesrc is passed, pointing
# to the squashfs on the host.
mkdir -p /mnt/livesrc
mount /dev/disk/by-id/virtio-livesrc /mnt/livesrc
%end

%post
PATH=/bin:/sbin:/usr/bin:/usr/sbin
export PATH

#Setup public ssh keys, at least ovirt-engine one..

cd /root
mkdir --mode=700 .ssh

cat >> .ssh/authorized_keys << "PUBLIC_KEY"
ssh-rsa
AAAAB3NzaC1yc2EAAAADAQABAAABAQDAhTqyQ6dloDVxjcmDw0CQHDXc6EVtvOqKzCUrNbZ1zt3sZveaWsOVE5NnzFQ6xvgGNXjou4eRuWcdgCows02GqVOPVYqlt8OBThU5lDqPwL7Znz33VO9vKegz8LgotRLSu7ivPPU7zlkNoEBGIDlf3VaQ1K7c+WzflNYkq4qn2dZdtqqQvqgXdAprfC99A37txNzHtu4X/KEWLc67QWPno3a8wpHl0bMYqaYWHLoROcyTvyXvJWrGYRhV0VUqNKcqqFL6fIWwv0ezqCkny1hqKiPch2Re8mEa84Fbd5tFscXhJ2n/R3C+5UkyVbAQPEiL7OhvDPe//USF+MWLMBQ9
ovirt-engine
PUBLIC_KEY

chmod 600 .ssh/authorized_keys
chmod 700 .ssh
chcon -t ssh_home_t .ssh/
chcon -t ssh_home_t .ssh/authorized_keys

#My custom VDSM hooks

mkdir -p /usr/libexec/vdsm/hooks/before_vdsm_start
cd /usr/libexec/vdsm/hooks/before_vdsm_start

cat >> 10_set_ib0_connected_mode << "EOF"
#!/bin/sh

echo Setting IB connected mode
echo connected > /sys/class/net/ib0/mode
sleep 3
MODE=$(cat /sys/class/net/ib0/mode)
RATE=$(cat /sys/class/infiniband/mlx4_0/ports/1/rate)
echo ib0 is now in $MODE mode with rate $RATE
EOF

chmod +x /usr/libexec/vdsm/hooks/before_vdsm_start/10_set_ib0_connected_mode

mkdir -p /usr/libexec/vdsm/hooks/after_network_setup
cd /usr/libexec/vdsm/hooks/after_network_setup

cat >> 10_set_ib0_connected_mode << "EOF"
#!/bin/sh

echo connected > /sys/class/net/ib0/mode
sleep 3
ip link set mtu 65520 dev ib0
EOF

chmod +x /usr/libexec/vdsm/hooks/after_network_setup/10_set_ib0_connected_mode

# FIXME maybe the folowing lines can be collapsed
# in future into i.e. "nodectl init"
set -x
imgbase --debug layout --init

%end
--- </Kickstart> ---

As last thing.. installing a node from the iso give me a corrupted imagebase
because discard option is missing from fstab.

Bye
-- 
gb

PGP Key: http://pgp.mit.edu/
Primary key fingerprint: C510 0765 943E EBED A4F2 69D3 16CC DC90 B9CB 0F34


More information about the Users mailing list