fix: ihost add cpu_architecture interface

This commit is contained in:
QIU Jian
2022-09-23 14:47:18 +08:00
parent 79dfa27ca5
commit cc48804901
3 changed files with 18 additions and 5 deletions
+2
View File
@@ -301,6 +301,8 @@ type ICloudHost interface {
GetCpuDesc() string
GetCpuMhz() int
GetCpuCmtbound() float32
GetCpuArchitecture() string
GetMemSizeMB() int
GetMemCmtbound() float32
GetReservedMemoryMb() int
+7
View File
@@ -1867,6 +1867,10 @@ func (self *SHost) syncWithCloudHost(ctx context.Context, userCred mcclient.Toke
self.MemCmtbound = memCmt
}
if arch := extHost.GetCpuArchitecture(); len(arch) > 0 {
self.CpuArchitecture = arch
}
if reservedMem := extHost.GetReservedMemoryMb(); reservedMem > 0 {
self.MemReserved = reservedMem
}
@@ -2107,6 +2111,9 @@ func (manager *SHostManager) NewFromCloudHost(ctx context.Context, userCred mccl
if memCmt := extHost.GetMemCmtbound(); memCmt > 0 {
host.MemCmtbound = memCmt
}
if arch := extHost.GetCpuArchitecture(); len(arch) > 0 {
host.CpuArchitecture = arch
}
if reservedMem := extHost.GetReservedMemoryMb(); reservedMem > 0 {
host.MemReserved = reservedMem
+9 -5
View File
@@ -19,22 +19,26 @@ type SHostBase struct {
STagBase
}
func (self *SHostBase) GetCpuCmtbound() float32 {
func (host *SHostBase) GetCpuCmtbound() float32 {
return 0.0
}
func (self *SHostBase) GetMemCmtbound() float32 {
func (host *SHostBase) GetMemCmtbound() float32 {
return 0.0
}
func (self *SHostBase) GetReservedMemoryMb() int {
func (host *SHostBase) GetReservedMemoryMb() int {
return 0
}
func (self *SHostBase) GetSchedtags() ([]string, error) {
func (host *SHostBase) GetSchedtags() ([]string, error) {
return nil, nil
}
func (self *SHostBase) GetOvnVersion() string {
func (host *SHostBase) GetOvnVersion() string {
return ""
}
func (host *SHostBase) GetCpuArchitecture() string {
return ""
}