Files
ubicloud/prog/vm/vm_host_slice_nexus.rb
Maciek Sarnowicz 335c1746fa Creation of Standard VMs in slices
Using the VmHostSlice introduced earlier to allocate a Standard VM. The main premise here is that VMs-in-slices are hosted on separate hosts from standalone VMs (the current code). This logic is guarded by two flags:
* VmHost.accept_slices - indicates host instances that can accept VMs allocated in slices. Hosts with this flag set to `true` will not be used for standalone VMs
* Project feature flag - `use_slices_for_allocation` - only projects with this flag enabled will use the new logic of creating VMs in slices.

With those two flags we can control the rollout of this feature. Note that if project is marked with `use_slices_for_allocation` but there are not VmHosts that can accept_slices, the user will see 'no capacity' error.

The allocator is modified to use a new VmHostSliceAllocation class that wraps and replaces VmHostAllocation when slice logic is enabled. It finds the capacity the same way as before, but when `update` is called it creates a slice first together with allocation of VmHostCpus before starting the VM creation process. This is a building block that will be expanded upon when we introduce 'burstable' instances later, when multiple VMs can share a slice.

For now, for 'Standard' family there is a 1:1 mapping between the slice and a VM inside it, and their lifespans. Slice is created first, then the VM. Slice creation updates the utilization of the VmHost, and the VM creation updates the utilization of the slice hosting it. Again, this will be more relevant when multiple VMs will be sharing a slice.
2025-01-28 17:16:51 -08:00

3.4 KiB