ubicloud/migrate/20241016_add_cpuset.rb
Maciek Sarnowicz 0b50b83445 'burstable' and 'sharable' VM families added on Control Plane
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")
2024-11-05 06:56:47 -08:00

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