1
0
Fork 0

Support specifying disk size

This commit is contained in:
Nicolas Jeannerod 2025-02-27 12:22:27 +01:00
parent 52e4dc8aec
commit 0b18938eaa
Signed by untrusted user: Niols
GPG key ID: 35DB9EC8886E1CB8
3 changed files with 11 additions and 3 deletions

View file

@ -71,6 +71,12 @@ in
default = 2048;
};
diskSize = mkOption {
type = types.int;
description = "The amount of disk of the VM in GiB.";
default = 32;
};
##########################################################################
## Networking

View file

@ -120,6 +120,7 @@ let
sockets
cores
memory
diskSize
hostPublicKey
unsafeHostPrivateKey

View file

@ -191,6 +191,7 @@ but I got proxmox = '%s' for VM %s." "$proxmox" "$vm_name"
sockets=$(echo "$options" | jq -r .sockets)
cores=$(echo "$options" | jq -r .cores)
memory=$(echo "$options" | jq -r .memory)
disk_size=$(echo "$options" | jq -r .diskSize)
host_public_key=$(echo "$options" | jq -r .hostPublicKey)
host_private_key=$(echo "$options" | jq -r .unsafeHostPrivateKey)
@ -199,8 +200,8 @@ but I got proxmox = '%s' for VM %s." "$proxmox" "$vm_name"
die 'I do not know what to do with a private key but no public key.'
fi
printf 'done grabing VM options for VM %s. Got:\n id: %d\n sockets: %d\n cores: %d\n memory: %d MiB\n' \
"$vm_name" "$vm_id" "$sockets" "$cores" "$memory"
printf 'done grabing VM options for VM %s. Got:\n id: %d\n sockets: %d\n cores: %d\n memory: %d MiB\n disk size: %d GiB\n' \
"$vm_name" "$vm_id" "$sockets" "$cores" "$memory" "$disk_size"
}
################################################################################
@ -297,7 +298,7 @@ create_vm () {
agent==1 \
\
scsihw==virtio-scsi-single \
scsi0=='linstor_storage:32,discard=on,ssd=on,iothread=on' \
scsi0=="linstor_storage:$disk_size,discard=on,ssd=on,iothread=on" \
\
sockets=="$sockets" \
cores=="$cores" \