Support config hugepage kernel cmdline through kickstart
This is a requrement from Daisy4NFV Jira: DAISY-53 Change-Id: I6e37c7d13f278b7712f14314080761fc108b0e4d Signed-off-by: Zhijiang Hu <hu.zhijiang@zte.com.cn>
This commit is contained in:
parent
02fcbddc87
commit
866f2f3ca2
|
@ -15,8 +15,11 @@ logging --host=192.170.0.1 --port=514 --level=debug
|
||||||
%include /tmp/part-include
|
%include /tmp/part-include
|
||||||
zerombr
|
zerombr
|
||||||
#bootloader --location=mbr --driveorder=sda
|
#bootloader --location=mbr --driveorder=sda
|
||||||
|
#bootloader_append_hugepage_place_holder
|
||||||
|
#bootloader_append_isolcpus_place_holder
|
||||||
#####reboot
|
#####reboot
|
||||||
|
|
||||||
|
|
||||||
# The following is the partition information you requested
|
# The following is the partition information you requested
|
||||||
# Note that any partitions you deleted are not expressed
|
# Note that any partitions you deleted are not expressed
|
||||||
# here so unless you clear all partitions first, this is
|
# here so unless you clear all partitions first, this is
|
||||||
|
@ -201,15 +204,5 @@ NIC_CFG=/home/os_install/usrdata/nic_net_cfg.sh
|
||||||
#clear db_lv
|
#clear db_lv
|
||||||
[ -d /var/lib/mysql ] && { rm -rf /var/lib/mysql/*; echo "rm -rf /var/lib/mysql/*" >> /home/os_install/usrdata/pxe_install.log; }
|
[ -d /var/lib/mysql ] && { rm -rf /var/lib/mysql/*; echo "rm -rf /var/lib/mysql/*" >> /home/os_install/usrdata/pxe_install.log; }
|
||||||
|
|
||||||
#modify grubtool.cfg
|
|
||||||
GRUBTOOLCFG=/etc/grubtool.cfg
|
|
||||||
if [[ -e $GRUBTOOLCFG ]]; then
|
|
||||||
sed -i "s/^hugepage_size=.*/hugepage_size=\"pagevalue1\"/g" $GRUBTOOLCFG
|
|
||||||
sed -i "s/^hugepage_num=.*/hugepage_num=pagevalue2/g" $GRUBTOOLCFG
|
|
||||||
sed -i "s/^isolcpus=.*/isolcpus=\"isolvalue\"/g" $GRUBTOOLCFG
|
|
||||||
|
|
||||||
echo "modify /etc/grubtool.cfg & restart grubtool.service" >> /home/os_install/usrdata/pxe_install.log
|
|
||||||
fi
|
|
||||||
/bin/grubtool stop
|
|
||||||
sleep 30
|
sleep 30
|
||||||
%end
|
%end
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
#! /bin/bash
|
#! /bin/bash
|
||||||
|
|
||||||
###############################################################################################
|
|
||||||
# 功能:安装目标机配置的一些函数定义
|
|
||||||
###############################################################################################
|
|
||||||
# 定制root用户口令
|
|
||||||
function custom_ks_rootpwd
|
function custom_ks_rootpwd
|
||||||
{
|
{
|
||||||
local CFG_FILE=$1
|
local CFG_FILE=$1
|
||||||
|
@ -460,20 +456,20 @@ function custom_ks_hugepages
|
||||||
local CFG_FILE=$1
|
local CFG_FILE=$1
|
||||||
local KS_FILE=$2
|
local KS_FILE=$2
|
||||||
|
|
||||||
pxelog "starting custom_ks_hugepages!"
|
pxelog "start custom_ks_hugepages"
|
||||||
|
|
||||||
get_config $CFG_FILE "hugepages"
|
get_config $CFG_FILE "hugepages"
|
||||||
pages=$config_answer
|
pages=$config_answer
|
||||||
[[ $pages == "" ]] && pages=0
|
if [[ $pages != "" ]]; then
|
||||||
sed -i "s/pagevalue2/${pages}/g" $KS_FILE
|
get_config $CFG_FILE "hugepagesize"
|
||||||
|
sizes=$config_answer
|
||||||
|
[[ $sizes == "" ]] && sizes="1G"
|
||||||
|
[[ $sizes != "1G" && $sizes != "2M" ]] && { pxelog "[error]hugepagesize value error($sizes)" "console"; return 1; }
|
||||||
|
|
||||||
get_config $CFG_FILE "hugepagesize"
|
sed -i "s/#bootloader_append_hugepage_place_holder/bootloader --append=\"intel_iommu=on iommu=pt default_hugepagesz=${sizes} hugepagesz=${sizes} hugepages=${pages}\"/g" $KS_FILE
|
||||||
sizes=$config_answer
|
fi
|
||||||
[[ $sizes == "" ]] && sizes="1G"
|
|
||||||
[[ $sizes != "1G" && $sizes != "2M" ]] && { pxelog "[error]hugepagesize value error($sizes)" "console"; return 1; }
|
|
||||||
sed -i "s/pagevalue1/${sizes}/g" $KS_FILE
|
|
||||||
|
|
||||||
pxelog "started custom_ks_hugepages!\n"
|
pxelog "end custom_ks_hugepages ${sizes}, ${sizes}\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
function custom_ks_isolcpus
|
function custom_ks_isolcpus
|
||||||
|
@ -486,15 +482,12 @@ function custom_ks_isolcpus
|
||||||
get_config $CFG_FILE "isolcpus"
|
get_config $CFG_FILE "isolcpus"
|
||||||
isolcpus=$config_answer
|
isolcpus=$config_answer
|
||||||
if [[ $isolcpus != "" ]]; then
|
if [[ $isolcpus != "" ]]; then
|
||||||
sed -i "s/isolvalue/${isolcpus}/g" $KS_FILE
|
sed -i "s/#bootloader_append_isolcpus_place_holder/bootloader --append=\"isolcpus=${isolcpus}\"/g" $KS_FILE
|
||||||
else
|
|
||||||
sed -i "/isolvalue/d" $KS_FILE
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pxelog "started custom_ks_isolcpus!\n"
|
pxelog "end custom_ks_isolcpus ${isolcpus}\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function custom_ks_hostname
|
function custom_ks_hostname
|
||||||
{
|
{
|
||||||
local CFG_FILE=$1
|
local CFG_FILE=$1
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
Host Setup APIs
|
||||||
|
===============
|
||||||
|
|
||||||
|
API Usage
|
||||||
|
---------
|
||||||
|
from daisyclient.v1 import client as daisy_client
|
||||||
|
|
||||||
|
@memoized
|
||||||
|
def daisyclient():
|
||||||
|
return daisy_client.Client(version=1, endpoint="http://127.0.0.1:19292")
|
||||||
|
|
||||||
|
|
||||||
|
def host_get(host_id):
|
||||||
|
return daisyclient(request).hosts.get(host_id)
|
||||||
|
|
||||||
|
|
||||||
|
def host_update(host_id, **kwargs):
|
||||||
|
return daisyclient().hosts.update(host, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
Huge Page and CPU Isolation APIs Example
|
||||||
|
----------------------------------------
|
||||||
|
|
||||||
|
host_config = host_get(host_id)
|
||||||
|
host_config["hugepagesize"] = 1G
|
||||||
|
host_config["hugepages"] = 16
|
||||||
|
host_config["isolcpus"] = 0-5,12-17
|
||||||
|
host_update(host_id, **host_config)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue