diff --git a/Makefile b/Makefile index f19d61c..6ea7374 100644 --- a/Makefile +++ b/Makefile @@ -16,6 +16,16 @@ test: clean: docker-compose down +download = test ! -f "./images/$(shell basename $1)" && \ + wget "$1" -O "./images/$(shell basename $1)" || \ + echo "image $1 exist into /images/$(shell basename $1)" + +download_debian: + @$(call download,https://cdimage.debian.org/cdimage/openstack/current-10/debian-10-openstack-amd64.qcow2) + +download_centos: + @$(call download,https://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2) + ## management status: diff --git a/docker-compose.yml b/docker-compose.yml index fcb4fc2..3b2feeb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,12 +14,8 @@ services: environment: LIBVIRTD_DEFAULT_NETWORK: "true" 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:/images - libvirt-pool:/var/lib/libvirt/pool - /:/host:Z volumes: diff --git a/libvirtd.sh b/libvirtd.sh index 78b256f..836cf35 100644 --- a/libvirtd.sh +++ b/libvirtd.sh @@ -87,18 +87,6 @@ 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