mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-19 02:37:24 +08:00
fix host register info (#7401)
This commit is contained in:
@@ -175,6 +175,11 @@ type HostDetails struct {
|
||||
// isolated device count
|
||||
IsolatedDeviceCount int
|
||||
|
||||
// host init warnning
|
||||
SysWarn string `json:"sys_warn"`
|
||||
// host init error info
|
||||
SysError string `json:"sys_error"`
|
||||
|
||||
// 标签
|
||||
Metadata map[string]string `json:"metadata"`
|
||||
}
|
||||
@@ -240,6 +245,8 @@ type HostRegisterMetadata struct {
|
||||
|
||||
OnKubernetes bool `json:"on_kubernetes"`
|
||||
Hostname string `json:"hostname"`
|
||||
SysError string `json:"sys_error,allowempty"`
|
||||
SysWarn string `json:"sys_warn,allowempty"`
|
||||
}
|
||||
|
||||
type HostAccessAttributes struct {
|
||||
|
||||
@@ -997,10 +997,13 @@ func (h *SHostInfo) updateHostMetadata(hostname string) error {
|
||||
OnKubernetes: onK8s,
|
||||
Hostname: hostname,
|
||||
}
|
||||
if len(h.SysError) > 0 {
|
||||
meta.SysError = jsonutils.Marshal(h.SysError).String()
|
||||
}
|
||||
if len(h.SysWarning) > 0 {
|
||||
meta.SysWarn = jsonutils.Marshal(h.SysWarning).String()
|
||||
}
|
||||
data := meta.JSON(meta)
|
||||
data.Set("__sys_error", jsonutils.Marshal(h.SysError))
|
||||
data.Set("__sys_warning", jsonutils.Marshal(h.SysWarning))
|
||||
|
||||
_, err := modules.Hosts.SetMetadata(h.GetSession(), h.HostId, data)
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user