Adding more logic on Control Plane to help with creating of VMs inside slices. Also introduced new families and VM configurations to help with experimentation. - two new families added: 'burstable' and 'sharable'. Both get created in an isolated slice called like the family. Allowed sizes are -50 and -100 which mean 50% or 100% vCPU, respectively. Burstable instances can go up another 50% or 100%. - iniital slice allocation and tracking at VmHost level, this will need to be changed later - cleaned up some earlier hardcoded values on Data Plane side - temporarily turned off CPU accounting on VmHost/Allocator to allow for overcommiting With this, new instances can be created with: Prog::Vm::Nexus.assemble(File.read("/home/maciek/.ssh/id_ed25519.pub"), Project.first.id, name: "r2d2", size: "burstable-50", location: "hetzner-fsn1", enable_ip4: true, boot_image: "ubuntu-jammy")
20 lines
693 B
Ruby
20 lines
693 B
Ruby
# frozen_string_literal: true
|
|
|
|
Sequel.migration do
|
|
change do
|
|
alter_table(:vm) do
|
|
add_column :memory, :integer, null: true
|
|
add_column :max_cpu, :integer, null: true
|
|
add_column :max_cpu_burst, :integer, null: true
|
|
add_column :slice_name, :text, collate: '"C"', null: true
|
|
add_column :allowed_cpus, :text, collate: '"C"', null: true
|
|
end
|
|
|
|
# Update the memory amount for exisitng VMs, to match the logic from the code
|
|
run "UPDATE vm SET memory = CASE WHEN arch = 'arm64' THEN 3.2 * cores WHEN family = 'standard-gpu' THEN 10.68 * cores ELSE 8 * cores END;"
|
|
|
|
alter_table(:vm_host) do
|
|
add_column :slices, :jsonb, null: true
|
|
end
|
|
end
|
|
end
|