Allow creating VMs with implicit CPU and memory (#243)

* Allow creating VMs with implicit CPU and memory

* Clarify why cpu/memory can be 0 a bit better

* Controller(API): don't forget to update DefaultCPU and DefaultMemory

* Add an integration test for implicit CPU and memory
This commit is contained in:
Nikolay Edigaryev
2025-02-06 00:50:01 +04:00
committed by GitHub
parent 6b3d64be96
commit 581de320b9
10 changed files with 150 additions and 12 deletions
+15 -2
View File
@@ -65,8 +65,21 @@ func runGetVM(cmd *cobra.Command, args []string) error {
table.AddRow("Created", createdAtInfo)
table.AddRow("Image", vm.Image)
table.AddRow("Image pull policy", vm.ImagePullPolicy)
table.AddRow("CPU", vm.CPU)
table.AddRow("Memory", vm.Memory)
cpu := vm.CPU
if cpu == 0 {
// Implicit CPU assignment, CPU will always be 0
cpu = vm.AssignedCPU
}
table.AddRow("CPU", cpu)
memory := vm.Memory
if memory == 0 {
// Implicit memory assignment, memory will always be 0
memory = vm.AssignedMemory
}
table.AddRow("Memory", memory)
table.AddRow("Softnet enabled", vm.NetSoftnet)
table.AddRow("Bridged networking interface", nonEmptyOrNone(vm.NetBridged))
table.AddRow("Headless mode", vm.Headless)