From f0b9b735c120c6081474630bca7a25d4a884a129 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B1=88=E8=BD=A9?= Date: Mon, 13 Nov 2023 18:15:33 +0800 Subject: [PATCH] fix(region): vm gpu notes (#18651) --- pkg/compute/models/guests.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/compute/models/guests.go b/pkg/compute/models/guests.go index e25b634abf..0e2f6c4887 100644 --- a/pkg/compute/models/guests.go +++ b/pkg/compute/models/guests.go @@ -5184,9 +5184,6 @@ func (self *SGuest) GetSpec(checkStatus bool) *jsonutils.JSONDict { gpuSpecs = append(gpuSpecs, *gs) } } - if gs := self.GetGpuSpec(); gs != nil { - gpuSpecs = append(gpuSpecs, *gs) - } spec.Set("gpu", jsonutils.Marshal(gpuSpecs)) return spec @@ -5283,6 +5280,10 @@ func (self *SGuest) GetShortDesc(ctx context.Context) *jsonutils.JSONDict { if len(self.InstanceType) > 0 { desc.Set("instance_type", jsonutils.NewString(self.InstanceType)) } + if gp := self.GetGpuSpec(); gp != nil { + desc.Set("gpu_model", jsonutils.NewString(gp.Model)) + desc.Set("gpu_count", jsonutils.NewString(gp.Amount)) + } address := jsonutils.NewString(strings.Join(self.GetRealIPs(), ",")) desc.Set("ip_addr", address)