Merge pull request #3594 from wanyaoqi/feature/wyq/arm-virtualization

host arm support
This commit is contained in:
yunion-ci-robot
2019-11-18 14:09:23 +08:00
committed by GitHub
12 changed files with 425 additions and 45 deletions
+10 -6
View File
@@ -105,13 +105,13 @@ func ParseCPUInfo(lines []string) (*types.SCPUInfo, error) {
}
}
if len(model) == 0 {
return nil, fmt.Errorf("Not found model name")
log.Errorf("Failed to get cpu model")
}
if len(freq) == 0 {
return nil, fmt.Errorf("Not found cpu MHz")
log.Errorf("Failed to get cpu MHz")
}
if len(cache) == 0 {
return nil, fmt.Errorf("Not found cache size")
log.Errorf("Failed to get cpu cache size")
}
model = strings.TrimSpace(model)
info := &types.SCPUInfo{
@@ -119,9 +119,13 @@ func ParseCPUInfo(lines []string) (*types.SCPUInfo, error) {
Model: model,
Microcode: microcode,
}
info.Cache, _ = strconv.Atoi(cache)
freqF, _ := strconv.ParseFloat(freq, 32)
info.Freq = int(freqF)
if len(cache) > 0 {
info.Cache, _ = strconv.Atoi(cache)
}
if len(freq) > 0 {
freqF, _ := strconv.ParseFloat(freq, 32)
info.Freq = int(freqF)
}
return info, nil
}