Add the ability to pass a disk size to the create_vm script
Defaults to 10GB
This commit is contained in:
		
							parent
							
								
									d1ab4c24ea
								
							
						
					
					
						commit
						ab422155e4
					
				| @ -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" | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user