use the provided network_name when creating a capsul
This commit is contained in:
parent
be54117736
commit
b459e56f3a
@ -9,6 +9,8 @@ template_file="/tank/img/$2"
|
|||||||
vcpus="$3"
|
vcpus="$3"
|
||||||
memory="$4"
|
memory="$4"
|
||||||
pubkeys="$5"
|
pubkeys="$5"
|
||||||
|
network_name="$6"
|
||||||
|
public_ipv4="$7"
|
||||||
root_volume_size="25G"
|
root_volume_size="25G"
|
||||||
|
|
||||||
if echo "$vmname" | grep -vqE '^capsul-[a-z0-9]{10}$'; then
|
if echo "$vmname" | grep -vqE '^capsul-[a-z0-9]{10}$'; then
|
||||||
@ -38,6 +40,16 @@ echo "$pubkeys" | while IFS= read -r line; do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if echo "$network_name" | grep -vqE "^[a-zA-Z0-9_-]+"; then
|
||||||
|
echo "network_name \"$network_name\" must match ^[a-zA-Z0-9_-]+"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if echo "$public_ipv4" | grep -vqE "^[0-9.]+$"; then
|
||||||
|
echo "public_ipv4 \"$public_ipv4\" must match ^[0-9.]+$"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
disk="/tank/vm/$vmname.qcow2"
|
disk="/tank/vm/$vmname.qcow2"
|
||||||
cdrom="/tank/vm/$vmname.iso"
|
cdrom="/tank/vm/$vmname.iso"
|
||||||
xml="/tank/vm/$vmname.xml"
|
xml="/tank/vm/$vmname.xml"
|
||||||
@ -66,7 +78,7 @@ virt-install \
|
|||||||
--os-variant generic \
|
--os-variant generic \
|
||||||
--virt-type kvm \
|
--virt-type kvm \
|
||||||
--graphics vnc,listen=127.0.0.1 \
|
--graphics vnc,listen=127.0.0.1 \
|
||||||
--network network=public3,filterref=clean-traffic,model=virtio \
|
--network network=$network_name,filterref=clean-traffic,model=virtio \
|
||||||
--import \
|
--import \
|
||||||
--print-xml > "$xml"
|
--print-xml > "$xml"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user