From 0b18938eaa4136bdab2677d2f4134cad7e567d6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20=E2=80=9CNiols=E2=80=9D=20Jeannerod?= <nicolas.jeannerod@moduscreate.com> Date: Thu, 27 Feb 2025 12:22:27 +0100 Subject: [PATCH] Support specifying disk size --- infra/common/options.nix | 6 ++++++ infra/flake-part.nix | 1 + infra/proxmox-provision.sh | 7 ++++--- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/infra/common/options.nix b/infra/common/options.nix index 0e9d5b54..230eea5d 100644 --- a/infra/common/options.nix +++ b/infra/common/options.nix @@ -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 diff --git a/infra/flake-part.nix b/infra/flake-part.nix index a14a4539..08be9cfe 100644 --- a/infra/flake-part.nix +++ b/infra/flake-part.nix @@ -120,6 +120,7 @@ let sockets cores memory + diskSize hostPublicKey unsafeHostPrivateKey diff --git a/infra/proxmox-provision.sh b/infra/proxmox-provision.sh index 0ecaaa06..8b4d4b55 100755 --- a/infra/proxmox-provision.sh +++ b/infra/proxmox-provision.sh @@ -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" \