Merge pull request #1587 from nak3/rkt-fix4

rkt.driver: Fix wrong MB calculation
This commit is contained in:
Alex Dadgar 2016-08-15 10:28:52 -07:00 committed by GitHub
commit 44e7075087

View file

@ -39,9 +39,6 @@ const (
// version to maintain an uniform interface across all drivers // version to maintain an uniform interface across all drivers
minRktVersion = "0.14.0" minRktVersion = "0.14.0"
// bytesToMB is the conversion from bytes to megabytes.
bytesToMB = 1024 * 1024
// The key populated in the Node Attributes to indicate the presence of the // The key populated in the Node Attributes to indicate the presence of the
// Rkt driver // Rkt driver
rktDriverAttr = "driver.rkt" rktDriverAttr = "driver.rkt"
@ -241,7 +238,7 @@ func (d *RktDriver) Start(ctx *ExecContext, task *structs.Task) (DriverHandle, e
} }
// Add memory isolator // Add memory isolator
cmdArgs = append(cmdArgs, fmt.Sprintf("--memory=%vM", int64(task.Resources.MemoryMB)*bytesToMB)) cmdArgs = append(cmdArgs, fmt.Sprintf("--memory=%vM", int64(task.Resources.MemoryMB)))
// Add CPU isolator // Add CPU isolator
cmdArgs = append(cmdArgs, fmt.Sprintf("--cpu=%vm", int64(task.Resources.CPU))) cmdArgs = append(cmdArgs, fmt.Sprintf("--cpu=%vm", int64(task.Resources.CPU)))