Update openvswitch to support cgroups v2
Adds check and if cgroups v2 is active use cgroups v2 file structure for setting cpus Change-Id: I603271a1b043d192988694c50ea7411a567b16ca
This commit is contained in:
parent
ff552d5969
commit
b769895a60
@ -15,7 +15,7 @@ apiVersion: v1
|
|||||||
appVersion: v1.0.0
|
appVersion: v1.0.0
|
||||||
description: OpenStack-Helm OpenVSwitch
|
description: OpenStack-Helm OpenVSwitch
|
||||||
name: openvswitch
|
name: openvswitch
|
||||||
version: 0.1.18
|
version: 0.1.19
|
||||||
home: http://openvswitch.org
|
home: http://openvswitch.org
|
||||||
icon: https://www.openstack.org/themes/openstack/images/project-mascots/Neutron/OpenStack_Project_Neutron_vertical.png
|
icon: https://www.openstack.org/themes/openstack/images/project-mascots/Neutron/OpenStack_Project_Neutron_vertical.png
|
||||||
sources:
|
sources:
|
||||||
|
@ -77,19 +77,38 @@ function start () {
|
|||||||
|
|
||||||
# No need to create the cgroup if lcore_mask or pmd_cpu_mask is not set.
|
# No need to create the cgroup if lcore_mask or pmd_cpu_mask is not set.
|
||||||
if [[ -n ${PMD_CPU_MASK} || -n ${LCORE_MASK} ]]; then
|
if [[ -n ${PMD_CPU_MASK} || -n ${LCORE_MASK} ]]; then
|
||||||
# Setup Cgroups to use when breaking out of Kubernetes defined groups
|
if [ "$(stat -fc %T /sys/fs/cgroup/)" = "cgroup2fs" ]; then
|
||||||
mkdir -p /sys/fs/cgroup/cpuset/osh-openvswitch
|
# Setup Cgroups to use when breaking out of Kubernetes defined groups
|
||||||
target_mems="/sys/fs/cgroup/cpuset/osh-openvswitch/cpuset.mems"
|
mkdir -p /sys/fs/cgroup/osh-openvswitch
|
||||||
target_cpus="/sys/fs/cgroup/cpuset/osh-openvswitch/cpuset.cpus"
|
target_mems="/sys/fs/cgroup/osh-openvswitch/cpuset.mems"
|
||||||
|
target_cpus="/sys/fs/cgroup/osh-openvswitch/cpuset.cpus"
|
||||||
|
touch $target_mems
|
||||||
|
touch $target_cpus
|
||||||
|
|
||||||
# Ensure the write target for the for cpuset.mem for the pod exists
|
# Ensure the write target for the for cpuset.mem for the pod exists
|
||||||
if [[ -f "$target_mems" && -f "$target_cpus" ]]; then
|
if [[ -f "$target_mems" && -f "$target_cpus" ]]; then
|
||||||
# Write cpuset.mem and cpuset.cpus for new cgroup and add current task to new cgroup
|
# Write cpuset.mem and cpuset.cpus for new cgroup and add current task to new cgroup
|
||||||
cat /sys/fs/cgroup/cpuset/cpuset.mems > "$target_mems"
|
cat /sys/fs/cgroup/cpuset.mems.effective > "$target_mems"
|
||||||
cat /sys/fs/cgroup/cpuset/cpuset.cpus > "$target_cpus"
|
cat /sys/fs/cgroup/cpuset.cpus.effective > "$target_cpus"
|
||||||
echo $$ > /sys/fs/cgroup/cpuset/osh-openvswitch/tasks
|
echo $$ > /sys/fs/cgroup/osh-openvswitch/cgroup.procs
|
||||||
|
else
|
||||||
|
echo "ERROR: Could not find write target for either cpuset.mems: $target_mems or cpuset.cpus: $target_cpus"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "ERROR: Could not find write target for either cpuset.mems: $target_mems or cpuset.cpus: $target_cpus"
|
# Setup Cgroups to use when breaking out of Kubernetes defined groups
|
||||||
|
mkdir -p /sys/fs/cgroup/cpuset/osh-openvswitch
|
||||||
|
target_mems="/sys/fs/cgroup/cpuset/osh-openvswitch/cpuset.mems"
|
||||||
|
target_cpus="/sys/fs/cgroup/cpuset/osh-openvswitch/cpuset.cpus"
|
||||||
|
|
||||||
|
# Ensure the write target for the for cpuset.mem for the pod exists
|
||||||
|
if [[ -f "$target_mems" && -f "$target_cpus" ]]; then
|
||||||
|
# Write cpuset.mem and cpuset.cpus for new cgroup and add current task to new cgroup
|
||||||
|
cat /sys/fs/cgroup/cpuset/cpuset.mems > "$target_mems"
|
||||||
|
cat /sys/fs/cgroup/cpuset/cpuset.cpus > "$target_cpus"
|
||||||
|
echo $$ > /sys/fs/cgroup/cpuset/osh-openvswitch/tasks
|
||||||
|
else
|
||||||
|
echo "ERROR: Could not find write target for either cpuset.mems: $target_mems or cpuset.cpus: $target_cpus"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
@ -19,4 +19,5 @@ openvswitch:
|
|||||||
- 0.1.16 Restore ServiceAccount to openvswitch pod
|
- 0.1.16 Restore ServiceAccount to openvswitch pod
|
||||||
- 0.1.17 Add buffer to wait for potential new CTL file before running chown
|
- 0.1.17 Add buffer to wait for potential new CTL file before running chown
|
||||||
- 0.1.18 Add value for extra poststart command
|
- 0.1.18 Add value for extra poststart command
|
||||||
|
- 0.1.19 Add check for cgroups v2 file structure
|
||||||
...
|
...
|
||||||
|
Loading…
Reference in New Issue
Block a user