blob: b92f01446fbc8481ba8fd359ff1287798ee75e01 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#!/bin/sh
set -eu
name=worker
image=temp.img
rm -f "$image"
cp "$1" "$image"
n="$(lscpu | awk '$1 == "CPU(s):" { n=$2; if (n > 1) n--; print n }')"
virsh -c qemu:///system net-autostart default
virsh -c qemu:///system net-start default || true
virt-install \
--connect qemu:///system \
--quiet \
--name="$name" \
--memory=4096 \
--vcpus="$n" \
--cpu=host \
--import \
--os-variant=debian9 \
--disk="path=$image,cache=none" \
--disk="path=/dev/vdb,cache=none" \
--network="network=default" \
--graphics=spice \
--noautoconsole
|