Add arguments for RAM and number of CPUs
This commit is contained in:
parent
b3c1f81ec6
commit
94a34e4758
@ -1,12 +1,17 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
if [[ $# -eq 0 ]] ; then
|
if [[ $# -lt 3 ]] ; then
|
||||||
echo 'USAGE: create_vm VMNAME'
|
cat <<-EOF
|
||||||
|
USAGE (RAM in megabytes)
|
||||||
|
|
||||||
|
create_vm VMNAME RAM CPUS
|
||||||
|
EOF
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
VMNAME=$1
|
VMNAME=$1
|
||||||
|
RAM=$2
|
||||||
|
CPUS=$3
|
||||||
|
|
||||||
# Directory where image files will be stored
|
# Directory where image files will be stored
|
||||||
IMAGE_DIR=/var/lib/libvirt/images
|
IMAGE_DIR=/var/lib/libvirt/images
|
||||||
@ -67,8 +72,8 @@ fi
|
|||||||
# setting --os-variant to ubuntu20.04 and ubuntu18.04 breaks SSH and networking
|
# setting --os-variant to ubuntu20.04 and ubuntu18.04 breaks SSH and networking
|
||||||
virt-install \
|
virt-install \
|
||||||
--name cloudinit-1 \
|
--name cloudinit-1 \
|
||||||
--ram 2048 \
|
--ram "$RAM" \
|
||||||
--vcpus 1\
|
--vcpus "$CPUS" \
|
||||||
--cpu host \
|
--cpu host \
|
||||||
--arch x86_64 \
|
--arch x86_64 \
|
||||||
--os-type linux \
|
--os-type linux \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user