mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
Merge pull request #822 from ioito/hotfix/qx-openstack-host-info
OpenStack: 增加同步数据准确性
This commit is contained in:
@@ -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()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user