mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 18:35:44 +03:00
Don't retrieve Driver Stats if unsupported
This PR makes us only try to collect stats once if the Driver doesn't support collecting stats. Fixes https://github.com/hashicorp/nomad/issues/1986
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package driver
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
@@ -16,16 +17,22 @@ import (
|
||||
cstructs "github.com/hashicorp/nomad/client/structs"
|
||||
)
|
||||
|
||||
// BuiltinDrivers contains the built in registered drivers
|
||||
// which are available for allocation handling
|
||||
var BuiltinDrivers = map[string]Factory{
|
||||
"docker": NewDockerDriver,
|
||||
"exec": NewExecDriver,
|
||||
"raw_exec": NewRawExecDriver,
|
||||
"java": NewJavaDriver,
|
||||
"qemu": NewQemuDriver,
|
||||
"rkt": NewRktDriver,
|
||||
}
|
||||
var (
|
||||
// BuiltinDrivers contains the built in registered drivers
|
||||
// which are available for allocation handling
|
||||
BuiltinDrivers = map[string]Factory{
|
||||
"docker": NewDockerDriver,
|
||||
"exec": NewExecDriver,
|
||||
"raw_exec": NewRawExecDriver,
|
||||
"java": NewJavaDriver,
|
||||
"qemu": NewQemuDriver,
|
||||
"rkt": NewRktDriver,
|
||||
}
|
||||
|
||||
// DriverStatsNotImplemented is the error to be returned if a driver doesn't
|
||||
// implement stats.
|
||||
DriverStatsNotImplemented = errors.New("stats not implemented for driver")
|
||||
)
|
||||
|
||||
// NewDriver is used to instantiate and return a new driver
|
||||
// given the name and a logger
|
||||
|
||||
@@ -541,7 +541,7 @@ func (h *rktHandle) Kill() error {
|
||||
}
|
||||
|
||||
func (h *rktHandle) Stats() (*cstructs.TaskResourceUsage, error) {
|
||||
return nil, fmt.Errorf("stats not implemented for rkt")
|
||||
return nil, DriverStatsNotImplemented
|
||||
}
|
||||
|
||||
func (h *rktHandle) run() {
|
||||
|
||||
Reference in New Issue
Block a user