Skip to content

Commit 3562f8b

Browse files
committed
mkcloud: improve image cache usage
In order to prevent the image cache directory to fill up the disk the cache should share its images with all jobs. A 'per' job cache does not make sense for an image thats just used once. So the value of $cache_dir_default is now a shared directory and no longer contains the cloud name. To not break running deployments rsync needs to drop the 'inplace' parameter, so that it first syncs the new image and then does a rename at the end. This guarantees that 1) there is always one consistent image to deploy from, 2) no running jobs read from currupt files, 3) the cache really caches for all jobs on the host.
1 parent 5d83779 commit 3562f8b

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

scripts/lib/mkcloud-driver-libvirt.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ function libvirt_do_onhost_deploy_image()
385385
if [[ ! $want_cached_images = 1 ]] ; then
386386
[ -n $rsyncserver_fqdn ] || complain 95 "Missing RSYNC Server FQDN!"
387387

388-
safely rsync --compress --progress --inplace --archive --verbose \
388+
safely rsync --progress --archive --verbose \
389389
rsync://$rsyncserver_fqdn/$rsyncserver_images_dir/$image $cache_dir/
390390
else
391391
# In this case the image has to be supplied by other means than

scripts/mkcloud

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ if [[ $debug_mkcloud = 1 ]] ; then
2929
PS4='+(${BASH_SOURCE##*/}:${LINENO}) ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
3030
fi
3131

32-
cache_dir_default=/var/cache/mkcloud/$cloud
32+
cache_dir_default=/var/cache/mkcloud
3333
[[ $UID != 0 ]] && cache_dir_default="${XDG_CACHE_HOME:-./cache}/mkcloud"
3434
: ${cache_dir:=$cache_dir_default}
3535
mkdir -p "$cache_dir"

0 commit comments

Comments
 (0)