os-xenpai: add option to disable FS journaling

Add option "-r DISABLE_JOURNALING" to control if FS journaling
would be disable or not.

Change-Id: I0aeddf949a325be630110ece7593c40b7bc80404
This commit is contained in:
naichuans 2017-08-29 03:13:16 +00:00
parent 5078424491
commit 59eec59cff
3 changed files with 53 additions and 9 deletions

View File

@ -52,6 +52,8 @@ flags:
-n No devstack, just create the JEOS template that could be
exported to an xva using the -e option.
-r Disable journaling if this flag is set. It will reduce disk IO, but
may lead to file system unstable after long time use
An example run:
@ -87,6 +89,7 @@ JEOS_TEMP_NAME="jeos_template_for_ubuntu"
NODE_TYPE="all"
NODE_NAME=""
CONTROLLER_IP=""
DISABLE_JOURNALING="false"
# Get Positional arguments
set +u
@ -103,7 +106,7 @@ REMAINING_OPTIONS="$#"
# Get optional parameters
set +e
while getopts ":t:d:fnl:j:e:o:s:w:a:i:m:" flag; do
while getopts ":t:d:fnrl:j:e:o:s:w:a:i:m:" flag; do
REMAINING_OPTIONS=$(expr "$REMAINING_OPTIONS" - 1)
case "$flag" in
t)
@ -162,6 +165,9 @@ while getopts ":t:d:fnl:j:e:o:s:w:a:i:m:" flag; do
NODE_NAME="$OPTARG"
REMAINING_OPTIONS=$(expr "$REMAINING_OPTIONS" - 1)
;;
r)
DISABLE_JOURNALING="true"
;;
\?)
print_usage_and_die "Invalid option -$OPTARG"
;;
@ -516,11 +522,14 @@ LOCALCONF_CONTENT_ENDS_HERE
# begin installation process
cd $DOM0_TOOL_DIR
OPTARGS=""
if [ $FORCE_SR_REPLACEMENT = 'true' ]; then
./install_on_xen_host.sh -d $DEVSTACK_SRC -l $LOGDIR -w $WAIT_TILL_LAUNCH -f
else
./install_on_xen_host.sh -d $DEVSTACK_SRC -l $LOGDIR -w $WAIT_TILL_LAUNCH
OPTARGS="$OPTARGS -f"
fi
if [ $DISABLE_JOURNALING = 'true' ]; then
OPTARGS="$OPTARGS -r"
fi
./install_on_xen_host.sh -d $DEVSTACK_SRC -l $LOGDIR -w $WAIT_TILL_LAUNCH $OPTARGS
END_OF_XENSERVER_COMMANDS

View File

@ -35,22 +35,26 @@ source $CONF_DIR/xenrc
# Defaults for optional arguments
DEVSTACK_SRC=${DEVSTACK_SRC:-"https://github.com/openstack-dev/devstack"}
LOGDIR="/opt/stack/devstack_logs"
DISABLE_JOURNALING="false"
# Number of options passed to this script
REMAINING_OPTIONS="$#"
# Get optional parameters
set +e
while getopts ":d:l:" flag; do
while getopts ":d:l:r" flag; do
REMAINING_OPTIONS=$(expr "$REMAINING_OPTIONS" - 1)
case "$flag" in
d)
DEVSTACK_SRC="$DEVSTACK_SRC"
DEVSTACK_SRC="$OPTARG"
REMAINING_OPTIONS=$(expr "$REMAINING_OPTIONS" - 1)
;;
l)
LOGDIR="$LOGDIR"
LOGDIR="$OPTARG"
REMAINING_OPTIONS=$(expr "$REMAINING_OPTIONS" - 1)
;;
r)
DISABLE_JOURNALING="true"
;;
\?)
print_usage_and_die "Invalid option -$OPTARG"
;;
@ -164,6 +168,27 @@ $SCRIPT_DIR/persist_domU_interfaces.sh "$DEV_STACK_DOMU_NAME"
FLAT_NETWORK_BRIDGE="${FLAT_NETWORK_BRIDGE:-$(bridge_for "$VM_BRIDGE_OR_NET_NAME")}"
append_kernel_cmdline "$DEV_STACK_DOMU_NAME" "flat_network_bridge=${FLAT_NETWORK_BRIDGE}"
# Disable FS journaling. It would reduce disk IO, but may lead to file system
# unstable after long time use
if [ "$DISABLE_JOURNALING" = "true" ]; then
vm_vbd=$(xe vbd-list vm-name-label=$DEV_STACK_DOMU_NAME --minimal)
vm_vdi=$(xe vdi-list vbd-uuids=$vm_vbd --minimal)
dom_zero_uuid=$(xe vm-list dom-id=0 --minimal)
tmp_vbd=$(xe vbd-create device=autodetect bootable=false mode=RW type=Disk vdi-uuid=$vm_vdi vm-uuid=$dom_zero_uuid)
xe vbd-plug uuid=$tmp_vbd
sr_id=$(get_local_sr)
kpartx -p p -avs /dev/sm/backend/$sr_id/$vm_vdi
echo "********Before disable FS journaling********"
tune2fs -l /dev/mapper/${vm_vdi}p1 | grep "Filesystem features"
echo "********Disable FS journaling********"
tune2fs -O ^has_journal /dev/mapper/${vm_vdi}p1
echo "********After disable FS journaling********"
tune2fs -l /dev/mapper/${vm_vdi}p1 | grep "Filesystem features"
kpartx -p p -dvs /dev/sm/backend/$sr_id/$vm_vdi
xe vbd-unplug uuid=$tmp_vbd timeout=60
xe vbd-destroy uuid=$tmp_vbd
fi
# Add a separate xvdb, if it was requested
if [[ "0" != "$XEN_XVDB_SIZE_GB" ]]; then
vm=$(xe vm-list name-label="$DEV_STACK_DOMU_NAME" --minimal)

View File

@ -13,6 +13,7 @@ INSTALL_DIR="$THIS_DIR/install"
COMM_DIR="$INSTALL_DIR/common"
CONF_DIR="$INSTALL_DIR/conf"
DEV_STACK_DIR="$INSTALL_DIR/devstack"
DISABLE_JOURNALING="false"
. $COMM_DIR/functions
# Source params
@ -33,6 +34,8 @@ optional arguments:
-l LOG_FILE_DIRECTORY The directory in which to store the devstack logs on failure.
-w WAIT_TILL_LAUNCH Set it to 1 if user want to pending on the installation until
it is done
-r DISABLE_JOURNALING Disable journaling if this flag is set. It will reduce disk IO, but
may lead to file system unstable after long time use
flags:
-f Force SR replacement. If your XenServer has an LVM type SR,
@ -60,7 +63,7 @@ REMAINING_OPTIONS="$#"
# Get optional parameters
set +e
while getopts ":d:fl:w:" flag; do
while getopts ":d:frl:w:" flag; do
REMAINING_OPTIONS=$(expr "$REMAINING_OPTIONS" - 1)
case "$flag" in
d)
@ -78,6 +81,9 @@ while getopts ":d:fl:w:" flag; do
WAIT_TILL_LAUNCH="$OPTARG"
REMAINING_OPTIONS=$(expr "$REMAINING_OPTIONS" - 1)
;;
r)
DISABLE_JOURNALING="true"
;;
\?)
print_usage_and_die "Invalid option -$OPTARG"
exit 1
@ -140,7 +146,11 @@ if [ -n "${EXIT_AFTER_JEOS_INSTALLATION:-}" ]; then
fi
# install DevStack on the VM
$DEV_STACK_DIR/install_devstack.sh -d $DEVSTACK_SRC -l $LOGDIR
OPTARGS=""
if [ $DISABLE_JOURNALING = 'true' ]; then
OPTARGS="$OPTARGS -r"
fi
$DEV_STACK_DIR/install_devstack.sh -d $DEVSTACK_SRC -l $LOGDIR $OPTARGS
#start openstack domU VM
xe vm-start vm="$DEV_STACK_DOMU_NAME"