add: add brand field for server-sku-list

This commit is contained in:
ioito
2019-07-31 18:06:44 +08:00
parent ab5bd948d5
commit 6c52832361
2 changed files with 24 additions and 0 deletions
+8
View File
@@ -87,6 +87,14 @@ ServerSku:
type: string
example: local
description: 系统盘类型
provider:
type: string
example: OpenStack
description: 套餐平台
brand:
type: string
example: OpenStack
description: 品牌信息,用来区分私有云品牌信息
ServerSkuListResponse:
+16
View File
@@ -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
}