Merge pull request #15051 from zexi/automated-cherry-pick-of-#15050-upstream-master

Automated cherry pick of #15050: feat(region): is_baremetal option for storage list
This commit is contained in:
Zexi Li
2022-09-26 15:20:13 +08:00
committed by GitHub
3 changed files with 12 additions and 0 deletions
+3
View File
@@ -236,4 +236,7 @@ type StorageListInput struct {
// filter storages which attached the specified host
HostId string `json:"host_id"`
// filter storages of baremetal host
IsBaremetal *bool `json:"is_baremetal"`
}
+8
View File
@@ -1532,6 +1532,14 @@ func (manager *SStorageManager) ListItemFilter(
q = q.In("id", sq.SubQuery())
}
if query.IsBaremetal != nil {
qf := q.NotEquals
if *query.IsBaremetal {
qf = q.Equals
}
q = qf("storage_type", api.STORAGE_BAREMETAL)
}
return q, err
}
+1
View File
@@ -35,6 +35,7 @@ type StorageListOptions struct {
HostSchedtagId string `help:"filter storage by host schedtag"`
ImageId string `help:"filter storage by image"`
IsBaremetal *bool `help:"Baremetal storage list"`
}
func (opts *StorageListOptions) Params() (jsonutils.JSONObject, error) {