fix: modify list details for guesttemplate

This commit is contained in:
rainzm
2020-07-24 17:02:08 +08:00
parent d5f8855cc2
commit 34e66ab2e3
2 changed files with 2 additions and 13 deletions
+1 -3
View File
@@ -57,6 +57,7 @@ type GuestTemplateDetails struct {
Secgroups []string `json:"secgroups"`
Zone string `json:"zone"`
ZoneId string `json:"zone_id"`
Brand string `json:"brand"`
ConfigInfo GuestTemplateConfigInfo `json:"config_info"`
@@ -71,9 +72,6 @@ type GuestTemplateListInput struct {
}
type GuestTemplateConfigInfo struct {
Region string `json:"region"`
Zone string `json:"zone"`
Hypervisor string `json:"hypervisor"`
Secgroup string `json:"secgroup"`
Sku GuestTemplateSku `json:"sku"`
Disks []GuestTemplateDisk `json:"disks"`
+1 -10
View File
@@ -345,23 +345,14 @@ func (gt *SGuestTemplate) getMoreDetails(ctx context.Context, userCred mcclient.
return out, err
}
configInfo := computeapis.GuestTemplateConfigInfo{}
if len(input.PreferRegion) != 0 {
region := CloudregionManager.FetchRegionById(input.PreferRegion)
if region != nil {
input.PreferRegion = region.GetName()
}
configInfo.Region = input.PreferRegion
}
if len(input.PreferZone) != 0 {
zone := ZoneManager.FetchZoneById(input.PreferZone)
if zone != nil {
input.PreferZone = zone.GetName()
}
out.ZoneId = zone.GetId()
out.Zone = input.PreferZone
configInfo.Zone = input.PreferZone
}
configInfo.Hypervisor = gt.Hypervisor
out.Brand = Hypervisor2Brand(gt.Hypervisor)
// sku deal