fix(region): add host_id options for storage filter

This commit is contained in:
Qu Xuan
2021-05-20 14:39:42 +08:00
parent 00c58b79e5
commit 2fb095bc5b
3 changed files with 9 additions and 0 deletions
+3
View File
@@ -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"`
}
+5
View File
@@ -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
}
+1
View File
@@ -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"`