mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
Merge pull request #5127 from ioito/automated-cherry-pick-of-#5126-upstream-release-3.1
Automated cherry pick of #5126: fix: 添加host标签返回值
This commit is contained in:
@@ -120,4 +120,7 @@ type HostDetails struct {
|
||||
IsPrepaidRecycle bool `json:"is_prepaid_recycle"`
|
||||
CanPrepare bool `json:"can_prepare"`
|
||||
PrepareFailReason string `json:"prepare_fail_reason"`
|
||||
|
||||
// 标签
|
||||
Metadata map[string]string `json:"metadata"`
|
||||
}
|
||||
|
||||
@@ -2434,6 +2434,10 @@ func (self *SHost) getMoreDetails(ctx context.Context, out api.HostDetails) api.
|
||||
return out
|
||||
}
|
||||
|
||||
func (self *SHost) GetMetadataHideKeys() []string {
|
||||
return []string{}
|
||||
}
|
||||
|
||||
func (self *SHost) GetExtraDetails(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, isList bool) (api.HostDetails, error) {
|
||||
var err error
|
||||
out := api.HostDetails{}
|
||||
@@ -2441,6 +2445,10 @@ func (self *SHost) GetExtraDetails(ctx context.Context, userCred mcclient.TokenC
|
||||
if err != nil {
|
||||
return out, err
|
||||
}
|
||||
out.Metadata, err = db.GetVisiableMetadata(self, nil)
|
||||
if err != nil {
|
||||
return out, err
|
||||
}
|
||||
return self.getMoreDetails(ctx, out), nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user