Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[build]: enable docker in ram option for small disk device #3279

Merged
merged 9 commits into from
Aug 7, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions device/arista/x86_64-arista_7050_qx32/installer.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DOCKER_IN_RAM=y
1 change: 1 addition & 0 deletions device/dell/x86_64-dell_s6000_s1220-r0/installer.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="processor.max_cstate=1 intel_idle.max_cstate=0"
DOCKER_IN_RAM=y
lguohan marked this conversation as resolved.
Show resolved Hide resolved
lguohan marked this conversation as resolved.
Show resolved Hide resolved

if [ "$install_env" = "onie" ]; then

Expand Down
12 changes: 10 additions & 2 deletions files/initramfs-tools/union-mount.j2
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,17 @@ mount -n -o lowerdir=${rootmnt},upperdir=${rootmnt}/host/$image_dir/rw,workdir=$
[ -b ${ROOT} ] || mdev -s
## Mount the raw partition again
mount ${ROOT} ${rootmnt}/host
## Mount the working directory of docker engine in the raw partition, bypass the overlay

mkdir -p ${rootmnt}/var/lib/docker
mount --bind ${rootmnt}/host/$image_dir/{{ DOCKERFS_DIR }} ${rootmnt}/var/lib/docker
if [ -f ${rootmnt}/host/$image_dir/{{ FILESYSTEM_DOCKERFS }} ]; then
## mount 1024M tmpfs and extract docker into it
mount -t tmpfs -o rw,nodev,size=1024M tmpfs ${rootmnt}/var/lib/docker
lguohan marked this conversation as resolved.
Show resolved Hide resolved
tar xz --numeric-owner --warning=no-timestamp -f ${rootmnt}/host/$image_dir/{{ FILESYSTEM_DOCKERFS }} -C ${rootmnt}/var/lib/docker
else
## Mount the working directory of docker engine in the raw partition, bypass the overlay
mount --bind ${rootmnt}/host/$image_dir/{{ DOCKERFS_DIR }} ${rootmnt}/var/lib/docker
fi

## Mount the boot directory in the raw partition, bypass the overlay
mkdir -p ${rootmnt}/boot
mount --bind ${rootmnt}/host/$image_dir/boot ${rootmnt}/boot
Expand Down
15 changes: 10 additions & 5 deletions installer/x86_64/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -481,13 +481,18 @@ fi
# Decompress the file for the file system directly to the partition
unzip -o $ONIE_INSTALLER_PAYLOAD -x "$FILESYSTEM_DOCKERFS" -d $demo_mnt/$image_dir

if [ "$install_env" = "onie" ]; then
TAR_EXTRA_OPTION="--numeric-owner"
# when disk is small, keep dockerfs.tar.gz in disk, expand it into ramfs during initrd
if [ x"$DOCKER_IN_RAM" = x"y" ]; then
unzip -o $ONIE_INSTALLER_PAYLOAD "$FILESYSTEM_DOCKERFS" -d $demo_mnt/$image_dir
else
TAR_EXTRA_OPTION="--numeric-owner --warning=no-timestamp"
if [ "$install_env" = "onie" ]; then
TAR_EXTRA_OPTION="--numeric-owner"
else
TAR_EXTRA_OPTION="--numeric-owner --warning=no-timestamp"
fi
mkdir -p $demo_mnt/$image_dir/$DOCKERFS_DIR
unzip -op $ONIE_INSTALLER_PAYLOAD "$FILESYSTEM_DOCKERFS" | tar xz $TAR_EXTRA_OPTION -f - -C $demo_mnt/$image_dir/$DOCKERFS_DIR
fi
mkdir -p $demo_mnt/$image_dir/$DOCKERFS_DIR
unzip -op $ONIE_INSTALLER_PAYLOAD "$FILESYSTEM_DOCKERFS" | tar xz $TAR_EXTRA_OPTION -f - -C $demo_mnt/$image_dir/$DOCKERFS_DIR

lguohan marked this conversation as resolved.
Show resolved Hide resolved
if [ "$install_env" = "onie" ]; then
# Store machine description in target file system
Expand Down