From 9a4420fc114e96374ff969a5f8f560f60beba72f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Greg=20Kar=C3=A9kinian?= Date: Fri, 22 Jan 2021 13:49:23 +0100 Subject: [PATCH] Add the ability to pass a disk size to the create_vm script Defaults to 10GB --- site-cookbooks/kosmos_kvm/files/create_vm | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/site-cookbooks/kosmos_kvm/files/create_vm b/site-cookbooks/kosmos_kvm/files/create_vm index db4cf8e..0c82f2d 100644 --- a/site-cookbooks/kosmos_kvm/files/create_vm +++ b/site-cookbooks/kosmos_kvm/files/create_vm @@ -5,13 +5,14 @@ if [[ $# -lt 3 ]] ; then cat <<-EOF USAGE (RAM in megabytes) -create_vm VMNAME RAM CPUS +create_vm VMNAME RAM CPUS DISKSIZE EOF exit 1 fi VMNAME=$1 RAM=$2 CPUS=$3 +DISKSIZE=${4:-10} # 10GB default # Directory where image files will be stored IMAGE_DIR=/var/lib/libvirt/images @@ -20,9 +21,6 @@ IMAGE_PATH=$IMAGE_DIR/$IMAGE_FILE CIDATA_PATH=${IMAGE_DIR}/cidata-${VMNAME}.iso BASE_FILE=${IMAGE_DIR}/base/ubuntu-20.04-server-cloudimg-amd64-disk-kvm.qcow2 -# Disk size assigned to the VM -DISKSIZE=10 # Unit: GB - # Create the VM image if it does not already exist if [ ! -f "$IMAGE_PATH" ]; then echo "info: image file $IMAGE_PATH not found. creating new image"