Skip to content

Commit

Permalink
fix(region): add disk preallocation for guest info
Browse files Browse the repository at this point in the history
  • Loading branch information
ioito committed Dec 21, 2023
1 parent c6401d7 commit 45d5ed5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 18 deletions.
37 changes: 19 additions & 18 deletions pkg/apis/compute/guests.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,24 +345,25 @@ func (self ServerDetails) GetMetricPairs() map[string]string {

// GuestDiskInfo describe the information of disk on the guest.
type GuestDiskInfo struct {
Id string `json:"id"`
Name string `json:"name"`
FsFormat string `json:"fs,omitempty"`
DiskType string `json:"disk_type"`
Index int8 `json:"index"`
BootIndex int8 `json:"boot_index"`
SizeMb int `json:"size"`
DiskFormat string `json:"disk_format"`
Driver string `json:"driver"`
CacheMode string `json:"cache_mode"`
AioMode string `json:"aio_mode"`
MediumType string `json:"medium_type"`
StorageType string `json:"storage_type"`
Iops int `json:"iops"`
Bps int `json:"bps"`
ImageId string `json:"image_id,omitempty"`
Image string `json:"image,omitemtpy"`
StorageId string `json:"storage_id"`
Id string `json:"id"`
Name string `json:"name"`
FsFormat string `json:"fs,omitempty"`
DiskType string `json:"disk_type"`
Index int8 `json:"index"`
BootIndex int8 `json:"boot_index"`
SizeMb int `json:"size"`
DiskFormat string `json:"disk_format"`
Driver string `json:"driver"`
CacheMode string `json:"cache_mode"`
AioMode string `json:"aio_mode"`
MediumType string `json:"medium_type"`
StorageType string `json:"storage_type"`
Iops int `json:"iops"`
Bps int `json:"bps"`
ImageId string `json:"image_id,omitempty"`
Image string `json:"image,omitemtpy"`
StorageId string `json:"storage_id"`
Preallocation string `json:"preallocation"`
}

func (self GuestDiskInfo) ShortDesc() string {
Expand Down
1 change: 1 addition & 0 deletions pkg/compute/models/guest_queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ func fetchGuestDisksInfo(guestIds []string) map[string][]api.GuestDiskInfo {
guestdisks.Field("guest_id"),
guestdisks.Field("boot_index"),
disks.Field("storage_id"),
disks.Field("preallocation"),
)
q = q.Join(guestdisks, sqlchemy.Equals(guestdisks.Field("disk_id"), disks.Field("id")))
q = q.Join(storages, sqlchemy.Equals(disks.Field("storage_id"), storages.Field("id")))
Expand Down

0 comments on commit 45d5ed5

Please sign in to comment.