mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
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:
@@ -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"`
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user