2021-02-10 13:26:46 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
trusty()
|
|
|
|
{
|
|
|
|
id="$1"
|
2021-02-11 10:26:44 +01:00
|
|
|
qemu-img create -b /var/lib/libvirt/backingstore/trusty.qcow2 \
|
|
|
|
-f qcow2 -F qcow2 \
|
|
|
|
/var/lib/libvirt/ephemeral/trusty_libvirt_"${hostname}_${id}".qcow2
|
|
|
|
cloud-localds /var/lib/libvirt/ephemeral/trusty_libvirt_"${hostname}_${id}".iso \
|
2021-02-10 13:26:46 +01:00
|
|
|
/var/lib/libvirt/backingstore/trusty.user
|
|
|
|
|
2021-02-11 10:26:44 +01:00
|
|
|
virsh undefine trusty_libvirt_"${hostname}_${id}"
|
2021-02-10 13:26:46 +01:00
|
|
|
|
|
|
|
xml=$(mktemp)
|
|
|
|
|
2021-02-11 11:09:24 +01:00
|
|
|
virt-install -r "$mempercore" --vcpus=2,maxvcpus=2,sockets=1,cores=1,threads=2 \
|
2021-02-11 10:26:44 +01:00
|
|
|
-n trusty_libvirt_"${hostname}_${id}" -w network=default --nographics \
|
|
|
|
--disk path=/var/lib/libvirt/ephemeral/trusty_libvirt_"${hostname}_${id}".qcow2 \
|
|
|
|
--disk path=/var/lib/libvirt/ephemeral/trusty_libvirt_"${hostname}_${id}".iso,device=cdrom \
|
2021-02-10 13:26:46 +01:00
|
|
|
--import --noautoconsole \
|
|
|
|
--print-xml --dry-run --check disk_size=off,path_in_use=off \
|
|
|
|
--boot=hd --os-type=Linux --os-variant ubuntu14.04 > "$xml"
|
|
|
|
|
|
|
|
virsh define "$xml"
|
|
|
|
|
2021-02-11 10:26:44 +01:00
|
|
|
rm -f "$xml" /var/lib/libvirt/ephemeral/trusty_libvirt_"${hostname}_${id}".{iso,qcow2}
|
2021-02-10 13:26:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
xenial()
|
|
|
|
{
|
|
|
|
id="$1"
|
2021-02-11 10:26:44 +01:00
|
|
|
qemu-img create -b /var/lib/libvirt/backingstore/xenial.qcow2 \
|
|
|
|
-f qcow2 -F qcow2 \
|
|
|
|
/var/lib/libvirt/ephemeral/xenial_libvirt_"${hostname}_${id}".qcow2
|
|
|
|
cloud-localds /var/lib/libvirt/ephemeral/xenial_libvirt_"${hostname}_${id}".iso \
|
2021-02-10 13:26:46 +01:00
|
|
|
/var/lib/libvirt/backingstore/xenial.user
|
|
|
|
|
2021-02-11 10:26:44 +01:00
|
|
|
virsh undefine xenial_libvirt_"${hostname}_${id}"
|
2021-02-10 13:26:46 +01:00
|
|
|
|
|
|
|
xml=$(mktemp)
|
|
|
|
|
2021-02-11 11:09:24 +01:00
|
|
|
virt-install -r "$mempercore" --vcpus=2,maxvcpus=2,sockets=1,cores=1,threads=2 \
|
2021-02-11 10:26:44 +01:00
|
|
|
-n xenial_libvirt_"${hostname}_${id}" -w network=default --nographics \
|
|
|
|
--disk path=/var/lib/libvirt/ephemeral/xenial_libvirt_"${hostname}_${id}".qcow2 \
|
|
|
|
--disk path=/var/lib/libvirt/ephemeral/xenial_libvirt_"${hostname}_${id}".iso,device=cdrom \
|
2021-02-10 13:26:46 +01:00
|
|
|
--import --noautoconsole \
|
|
|
|
--print-xml --dry-run --check disk_size=off,path_in_use=off \
|
|
|
|
--boot=hd --os-type=Linux --os-variant ubuntu16.04 > "$xml"
|
|
|
|
|
|
|
|
virsh define "$xml"
|
|
|
|
|
2021-02-11 10:26:44 +01:00
|
|
|
rm -f "$xml" /var/lib/libvirt/ephemeral/xenial_libvirt_"${hostname}_${id}".{iso,qcow2}
|
2021-02-10 13:26:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
bionic()
|
|
|
|
{
|
|
|
|
id="$1"
|
2021-02-11 10:26:44 +01:00
|
|
|
qemu-img create -b /var/lib/libvirt/backingstore/bionic.qcow2 \
|
|
|
|
-f qcow2 -F qcow2 \
|
|
|
|
/var/lib/libvirt/ephemeral/bionic_libvirt_"${hostname}_${id}".qcow2
|
|
|
|
cloud-localds /var/lib/libvirt/ephemeral/bionic_libvirt_"${hostname}_${id}".iso \
|
2021-02-10 13:26:46 +01:00
|
|
|
/var/lib/libvirt/backingstore/bionic.user
|
|
|
|
|
2021-02-11 10:26:44 +01:00
|
|
|
virsh undefine bionic_libvirt_"${hostname}_${id}"
|
2021-02-10 13:26:46 +01:00
|
|
|
|
|
|
|
xml=$(mktemp)
|
|
|
|
|
2021-02-11 11:09:24 +01:00
|
|
|
virt-install -r "$mempercore" --vcpus=2,maxvcpus=2,sockets=1,cores=1,threads=2 \
|
2021-02-11 10:26:44 +01:00
|
|
|
-n bionic_libvirt_"${hostname}_${id}" -w network=default --nographics \
|
|
|
|
--disk path=/var/lib/libvirt/ephemeral/bionic_libvirt_"${hostname}_${id}".qcow2 \
|
|
|
|
--disk path=/var/lib/libvirt/ephemeral/bionic_libvirt_"${hostname}_${id}".iso,device=cdrom \
|
2021-02-10 13:26:46 +01:00
|
|
|
--import --noautoconsole \
|
|
|
|
--print-xml --dry-run --check disk_size=off,path_in_use=off \
|
|
|
|
--boot=hd --os-type=Linux --os-variant ubuntu18.04 > "$xml"
|
|
|
|
|
|
|
|
virsh define "$xml"
|
|
|
|
|
2021-02-11 10:26:44 +01:00
|
|
|
rm -f "$xml" /var/lib/libvirt/ephemeral/bionic_libvirt_"${hostname}_${id}".{iso,qcow2}
|
2021-02-10 13:26:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
focal()
|
|
|
|
{
|
|
|
|
id="$1"
|
2021-02-11 10:26:44 +01:00
|
|
|
qemu-img create -b /var/lib/libvirt/backingstore/focal.qcow2 \
|
|
|
|
-f qcow2 -F qcow2 \
|
|
|
|
/var/lib/libvirt/ephemeral/focal_libvirt_"${hostname}_${id}".qcow2
|
|
|
|
cloud-localds /var/lib/libvirt/ephemeral/focal_libvirt_"${hostname}_${id}".iso \
|
2021-02-10 13:26:46 +01:00
|
|
|
/var/lib/libvirt/backingstore/focal.user
|
|
|
|
|
2021-02-11 10:26:44 +01:00
|
|
|
virsh undefine focal_libvirt_"${hostname}_${id}"
|
2021-02-10 13:26:46 +01:00
|
|
|
|
|
|
|
xml=$(mktemp)
|
|
|
|
|
2021-02-11 11:09:24 +01:00
|
|
|
virt-install -r "$mempercore" --vcpus=2,maxvcpus=2,sockets=1,cores=1,threads=2 \
|
2021-02-11 10:26:44 +01:00
|
|
|
-n focal_libvirt_"${hostname}_${id}" -w network=default --nographics \
|
|
|
|
--disk path=/var/lib/libvirt/ephemeral/focal_libvirt_"${hostname}_${id}".qcow2 \
|
|
|
|
--disk path=/var/lib/libvirt/ephemeral/focal_libvirt_"${hostname}_${id}".iso,device=cdrom \
|
2021-02-10 13:26:46 +01:00
|
|
|
--import --noautoconsole \
|
|
|
|
--print-xml --dry-run --check disk_size=off,path_in_use=off \
|
|
|
|
--boot=hd --os-type=Linux --os-variant ubuntu18.04 > "$xml"
|
|
|
|
|
|
|
|
virsh define "$xml"
|
|
|
|
|
2021-02-11 10:26:44 +01:00
|
|
|
rm -f "$xml" /var/lib/libvirt/ephemeral/focal_libvirt_"${hostname}_${id}".{iso,qcow2}
|
2021-02-10 13:26:46 +01:00
|
|
|
}
|
|
|
|
|
2024-03-01 16:22:13 +01:00
|
|
|
jammy()
|
|
|
|
{
|
|
|
|
id="$1"
|
|
|
|
qemu-img create -b /var/lib/libvirt/backingstore/jammy.qcow2 \
|
|
|
|
-f qcow2 -F qcow2 \
|
|
|
|
/var/lib/libvirt/ephemeral/jammy_libvirt_"${hostname}_${id}".qcow2
|
|
|
|
cloud-localds /var/lib/libvirt/ephemeral/jammy_libvirt_"${hostname}_${id}".iso \
|
|
|
|
/var/lib/libvirt/backingstore/jammy.user
|
|
|
|
|
|
|
|
virsh undefine jammy_libvirt_"${hostname}_${id}"
|
|
|
|
|
|
|
|
xml=$(mktemp)
|
|
|
|
|
|
|
|
virt-install -r "$mempercore" --vcpus=2,maxvcpus=2,sockets=1,cores=1,threads=2 \
|
|
|
|
-n jammy_libvirt_"${hostname}_${id}" -w network=default --nographics \
|
|
|
|
--disk path=/var/lib/libvirt/ephemeral/jammy_libvirt_"${hostname}_${id}".qcow2 \
|
|
|
|
--disk path=/var/lib/libvirt/ephemeral/jammy_libvirt_"${hostname}_${id}".iso,device=cdrom \
|
|
|
|
--import --noautoconsole \
|
|
|
|
--print-xml --dry-run --check disk_size=off,path_in_use=off \
|
|
|
|
--boot=hd --os-type=Linux --os-variant ubuntu18.04 > "$xml"
|
|
|
|
|
|
|
|
virsh define "$xml"
|
|
|
|
|
|
|
|
rm -f "$xml" /var/lib/libvirt/ephemeral/jammy_libvirt_"${hostname}_${id}".{iso,qcow2}
|
|
|
|
}
|
|
|
|
|
2021-02-10 13:26:46 +01:00
|
|
|
elcapitan()
|
|
|
|
{
|
|
|
|
local id
|
|
|
|
local threads
|
|
|
|
local cores
|
|
|
|
id="$1"
|
|
|
|
|
2021-02-11 11:09:24 +01:00
|
|
|
virsh undefine elcapitan_libvirt_"${hostname}_${id}"
|
2021-02-10 13:26:46 +01:00
|
|
|
|
|
|
|
xml=$(mktemp)
|
|
|
|
|
|
|
|
cat /var/lib/libvirt/backingstore/elcapitan.xml > "$xml"
|
|
|
|
|
|
|
|
threads="$(grep -c processor /proc/cpuinfo)"
|
|
|
|
if [ "$threads" -gt 16 ]; then
|
|
|
|
threads=16
|
|
|
|
fi
|
|
|
|
cores="$((threads/2))"
|
|
|
|
|
|
|
|
cp /var/lib/libvirt/backingstore/enoch_rev2839_boot \
|
|
|
|
/var/lib/libvirt/ephemeral/enoch_rev2839_boot
|
|
|
|
|
|
|
|
sed -Ei "
|
2021-02-11 11:09:24 +01:00
|
|
|
s#<name>.*<#<name>elcapitan_libvirt_${hostname}_${id}<#;
|
2021-02-10 13:26:46 +01:00
|
|
|
s#<vcpu (.*)>[0-9]+#<vcpu \\1>$threads#;
|
|
|
|
s#<topology (.*)cores='[0-9]+'#<topology \\1cores='$cores'#;
|
2021-02-11 11:09:24 +01:00
|
|
|
s#<source file='(.*\\.qcow2)'#<source file='/var/lib/libvirt/ephemeral/elcapitan_libvirt_${hostname}_${id}.qcow2'#;
|
2021-02-10 13:26:46 +01:00
|
|
|
" "$xml"
|
|
|
|
|
|
|
|
virsh define "$xml"
|
|
|
|
|
|
|
|
rm -f "$xml"
|
|
|
|
}
|
|
|
|
|
|
|
|
hostname=$(hostname|cut -d. -f1)
|
|
|
|
|
|
|
|
cores=$(grep -E '^cpu cores' /proc/cpuinfo |head -1|cut -d: -f2|tr -d '[:space:]')
|
|
|
|
mem=$(sed -E 's/^MemTotal: +([0-9]+) kB/\1/p;d' < /proc/meminfo)
|
|
|
|
mempercore=$(((mem/1024-4096)/cores))
|
|
|
|
|
2022-12-05 05:40:34 +01:00
|
|
|
cp -f /usr/src/buildbot-workers/*.user /var/lib/libvirt/backingstore
|
|
|
|
|
2022-12-05 04:44:28 +01:00
|
|
|
# elcapitan 1
|
2021-02-10 13:26:46 +01:00
|
|
|
|
|
|
|
for i in $(seq "$cores"); do
|
|
|
|
trusty "$i" &
|
|
|
|
done
|
|
|
|
wait
|
|
|
|
for i in $(seq "$cores"); do
|
|
|
|
xenial "$i" &
|
|
|
|
done
|
|
|
|
wait
|
|
|
|
for i in $(seq "$cores"); do
|
|
|
|
bionic "$i" &
|
|
|
|
done
|
|
|
|
wait
|
|
|
|
for i in $(seq "$cores"); do
|
|
|
|
focal "$i" &
|
|
|
|
done
|
2024-03-01 16:22:13 +01:00
|
|
|
for i in $(seq "$cores"); do
|
|
|
|
jammy "$i" &
|
|
|
|
done
|
2021-02-10 13:26:46 +01:00
|
|
|
wait
|