mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-08-28 19:45:07 +08:00
add: add brand field for server-sku-list
This commit is contained in:
@@ -87,6 +87,14 @@ ServerSku:
|
||||
type: string
|
||||
example: local
|
||||
description: 系统盘类型
|
||||
provider:
|
||||
type: string
|
||||
example: OpenStack
|
||||
description: 套餐平台
|
||||
brand:
|
||||
type: string
|
||||
example: OpenStack
|
||||
description: 品牌信息,用来区分私有云品牌信息
|
||||
|
||||
|
||||
ServerSkuListResponse:
|
||||
|
||||
@@ -297,6 +297,22 @@ func (self *SServerSku) GetCustomizeColumns(ctx context.Context, userCred mcclie
|
||||
log.Debugf("GetCustomizeColumns %s", err)
|
||||
}
|
||||
|
||||
region, err := self.GetRegion()
|
||||
if err != nil {
|
||||
log.Errorf("failed to get region for sku %s(%s)", self.Name, self.Id)
|
||||
return extra
|
||||
}
|
||||
if region.IsManaged() { //私有云
|
||||
account := region.GetCloudaccount()
|
||||
if account == nil {
|
||||
log.Errorf("failed to get account for sku %s(%s)", self.Name, self.Id)
|
||||
return extra
|
||||
}
|
||||
extra.Add(jsonutils.NewString(account.Brand), "brand")
|
||||
} else { //本地IDC或公有云
|
||||
extra.Add(jsonutils.NewString(self.Provider), "brand")
|
||||
}
|
||||
|
||||
return extra
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user