From 94a34e4758ce6f0bd2a6d629cf6a9ba340dc383d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Greg=20Kar=C3=A9kinian?= Date: Tue, 8 Dec 2020 16:33:27 +0100 Subject: [PATCH] Add arguments for RAM and number of CPUs --- site-cookbooks/kosmos_kvm/files/create_vm | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/site-cookbooks/kosmos_kvm/files/create_vm b/site-cookbooks/kosmos_kvm/files/create_vm index 4702bb6..bdb0b81 100644 --- a/site-cookbooks/kosmos_kvm/files/create_vm +++ b/site-cookbooks/kosmos_kvm/files/create_vm @@ -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) + +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" \ --cpu host \ --arch x86_64 \ --os-type linux \