mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-16 22:50:10 +03:00
F #4089: add CPU limitations
This commit is contained in:
parent
6e5ffdeb24
commit
57bdb17160
@ -143,7 +143,7 @@ class MicroVM
|
||||
def cpu_shares(cpu)
|
||||
# default value for cpu.shares
|
||||
default_value = 1024
|
||||
shares_enabled = @one.fcrc[:cgroup_cpu_shares].downcase == 'true'
|
||||
shares_enabled = @one.fcrc[:cgroup_cpu_shares] == true
|
||||
|
||||
return default_value if !shares_enabled || cpu.nil? || cpu == ''
|
||||
|
||||
|
@ -65,6 +65,6 @@ mount -o bind "$SYSDS_PATH/$VM_ID" "$ROOTFS_PATH"
|
||||
###############################################################################
|
||||
# Set cpu.shares value to restrict cpu usage
|
||||
###############################################################################
|
||||
mkdir "$CGROUP_PATH/cpu/firecracker/one-$VM_ID"
|
||||
mkdir -p "$CGROUP_PATH/cpu/firecracker/one-$VM_ID"
|
||||
echo "$CPU_VAL" > "$CGROUP_PATH/cpu/firecracker/one-$VM_ID/cpu.shares"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user