From 887161d42806cc3eac3faa31d24208042887d693 Mon Sep 17 00:00:00 2001 From: ioito Date: Mon, 24 Jul 2023 16:18:20 +0800 Subject: [PATCH] fix(region): set scheduler failed brand unknown --- pkg/compute/models/disks.go | 5 +++++ pkg/compute/models/guest_queries.go | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/pkg/compute/models/disks.go b/pkg/compute/models/disks.go index c98700d9b42..53c41543318 100644 --- a/pkg/compute/models/disks.go +++ b/pkg/compute/models/disks.go @@ -2452,6 +2452,11 @@ func (manager *SDiskManager) FetchCustomizeColumns( snps, _ := snapshots[diskIds[i]] rows[i].ManualSnapshotCount = len(snps) } + disk := objs[i].(*SDisk) + if len(disk.StorageId) == 0 && disk.Status == api.VM_SCHEDULE_FAILED { + rows[i].Brand = "Unknown" + rows[i].Provider = "Unknown" + } } return rows diff --git a/pkg/compute/models/guest_queries.go b/pkg/compute/models/guest_queries.go index 9ba1515c999..eec3d0944b0 100644 --- a/pkg/compute/models/guest_queries.go +++ b/pkg/compute/models/guest_queries.go @@ -241,7 +241,11 @@ func (manager *SGuestManager) FetchCustomizeColumns( } for i := range rows { - rows[i] = objs[i].(*SGuest).moreExtraInfo(ctx, rows[i], userCred, query, fields, isList) + rows[i] = guests[i].moreExtraInfo(ctx, rows[i], userCred, query, fields, isList) + if len(guests[i].HostId) == 0 && guests[i].Status == api.VM_SCHEDULE_FAILED { + rows[i].Brand = "Unknown" + rows[i].Provider = "Unknown" + } } return rows