Skip to content

Commit

Permalink
cleanup redundant logs in cns savestate-file, createorUpdateNetworkCo… (
Browse files Browse the repository at this point in the history
#2442)

cleanup redundant logs in cns savestate-file, createorUpdateNetworkContainer
  • Loading branch information
kmurudi authored Dec 19, 2023
1 parent 2a024b8 commit 545d134
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
3 changes: 1 addition & 2 deletions cns/restserver/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -783,10 +783,9 @@ func (service *HTTPRestService) getHomeAz(w http.ResponseWriter, r *http.Request
}

func (service *HTTPRestService) createOrUpdateNetworkContainer(w http.ResponseWriter, r *http.Request) {
logger.Printf("[Azure CNS] createOrUpdateNetworkContainer")

var req cns.CreateNetworkContainerRequest
if err := service.Listener.Decode(w, r, &req); err != nil {
logger.Errorf("[Azure CNS] could not decode request: %v", err)
w.WriteHeader(http.StatusBadRequest)
return
}
Expand Down
10 changes: 3 additions & 7 deletions cns/restserver/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,17 @@ func (service *HTTPRestService) removeNetworkInfo(networkName string) {

// saveState writes CNS state to persistent store.
func (service *HTTPRestService) saveState() error {
logger.Printf("[Azure CNS] saveState")

// Skip if a store is not provided.
if service.store == nil {
logger.Printf("[Azure CNS] store not initialized.")
logger.Printf("[Azure CNS] store not initialized.")
return nil
}

// Update time stamp.
service.state.TimeStamp = time.Now()
err := service.store.Write(storeKey, &service.state)
if err == nil {
logger.Printf("[Azure CNS] State saved successfully.\n")
} else {
logger.Errorf("[Azure CNS] Failed to save state., err:%v\n", err)
if err != nil {
logger.Errorf("[Azure CNS] Failed to save state, err: %v", err)
}

return err
Expand Down

0 comments on commit 545d134

Please sign in to comment.