mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix(region): guestdisk list add auto reset column (#22346)
This commit is contained in:
@@ -261,6 +261,8 @@ type DiskUpdateInput struct {
|
||||
|
||||
// 磁盘类型
|
||||
DiskType string `json:"disk_type"`
|
||||
// 关机自动重置
|
||||
AutoReset *bool `json:"auto_reset"`
|
||||
}
|
||||
|
||||
type DiskSaveInput struct {
|
||||
|
||||
@@ -34,6 +34,8 @@ type GuestDiskDetails struct {
|
||||
// 磁盘类型
|
||||
// example: data
|
||||
DiskType string `json:"disk_type"`
|
||||
// 关机自动重置
|
||||
AutoReset bool `json:"auto_reset"`
|
||||
// 介质类型
|
||||
// example: ssd
|
||||
MediumType string `json:"medium_type"`
|
||||
|
||||
@@ -359,6 +359,7 @@ type GuestDiskInfo struct {
|
||||
Driver string `json:"driver"`
|
||||
CacheMode string `json:"cache_mode"`
|
||||
AioMode string `json:"aio_mode"`
|
||||
AutoReset bool `json:"auto_reset"`
|
||||
MediumType string `json:"medium_type"`
|
||||
StorageType string `json:"storage_type"`
|
||||
Iops int `json:"iops"`
|
||||
|
||||
@@ -432,6 +432,12 @@ func (self *SDisk) ValidateUpdateData(ctx context.Context, userCred mcclient.Tok
|
||||
}
|
||||
}
|
||||
|
||||
if input.AutoReset != nil && *input.AutoReset != self.AutoReset {
|
||||
if guest := self.GetGuest(); guest != nil && guest.Status != api.VM_READY {
|
||||
return input, httperrors.NewBadRequestError("Can't set disk auto_reset on guest status %s", guest.Status)
|
||||
}
|
||||
}
|
||||
|
||||
storage, _ := self.GetStorage()
|
||||
if storage == nil {
|
||||
return input, httperrors.NewNotFoundError("failed to find storage for disk %s", self.Name)
|
||||
|
||||
@@ -379,6 +379,7 @@ func fetchGuestDisksInfo(guestIds []string) map[string][]api.GuestDiskInfo {
|
||||
guestdisks.Field("driver"),
|
||||
guestdisks.Field("cache_mode"),
|
||||
guestdisks.Field("aio_mode"),
|
||||
disks.Field("auto_reset"),
|
||||
storages.Field("medium_type"),
|
||||
storages.Field("storage_type"),
|
||||
guestdisks.Field("iops"),
|
||||
|
||||
@@ -147,6 +147,7 @@ func (manager *SGuestdiskManager) FetchCustomizeColumns(
|
||||
rows[i].Status = disk.Status
|
||||
rows[i].DiskSize = disk.DiskSize
|
||||
rows[i].DiskType = disk.DiskType
|
||||
rows[i].AutoReset = disk.AutoReset
|
||||
storage, _ := disk.GetStorage()
|
||||
if storage != nil {
|
||||
rows[i].StorageType = storage.StorageType
|
||||
|
||||
Reference in New Issue
Block a user