Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions pkg/agent/server/ovn.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ func (man *ovnMan) Start(ctx context.Context) {
man.refresh(ctx)
case <-ctx.Done():
log.Infof("ovn man bye")
close(man.c)
man.c = nil
return
}
}
Expand Down Expand Up @@ -410,6 +412,9 @@ func (man *ovnMan) SetHostId(ctx context.Context, hostId string) {
}

func (man *ovnMan) SetGuestNICs(ctx context.Context, guestId string, nics []*utils.GuestNIC) {
if man.c == nil {
return
}
req := &ovnReq{
ctx: ctx,
guestId: guestId,
Expand Down
14 changes: 6 additions & 8 deletions pkg/agent/server/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
"context"
"fmt"
"os"
"os/signal"
"syscall"

"yunion.io/x/log"
Expand Down Expand Up @@ -85,14 +84,13 @@ func StartService() {
log.Warningf("host config content changed")
s.Stop()
})
go func() {
sigChan := make(chan os.Signal, 1)
signal.Notify(sigChan, syscall.SIGINT, syscall.SIGTERM)
defer signal.Stop(sigChan)
sig := <-sigChan
log.Infof("signal received: %s", sig)
signalutils.SetDumpStackSignal()
quitSignals := []os.Signal{syscall.SIGHUP, syscall.SIGINT, syscall.SIGQUIT, syscall.SIGTERM}
signalutils.RegisterSignal(func() {
log.Infof("signal received")
s.Stop()
}()
}, quitSignals...)
signalutils.StartTrap()
if err := s.Start(ctx); err != nil {
log.Warningf("Start server error: %v", err)
}
Expand Down
Loading