From aaaffe227ef2a26f14aad546ab6fa888671cf5a6 Mon Sep 17 00:00:00 2001 From: Lijin Xiong Date: Fri, 3 Mar 2023 18:34:32 +0800 Subject: [PATCH] Docker/entrypoint: support disk mounting in service container Signed-off-by: Lijin Xiong --- docker/debian9/entrypoint.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docker/debian9/entrypoint.sh b/docker/debian9/entrypoint.sh index cb150b4b86..346519de1c 100644 --- a/docker/debian9/entrypoint.sh +++ b/docker/debian9/entrypoint.sh @@ -5,10 +5,12 @@ ############################ GLOBAL VARIABLES g_role="" g_args="" +g_disk="" g_prefix="" g_preexec="" g_binary="" g_start_args="" +disk_mount_point=/curvebs/chunkserver/data ############################ BASIC FUNCTIONS function msg() { @@ -52,6 +54,10 @@ function get_options() { g_args=$2 shift 2 ;; + -d|--disk) + g_disk=$2 + shift 2 + ;; -h) usage exit 1 @@ -81,6 +87,11 @@ function prepare() { g_start_args="--confPath $conf_path" ;; chunkserver) + if [ "$g_disk" ]; then + [[ ! -d $disk_mount_point ]] && die "disk mount point $disk_mount_point does not exist.\n" + mount -o rw,errors=remount-ro $g_disk $disk_mount_point + [[ $? -ne 0 ]] && die "mount disk device $g_disk to $disk_mount_point failed.\n" + fi g_binary="$g_prefix/sbin/curvebs-chunkserver" g_start_args="--conf=$conf_path" ;;