Skip to content

Commit

Permalink
Merge pull request #2676 from Creatone/nvm-fix
Browse files Browse the repository at this point in the history
Fix runtime error when there are no NVM devices.
  • Loading branch information
dashpole authored Oct 16, 2020
2 parents 013e451 + 05812f0 commit 5e4680a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions nvm/machine_libipmctl.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ func getAvgPowerBudget() (uint, error) {
return uint(0), fmt.Errorf("Unable to get number of NVM devices. Status code: %d", err)
}

if count == 0 {
klog.Warningf("There are no NVM devices!")
return uint(0), nil
}

// Load basic device information for all the devices
// to obtain UID of the first one.
devices := make([]C.struct_device_discovery, count)
Expand Down

0 comments on commit 5e4680a

Please sign in to comment.