From c3fbce46b7dd2a7429259b2c9c2066807dd0fc6a Mon Sep 17 00:00:00 2001 From: Alex Dadgar Date: Mon, 19 Oct 2015 13:33:22 -0700 Subject: [PATCH] Update cgroup CPU to use int comparison not float --- client/executor/exec_linux.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/executor/exec_linux.go b/client/executor/exec_linux.go index c97ce963b..211cdb2fa 100644 --- a/client/executor/exec_linux.go +++ b/client/executor/exec_linux.go @@ -195,9 +195,9 @@ func (e *LinuxExecutor) configureCgroups(resources *structs.Resources) error { e.groups.MemorySwap = int64(-1) } - if resources.CPU > 0.0 { - if resources.CPU < 2.0 { - return fmt.Errorf("resources.CPU must be equal to or greater than 2.0: %v", resources.CPU) + if resources.CPU != 0 { + if resources.CPU < 2 { + return fmt.Errorf("resources.CPU must be equal to or greater than 2: %v", resources.CPU) } // Set the relative CPU shares for this cgroup.