Fix issue with leaking /tmp/image.* directories
When building the ramdisk we don't cleanup the temporary directories after ourselves. This leaves /tmp/image.* directories mounted and /tmp/image.* directories on the system. Also the ramdisk-functions duplicate, from what I can see, the cleanup function from common-functions. So when a job is killed off it ends up leaving /tmp/image.* directories on the system. Change-Id: I2d73aabd0eb176027b4e7368580db08902e2b6ab
This commit is contained in:
parent
04a542134f
commit
6337e6fe17
@ -251,14 +251,12 @@ if [ "$IS_RAMDISK" == "0" ]; then
|
|||||||
for IMAGE_TYPE in ${IMAGE_TYPES[@]} ; do
|
for IMAGE_TYPE in ${IMAGE_TYPES[@]} ; do
|
||||||
compress_and_save_image $IMAGE_NAME.$IMAGE_TYPE
|
compress_and_save_image $IMAGE_NAME.$IMAGE_TYPE
|
||||||
done
|
done
|
||||||
rm $TMP_IMAGE_PATH
|
|
||||||
cleanup_dirs
|
|
||||||
else
|
|
||||||
# This is a ramdisk build, we have already extracted the kernel and ramdisk
|
|
||||||
# by this point.
|
|
||||||
rm $TMP_IMAGE_PATH
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Always cleanup after ourselves
|
||||||
|
rm $TMP_IMAGE_PATH
|
||||||
|
cleanup_dirs
|
||||||
|
|
||||||
case "$IMAGE_ELEMENT" in
|
case "$IMAGE_ELEMENT" in
|
||||||
*ironic-agent*)
|
*ironic-agent*)
|
||||||
rm $IMAGE_NAME.$IMAGE_TYPE
|
rm $IMAGE_NAME.$IMAGE_TYPE
|
||||||
|
@ -173,7 +173,7 @@ function cleanup_dirs () {
|
|||||||
sudo rm -rf $TMP_BUILD_DIR/built
|
sudo rm -rf $TMP_BUILD_DIR/built
|
||||||
sudo rm -rf $TMP_BUILD_DIR/mnt
|
sudo rm -rf $TMP_BUILD_DIR/mnt
|
||||||
sudo umount -f $TMP_BUILD_DIR $TMP_IMAGE_DIR || true
|
sudo umount -f $TMP_BUILD_DIR $TMP_IMAGE_DIR || true
|
||||||
rm -rf $TMP_BUILD_DIR $TMP_IMAGE_DIR
|
rm -rf --one-file-system $TMP_BUILD_DIR $TMP_IMAGE_DIR
|
||||||
}
|
}
|
||||||
|
|
||||||
# Run a directory of hooks outside the target (that is, no chrooting).
|
# Run a directory of hooks outside the target (that is, no chrooting).
|
||||||
|
@ -24,20 +24,6 @@ function fullpath() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function cleanup () {
|
|
||||||
if [ "$RAMDISK_ELEMENT" != "dracut-ramdisk" ]; then
|
|
||||||
unmount_dir "$TMP_BUILD_DIR/mnt"
|
|
||||||
fi
|
|
||||||
if [ -f "$TMP_IMAGE_PATH" ]; then
|
|
||||||
loopdev=`sudo losetup -j "$TMP_IMAGE_PATH" | cut -d: -f1`
|
|
||||||
if [ -n "$loopdev" ]; then
|
|
||||||
detach_loopback "$loopdev"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
unmount_dir "$TMP_BUILD_DIR"
|
|
||||||
rm -rf --one-file-system "$TMP_BUILD_DIR"
|
|
||||||
}
|
|
||||||
|
|
||||||
function create_ramdisk_base () {
|
function create_ramdisk_base () {
|
||||||
echo "Creating base system"
|
echo "Creating base system"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user