Skip to content

Commit 21987cc

Browse files
Pramodh Pallapothueriknordmark
authored andcommitted
Improve logging in cpuallocator
Add little more info to error message and also print actual error in domainmgr. Signed-off-by: Pramodh Pallapothu <pramodh@zededa.com>
1 parent 9f05f7f commit 21987cc

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

pkg/pillar/cmd/domainmgr/domainmgr.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1389,7 +1389,7 @@ func assignCPUs(ctx *domainContext, config *types.DomainConfig, status *types.Do
13891389
if config.VmConfig.CPUsPinned { // Pin the CPU
13901390
cpusToAssign, err := ctx.cpuAllocator.Allocate(config.UUIDandVersion.UUID, config.VCpus)
13911391
if err != nil {
1392-
return errors.New("failed to allocate necessary amount of CPUs")
1392+
return err
13931393
}
13941394
for _, cpu := range cpusToAssign {
13951395
status.VmConfig.CPUs = append(status.VmConfig.CPUs, cpu)
@@ -1680,7 +1680,7 @@ func doActivate(ctx *domainContext, config types.DomainConfig,
16801680

16811681
if ctx.cpuPinningSupported {
16821682
if err := assignCPUs(ctx, &config, status); err != nil {
1683-
log.Warnf("failed to assign CPUs for %s", config.DisplayName)
1683+
log.Warnf("failed to assign CPUs for %s err %v", config.DisplayName, err)
16841684
errDescription := types.ErrorDescription{Error: err.Error()}
16851685
status.SetErrorDescription(errDescription)
16861686
publishDomainStatus(ctx, status)

pkg/pillar/cpuallocator/cpuallocator.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ func (cpuAllocator *CPUAllocator) getFree(numCPUsRequested int) ([]uint32, error
101101
}
102102
}
103103
if found < numCPUsRequested {
104-
return []uint32{}, fmt.Errorf("looking for %d CPUs only found %d",
105-
numCPUsRequested, found)
104+
return []uint32{}, fmt.Errorf("looking for %d CPUs only found %d reserved for EVE %d total %d",
105+
numCPUsRequested, found, cpuAllocator.numReservedForEVE, cpuAllocator.totalCPUs)
106106
}
107107
return result, nil
108108
}

0 commit comments

Comments
 (0)