mirror of
https://pagure.io/fedora-infra/ansible.git
synced 2026-04-27 12:03:38 +08:00
30 lines
743 B
Bash
Executable File
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"
|