Skip to content

Commit

Permalink
Merge branch 'disable-subroutines' of github.com:davidallendj/smd int…
Browse files Browse the repository at this point in the history
…o goreleaser

Merging the disable-subroutines branch with the goreleaser work that already deprecated all kafka interactions
  • Loading branch information
alexlovelltroy committed Oct 10, 2023
2 parents 60c299e + 6df2421 commit 2853c46
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
28 changes: 21 additions & 7 deletions cmd/smd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,10 @@ type SmD struct {
msgbusListen string
logLevelIn int

hwInvHistAgeMax int
smapCompEP *SyncMap
genTestPayloads string
hwInvHistAgeMax int
smapCompEP *SyncMap
genTestPayloads string
disableDiscovery bool

// v2 APIs
apiRootV2 string
Expand Down Expand Up @@ -555,6 +556,7 @@ func (s *SmD) parseCmdLine() {
flag.StringVar(&s.dbPortStr, "dbport", "", "Database port")
flag.StringVar(&s.dbOpts, "dbopts", "", "Database options string")
flag.BoolVar(&applyMigrations, "migrate", false, "Apply all database migrations before starting")
flag.BoolVar(&s.disableDiscovery, "disable-discovery", false, "Disable discovery-related subroutines")
help := flag.Bool("h", false, "Print help and exit")

flag.Parse()
Expand Down Expand Up @@ -907,7 +909,16 @@ func main() {
s.wpRFEvent.Run()

// Start monitoring message bus, if configured
s.smapCompEP = NewSyncMap(ComponentEndpointSMap(&s))
// s.smapCompEP = NewSyncMap(ComponentEndpointSMap(&s))
// if s.msgbusListen != "" {
// if err := s.MsgBusConfig(s.msgbusListen); err != nil {
// s.LogAlways("WARNING: Cannot parse message bus host: %s", err)
// } else {
// go s.StartRFEventMonitor()
// }
// } else {
// s.LogAlways("No message bus host given (msg-host == \"%v\"). Not listening for events on the message bus.", s.msgbusListen)
// }

// Start the component lock cleanup thread
s.CompReservationCleanup()
Expand All @@ -918,12 +929,15 @@ func main() {
s.srfpJobList = make(map[string]*Job, 0)
s.discMap = make(map[string]int, 0)
s.JobSync()
s.DiscoverySync()
s.DiscoveryUpdater()
if !s.disableDiscovery {
s.DiscoverySync()
s.DiscoveryUpdater()
}

// Start serving HTTP
var router *mux.Router
routes := s.generateRoutes()
router := s.NewRouter(routes)
router = s.NewRouter(routes)

s.LogAlways("GOMAXPROCS is: %v", runtime.GOMAXPROCS(0))
s.LogAlways("Listening for connections at: ", s.httpListen)
Expand Down
4 changes: 3 additions & 1 deletion cmd/smd/smd-api.go
Original file line number Diff line number Diff line change
Expand Up @@ -2479,7 +2479,9 @@ func (s *SmD) doRedfishEndpointsPost(w http.ResponseWriter, r *http.Request) {
// Do discovery if needed on new Endpoints. Should never need to
// force this because the endpoint should always be new, else we would
// have already failed the operation.
go s.discoverFromEndpoints(eps.RedfishEndpoints, 0, true, false)
if !s.disableDiscovery {
go s.discoverFromEndpoints(eps.RedfishEndpoints, 0, true, false)
}

// Send a URI array of the created resources, along with 201 (created).
uris := eps.GetResourceURIArray(s.redfishEPBaseV2)
Expand Down

0 comments on commit 2853c46

Please sign in to comment.