Files
fedora-infra_ansible/roles/copr_hypervisor_aarch64/files/upload-disk
2019-06-19 07:51:08 +02:00

30 lines
743 B
Bash
Executable File

#! /bin/sh -x
die() { echo >&2 "$*" ; exit 1 ; }
image=$1
volume=copr-builder
# the only pool where we can work with qcow2 images (which is effective,
# compared to raw images)
pool=images
new_volume=copr-builder-$(date +"%Y%m%d_%H%M%S")
connections='
qemu:///system
qemu+ssh://copr@virthost-aarch64-os02.fedorainfracloud.org/system
'
export VIRSH_DEFAULT_CONNECT_URI=
test -n "$image" || die "first argument (image) required"
test -f "$image" || die "image $image not found"
for connection in $connections; do
virsh --connect="$connection" vol-create-as --pool "$pool" "$new_volume" 1M
virsh --connect="$connection" vol-upload --pool "$pool" "$new_volume" --sparse "$image"
done
echo "uploaded images $new_volume"