Skip to content

Commit

Permalink
zedmanager: do not report RESTARTING or PURGING
Browse files Browse the repository at this point in the history
include removing dead code

Signed-off-by: Christoph Ostarek <christoph@zededa.com>

Signed-off-by: Christoph Ostarek <christoph@zededa.com>
  • Loading branch information
christoph-zededa committed May 17, 2024
1 parent 31d0d4e commit cfd5c60
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 30 deletions.
4 changes: 0 additions & 4 deletions pkg/pillar/cmd/zedagent/parseconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,6 @@ func countRunningApps(getconfigCtx *getconfigContext) (runningCount uint) {
switch status.State {
case types.BOOTING, types.RUNNING, types.HALTING:
runningCount++
case types.PURGING, types.RESTARTING:
log.Noticef("countRunningApps: %s for %s in %s",
status.Key(), status.DisplayName, status.State)
runningCount++
}
}
return runningCount
Expand Down
13 changes: 4 additions & 9 deletions pkg/pillar/cmd/zedmanager/updatestatus.go
Original file line number Diff line number Diff line change
Expand Up @@ -802,15 +802,10 @@ func doActivate(ctx *zedmanagerContext, uuidStr string,
}
}
if ds.State != status.State {
switch status.State {
case types.RESTARTING, types.PURGING:
// Leave unchanged
default:
log.Functionf("Set State from DomainStatus from %d to %d",
status.State, ds.State)
status.State = ds.State
changed = true
}
log.Functionf("Set State from DomainStatus from %d to %d",
status.State, ds.State)
status.State = ds.State
changed = true
}
// XXX compare with equal before setting changed?
status.IoAdapterList = ds.IoAdapterList
Expand Down
5 changes: 1 addition & 4 deletions pkg/pillar/cmd/zedmanager/zedmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -1074,7 +1074,6 @@ func handleCreate(ctxArg interface{}, key string,
log.Warnf("handleCreate(%v) for %s found different purge counter %d vs. %d",
config.UUIDandVersion, config.DisplayName, persistedCounter, configCounter)
status.PurgeInprogress = types.DownloadAndVerify
status.State = types.PURGING
status.PurgeStartedAt = time.Now()
// We persist the PurgeCmd Counter when
// PurgeInprogress is done
Expand Down Expand Up @@ -1234,8 +1233,7 @@ func handleModify(ctxArg interface{}, key string,
// Will restart even if we crash/power cycle since that
// would also restart the app. Hence we can update
// the status counter here.
status.RestartInprogress = types.BringDown
status.State = types.RESTARTING
status.RestartInprogress = types.BringDown // indicate to restart
status.RestartStartedAt = time.Now()
} else {
log.Functionf("handleModify(%v) for %s restartcmd ignored config !Activate",
Expand Down Expand Up @@ -1266,7 +1264,6 @@ func handleModify(ctxArg interface{}, key string,
status.ClearErrorWithSource()
}
status.PurgeInprogress = types.DownloadAndVerify
status.State = types.PURGING
status.PurgeStartedAt = time.Now()
// We persist the PurgeCmd Counter when PurgeInprogress is done
} else if needPurge {
Expand Down
16 changes: 3 additions & 13 deletions pkg/pillar/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (

// SwState started with enum names from OMA-TS-LWM2M_SwMgmt-V1_0-20151201-C
// but now has many additions.
// They are in order of progression (except for the RESTARTING and PURGING ones)
// They are in order of progression
// We map this to info.ZSwState
type SwState uint8

Expand All @@ -44,10 +44,8 @@ const (
PAUSED
HALTING // being halted
HALTED
RESTARTING // Restarting due to config change or zcli
PURGING // Purging due to config change
BROKEN // Domain is still alive, but its device model has failed
UNKNOWN // State of the domain can't be determined
BROKEN // BROKEN means domain is still alive, but its device model has failed
UNKNOWN // UNKNOWN means state of the domain can't be determined
// PENDING to start
PENDING
// SCHEDULING waiting to be scheduled
Expand Down Expand Up @@ -98,10 +96,6 @@ func (state SwState) String() string {
return "HALTING"
case HALTED:
return "HALTED"
case RESTARTING:
return "RESTARTING"
case PURGING:
return "PURGING"
case PENDING:
return "PENDING"
case FAILED:
Expand Down Expand Up @@ -170,10 +164,6 @@ func (state SwState) ZSwState() info.ZSwState {
return info.ZSwState_HALTING
case HALTED:
return info.ZSwState_HALTED
case RESTARTING:
return info.ZSwState_RESTARTING
case PURGING:
return info.ZSwState_PURGING
// we map BROKEN to HALTING to indicate that EVE has an active
// role in reaping BROKEN domains and transitioning them to
// a final HALTED state
Expand Down

0 comments on commit cfd5c60

Please sign in to comment.