Merge pull request #822 from ioito/hotfix/qx-openstack-host-info

OpenStack: 增加同步数据准确性
This commit is contained in:
yunion-ci-robot
2019-05-15 22:45:35 +08:00
committed by GitHub
+12
View File
@@ -302,6 +302,18 @@ func (host *SHost) GetCpuCount() int8 {
}
func (host *SHost) GetNodeCount() int8 {
if len(host.CpuInfo) > 0 {
info, err := jsonutils.Parse([]byte(host.CpuInfo))
if err == nil {
cpuInfo := &CpuInfo{}
err = info.Unmarshal(cpuInfo)
if err == nil {
if cell, ok := cpuInfo.Topology["cells"]; ok {
return int8(cell)
}
}
}
}
return host.GetCpuCount()
}