add hugepages, kernel param, and vxlan support 87/787/2
authordavidplunkett <dp7642@att.com>
Thu, 23 May 2019 04:07:32 +0000 (04:07 +0000)
committerdavidplunkett <dp7642@att.com>
Thu, 23 May 2019 04:12:57 +0000 (04:12 +0000)
Allow kernel parameters such as hugepage settings
to be specific in the variable SRV_KERNEL_PARAMS and
setup mount points for hugepages during first boot
if hugepages is in the cmdline.

Setup interface for VXLAN in firstboot template.

Signed-off-by: davidplunkett <dp7642@att.com>
Change-Id: I56c87c85d657df9e781c8077ea010fc2a01b6e2f
Signed-off-by: davidplunkett <dp7642@att.com>
firstboot-genesis.sh.template
serverrc.template
ubuntu.seed.template

index 87eaddf..fe21ec8 100644 (file)
@@ -24,6 +24,20 @@ echo "Updating available packages"
 apt-get update 
 apt-get install -y --install-recommends linux-generic-hwe-16.04 ipmitool
 
+echo "Checking for hugepages"
+if grep hugepages /proc/cmdline ; then
+    HUGEPAGESZ=$(grep -o 'hugepagesz=[^ ]*' /proc/cmdline | cut -f2 -d'=')
+    echo "  Adding directory and mount for hugepages with size=$HUGEPAGESZ"
+    if [ -z "HUGEPAGESZ" ]; then
+        mkdir -p /dev/hugepages_$HUGEPAGESZ
+        echo "none   /dev/hugepages_$HUGEPAGESZ  hugetlbfs pagesize=$HUGEPAGESZ       0      0" >> /etc/fstab
+    else
+        mkdir -p /dev/hugepages
+        echo "none   /dev/hugepages  hugetlbfs       0      0" >> /etc/fstab
+    fi
+    mount -a
+fi
+
 # Adding 3 node cluster related changes
 swapoff  --all
 ln -s /etc/apparmor.d/usr.sbin.ntpd /etc/apparmor.d/disable/
@@ -171,5 +185,26 @@ END
     fi
 fi
 
+# Creating VXLAN interface
+
+if [ -n "@@SRV_VXLAN_INF@@" ]; then
+    echo "Configuring VXLAN Interface in the server"
+    tee -a /etc/network/interfaces << END
+
+# VXLAN
+auto @@SRV_VXLAN_INF@@
+iface @@SRV_VXLAN_INF@@ inet static
+address @@SRV_VXLAN_IP@@
+    netmask 255.255.255.0
+    mtu @@SRV_MTU@@
+END
+    ifup @@SRV_VXLAN_INF@@
+    if [ $? -eq 0 ]; then
+        echo " VXLAN interface Created"
+    else
+        echo " Failed to create VXLAN Interface"
+    fi
+fi
+
 exit
 
index b513bcf..fc8cd4d 100644 (file)
@@ -43,6 +43,7 @@ SRV_HTTP_BOOT_DEV=NIC.Slot.3-1-1
 # template to run to configure OS after first boot
 # current options are: firstboot.sh.template, firstboot-genesis.sh.tempate or firstboot-airship-iab.sh.template
 SRV_FIRSTBOOT_TEMPLATE=firstboot.sh.template
+SRV_KERNEL_PARAMS=
 
 # VLAN to use during build and for final network configuration
 SRV_VLAN=41
index 22f1577..957645e 100644 (file)
@@ -166,8 +166,9 @@ d-i preseed/late_command string \
     in-target /bin/bash -c 'echo -n -e "auto @@SRV_BOND@@.@@SRV_VLAN@@\niface @@SRV_BOND@@.@@SRV_VLAN@@ inet static\n    address @@SRV_IP@@\n    netmask @@SRV_NETMASK@@\n" >> /etc/network/interfaces'; \
     in-target /bin/bash -c 'echo -n -e "    gateway @@SRV_GATEWAY@@\n    dns-nameservers @@SRV_DNS@@\n    dns-search @@SRV_DNSSEARCH@@\n    vlan-raw-device @@SRV_BOND@@\n    mtu @@SRV_MTU@@\n" >> /etc/network/interfaces'; \
     in-target /bin/bash -c 'curl --noproxy "*" http://@@BUILD_WEBIP@@:@@BUILD_WEBPORT@@/sources.list > /etc/apt/sources.list'; \
-    in-target /bin/bash -c 'curl --noproxy "*" http://@@BUILD_WEBIP@@:@@BUILD_WEBPORT@@/@@SRV_NAME@@.firstboot.sh > /root/@@SRV_NAME@@.firstboot.sh; chmod +x /root/@@SRV_NAME@@.firstboot.sh';
-
+    in-target /bin/bash -c 'curl --noproxy "*" http://@@BUILD_WEBIP@@:@@BUILD_WEBPORT@@/@@SRV_NAME@@.firstboot.sh > /root/@@SRV_NAME@@.firstboot.sh; chmod +x /root/@@SRV_NAME@@.firstboot.sh'; \
+    in-target /bin/bash -c 'sed -i "s/GRUB_CMDLINE_LINUX=\"[^\"]*/& @@SRV_KERNEL_PARAMS@@/g" /etc/default/grub'; \
+    in-target /bin/bash -c 'update-grub'; 
 ### Finish
 # Reboot after the install is finished.
 d-i finish-install/reboot_in_progress note