Skip to content

Commit

Permalink
resmgr: exit when ttrpc connection goes down.
Browse files Browse the repository at this point in the history
We do not have proper connection re-establishment and the policy-
agnostic resource management layer will require changes for this
to be possible. Until we get that done, exit the plugin when the
ttrpc connection goes down instead of just sitting there pretend-
ing everything is fine.

Signed-off-by: Krisztian Litkey <[email protected]>
  • Loading branch information
klihub committed May 17, 2024
1 parent bdddfce commit 98e4d7d
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions pkg/resmgr/nri.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package resmgr
import (
"context"
"fmt"
"os"

"github.com/containers/nri-plugins/pkg/instrumentation/tracing"
logger "github.com/containers/nri-plugins/pkg/log"
Expand Down Expand Up @@ -106,13 +107,9 @@ func (p *nriPlugin) stop() {
p.stub.Stop()
}

func (p *nriPlugin) restart() error {
return p.start()
}

func (p *nriPlugin) onClose() {
p.resmgr.Warn("connection to NRI/runtime lost, trying to reconnect...")
p.restart()
p.resmgr.Warn("connection to NRI/runtime lost, exiting...")
os.Exit(1)
}

func (p *nriPlugin) Configure(ctx context.Context, cfg, runtime, version string) (stub.EventMask, error) {
Expand Down

0 comments on commit 98e4d7d

Please sign in to comment.