Script creating new VMs #252

Merged
raucao merged 16 commits from feature/244-new_vm_script into master 2020-12-09 15:33:08 +00:00
Showing only changes of commit 94a34e4758 - Show all commits

View File

@ -1,12 +1,17 @@
#!/bin/bash
set -e
if [[ $# -eq 0 ]] ; then
echo 'USAGE: create_vm VMNAME'
if [[ $# -lt 3 ]] ; then
cat <<-EOF
USAGE (RAM in megabytes)

This doesn't look right to me. It would attempt to download the path as a second file, no? The pathname should come after the -o flag.

However, why not just use a normal file download resource in the KVM host recipe in the first place? Same amount of characters as this extended comment, but then it's automated and handles existing files.

This doesn't look right to me. It would attempt to download the path as a second file, no? The pathname should come after the `-o` flag. However, why not just use a normal file download resource in the KVM host recipe in the first place? Same amount of characters as this extended comment, but then it's automated and handles existing files.
create_vm VMNAME RAM CPUS
EOF
exit 1
fi
VMNAME=$1
RAM=$2
CPUS=$3
# Directory where image files will be stored
IMAGE_DIR=/var/lib/libvirt/images
@ -67,8 +72,8 @@ fi
# setting --os-variant to ubuntu20.04 and ubuntu18.04 breaks SSH and networking
virt-install \
--name cloudinit-1 \
--ram 2048 \
--vcpus 1\
--ram "$RAM" \
--vcpus "$CPUS" \

We won't want to edit the script on the host all the time, so why not simply:

  --ram $2 \
  --vcpus $3 \
We won't want to edit the script on the host all the time, so why not simply: ```bash --ram $2 \ --vcpus $3 \ ```
--cpu host \
--arch x86_64 \
--os-type linux \