mirror of
https://github.com/fnproject/fn.git
synced 2022-10-28 21:29:17 +03:00
Add support for counting kdumps in pure-runner. (#1309)
This commit is contained in:
committed by
Tolga Ceylan
parent
4ac397dece
commit
af59d19d24
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user