Allow the user to disable tmpfs when building guest images
This is accomplished through the use of a new environment variable USE_TMPFS. The default action remains to use tmpfs. If the user wishes to disable the use of tmpfs, the environment variable should be set as shown below before invoking Trove to build an image. export USE_TMPFS=false Note tmpfs uses half of the available free memory for a RAM based file system. This can lead to errors in the image building process, for example when large compilations are performed. In these cases, the user can try again with tmpfs disabled simply by setting an environment variable. The alternative is to provision another server or VM that has more memory which is not always possible or desired. Change-Id: I0f990d7866755ccf0537354752cd602fe0582ea0
This commit is contained in:
parent
1bdd096934
commit
e39b0b9662
@ -3,6 +3,13 @@
|
||||
# Additional functions that would mostly just pertain to a Ubuntu + Qemu setup
|
||||
#
|
||||
|
||||
# tmpfs dedicates half the available RAM to an internal cache to speed up
|
||||
# image building. This can lead to failures when the data doesn't fit into
|
||||
# the cache, for example when compiling large programs. This flag allows
|
||||
# tmpfs to be turned off by the caller by setting USE_TMPF=false
|
||||
|
||||
USE_TMPFS=${USE_TMPFS:-true}
|
||||
|
||||
function build_vm() {
|
||||
exclaim "Actually building the image, this can take up to 15 minutes"
|
||||
|
||||
@ -27,6 +34,15 @@ function build_vm() {
|
||||
EXTRA_ELEMENTS=selinux-permissive
|
||||
fi
|
||||
|
||||
case "$USE_TMPFS" in
|
||||
false|FALSE|False|no|NO|n|N)
|
||||
TMPFS_ARGS='--no-tmpfs'
|
||||
;;
|
||||
*)
|
||||
TMPFS_ARGS=''
|
||||
;;
|
||||
esac
|
||||
|
||||
export HOST_USERNAME
|
||||
export HOST_SCP_USERNAME
|
||||
export GUEST_USERNAME
|
||||
@ -47,7 +63,7 @@ function build_vm() {
|
||||
export DIB_APT_CONF_DIR=/etc/apt/apt.conf.d
|
||||
export DIB_CLOUD_INIT_ETC_HOSTS=true
|
||||
local QEMU_IMG_OPTIONS="--qemu-img-options compat=1.1"
|
||||
disk-image-create -a ${ARCH} -o "${VM}" \
|
||||
disk-image-create ${TMPFS_ARGS} -a ${ARCH} -o "${VM}" \
|
||||
-x ${QEMU_IMG_OPTIONS} ${DISTRO} ${EXTRA_ELEMENTS} vm \
|
||||
cloud-init-datasources ${DISTRO}-${RELEASE}-guest ${DISTRO}-${RELEASE}-${SERVICE_TYPE}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user