Add support for counting kdumps in pure-runner. (#1309)

This commit is contained in:
Krister Johansen
2018-11-21 16:26:30 -08:00
committed by Tolga Ceylan
parent 4ac397dece
commit af59d19d24
5 changed files with 401 additions and 171 deletions

View File

@@ -542,6 +542,7 @@ type statusTracker struct {
inflight int32
requestsReceived uint64
requestsHandled uint64
kdumpsOnDisk uint64
imageName string
// lock protects expiry/cache/wait fields below. RunnerStatus ptr itself
@@ -899,6 +900,7 @@ func (pr *pureRunner) handleStatusCall(ctx context.Context) (*runner.RunnerStatu
cachePtr.Active = atomic.LoadInt32(&pr.status.inflight)
cachePtr.RequestsReceived = atomic.LoadUint64(&pr.status.requestsReceived)
cachePtr.RequestsHandled = atomic.LoadUint64(&pr.status.requestsHandled)
cachePtr.KdumpsOnDisk = atomic.LoadUint64(&pr.status.kdumpsOnDisk)
now = time.Now()
// Pointer store of 'cachePtr' is sufficient here as isWaiter/isCached above perform a shallow
@@ -997,6 +999,19 @@ func PureRunnerWithStatusImage(imgName string) PureRunnerOption {
}
}
// PureRunnerWithKdumpsOnDisk returns a PureRunnerOption that indicates that
// kdumps have been found on disk. The argument numKdump is a counter that
// indicates how many dumps were on disk at the time the runner was created.
func PureRunnerWithKdumpsOnDisk(numKdumps uint64) PureRunnerOption {
return func(pr *pureRunner) error {
if pr.status.kdumpsOnDisk != 0 {
return fmt.Errorf("Duplicate kdump count configuration! old=%d new=%d", pr.status.kdumpsOnDisk, numKdumps)
}
pr.status.kdumpsOnDisk = numKdumps
return nil
}
}
func PureRunnerWithDetached() PureRunnerOption {
return func(pr *pureRunner) error {
pr.AddCallListener(pr)