From 52213ca7543d4110d8465fc361c8bdffa2d3a807 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iago=20L=C3=B3pez=20Galeiras?= Date: Wed, 20 May 2015 15:06:15 +0200 Subject: [PATCH] stage1: handle CPU isolator --- stage1/init/pod.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/stage1/init/pod.go b/stage1/init/pod.go index 965cdc1..8e75a16 100644 --- a/stage1/init/pod.go +++ b/stage1/init/pod.go @@ -254,6 +254,14 @@ func (p *Pod) appToSystemd(ra *schema.RuntimeApp, am *schema.ImageManifest, inte case *types.ResourceMemory: l := v.Limit().String() opts = append(opts, newUnitOption("Service", "MemoryLimit", l)) + case *types.ResourceCPU: + l := v.Limit().String() + milliCores, err := strconv.Atoi(l) + if err != nil { + return err + } + quota := strconv.Itoa(milliCores/10) + "%" + opts = append(opts, newUnitOption("Service", "CPUQuota", quota)) } }