mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-19 10:46:58 +08:00
fix(region): add guest billing type for disk (#22934)
This commit is contained in:
@@ -213,6 +213,8 @@ type SimpleGuest struct {
|
||||
Iops int `json:"iops"`
|
||||
// 磁盘吞吐
|
||||
Bps int `json:"bps"`
|
||||
// 计费类型
|
||||
BillingType string `json:"billing_type"`
|
||||
}
|
||||
|
||||
type SimpleSnapshotPolicy struct {
|
||||
@@ -237,6 +239,8 @@ type DiskDetails struct {
|
||||
GuestCount int `json:"guest_count"`
|
||||
// 所挂载虚拟机状态
|
||||
GuestStatus string `json:"guest_status"`
|
||||
// 所挂载虚拟机计费类型
|
||||
GuestBillingType string `json:"guest_billing_type"`
|
||||
|
||||
// 自动清理时间
|
||||
AutoDeleteAt time.Time `json:"auto_delete_at"`
|
||||
|
||||
+16
-11
@@ -2507,6 +2507,7 @@ func (manager *SDiskManager) FetchCustomizeColumns(
|
||||
guestSQ.Field("id"),
|
||||
guestSQ.Field("name"),
|
||||
guestSQ.Field("status"),
|
||||
guestSQ.Field("billing_type"),
|
||||
gds.Field("disk_id"),
|
||||
gds.Field("index"),
|
||||
gds.Field("driver"),
|
||||
@@ -2523,11 +2524,12 @@ func (manager *SDiskManager) FetchCustomizeColumns(
|
||||
Status string
|
||||
DiskId string
|
||||
|
||||
Index int
|
||||
Driver string
|
||||
CacheMode string
|
||||
Iops int
|
||||
Bps int
|
||||
Index int
|
||||
Driver string
|
||||
CacheMode string
|
||||
Iops int
|
||||
Bps int
|
||||
BillingType string
|
||||
}{}
|
||||
err := q.All(&guestInfo)
|
||||
if err != nil {
|
||||
@@ -2546,11 +2548,12 @@ func (manager *SDiskManager) FetchCustomizeColumns(
|
||||
Name: guest.Name,
|
||||
Status: guest.Status,
|
||||
|
||||
Index: guest.Index,
|
||||
Driver: guest.Driver,
|
||||
CacheMode: guest.CacheMode,
|
||||
Iops: guest.Iops,
|
||||
Bps: guest.Bps,
|
||||
Index: guest.Index,
|
||||
Driver: guest.Driver,
|
||||
CacheMode: guest.CacheMode,
|
||||
Iops: guest.Iops,
|
||||
Bps: guest.Bps,
|
||||
BillingType: guest.BillingType,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -2596,17 +2599,19 @@ func (manager *SDiskManager) FetchCustomizeColumns(
|
||||
|
||||
for i := range rows {
|
||||
rows[i].Guests, _ = guests[diskIds[i]]
|
||||
names, status := []string{}, []string{}
|
||||
names, status, billingTypes := []string{}, []string{}, []string{}
|
||||
var iops, bps int
|
||||
for _, guest := range rows[i].Guests {
|
||||
names = append(names, guest.Name)
|
||||
status = append(status, guest.Status)
|
||||
iops = guest.Iops
|
||||
bps = guest.Bps
|
||||
billingTypes = append(billingTypes, guest.BillingType)
|
||||
}
|
||||
rows[i].GuestCount = len(rows[i].Guests)
|
||||
rows[i].Guest = strings.Join(names, ",")
|
||||
rows[i].GuestStatus = strings.Join(status, ",")
|
||||
rows[i].GuestBillingType = strings.Join(billingTypes, ",")
|
||||
|
||||
rows[i].Snapshotpolicies, _ = policies[diskIds[i]]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user