mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix(region): add host_id options for storage filter
This commit is contained in:
@@ -222,4 +222,7 @@ type StorageListInput struct {
|
||||
|
||||
// filter by cachedimage
|
||||
ImageId string `json:"image_id"`
|
||||
|
||||
// filter storages which attached the specified host
|
||||
HostId string `json:"host_id"`
|
||||
}
|
||||
|
||||
@@ -1476,6 +1476,11 @@ func (manager *SStorageManager) ListItemFilter(
|
||||
q = q.In("id", subq.SubQuery())
|
||||
}
|
||||
|
||||
if len(query.HostId) > 0 {
|
||||
sq := HoststorageManager.Query("storage_id").Equals("host_id", query.HostId)
|
||||
q = q.In("id", sq.SubQuery())
|
||||
}
|
||||
|
||||
return q, err
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ type StorageListOptions struct {
|
||||
Zone string `help:"List storages in zone" json:"-"`
|
||||
Region string `help:"List storages in region"`
|
||||
Schedtag string `help:"filter storage by schedtag"`
|
||||
HostId string `help:"filter storages which attached the specified host"`
|
||||
|
||||
HostSchedtagId string `help:"filter storage by host schedtag"`
|
||||
ImageId string `help:"filter storage by image"`
|
||||
|
||||
Reference in New Issue
Block a user