fix wget conditionnal for base images

This commit is contained in:
Antoine 2020-08-04 01:04:32 +02:00
parent 29eadc7b92
commit 39ec48492f
Signed by: antoine
GPG Key ID: 098FB66FC0475E70
3 changed files with 19 additions and 2 deletions

View File

@ -10,6 +10,7 @@ RUN yum install -y \
libvirt-daemon-qemu \
libvirt-client \
selinux-policy selinux-policy-targeted \
wget \
augeas
COPY augconf /augconf

View File

@ -13,10 +13,14 @@ services:
- "8080:8080"
environment:
LIBVIRTD_DEFAULT_NETWORK: "true"
LIBVIRTD_DEFAULT_POOL_PATH: "/var/lib/libvirt/images"
LIBVIRTD_DEFAULT_POOL_PATH: "/var/lib/libvirt/pool/default"
PRE_DOWNLOAD_IMAGES:
"https://cdimage.debian.org/cdimage/openstack/current-10/debian-10-openstack-amd64.qcow2,\
https://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2"
volumes:
- /var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket
- libvirt-images:/var/lib/libvirt/images
- libvirt-images:/images
- libvirt-pool:/var/lib/libvirt/pool
- /:/host:Z
volumes:
libvirt-images:

View File

@ -87,6 +87,18 @@ EOX
ln -s /etc/libvirt/storage/default.xml /etc/libvirt/storage/autostart/default.xml
fi
# Download some image at startup
if [[ -n "$PRE_DOWNLOAD_IMAGES" ]]; then
# loop on each image and download it
echo "$PRE_DOWNLOAD_IMAGES" | sed -n 1'p' | tr ',' '\n' | while read image; do
if [ ! -f /images/"$(basename $image)" ]; then
echo "downloading $image ..."
wget "$image" -O /images/"$(basename $image)" &
fi
done
fi
echo "cgroup_controllers = []" >> /etc/libvirt/qemu.conf
echo "namespaces = []" >> /etc/libvirt/qemu.conf