Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SetIsiQuotaHardThreshold issue #40

Open
seasonrun opened this issue Oct 12, 2022 · 0 comments
Open

SetIsiQuotaHardThreshold issue #40

seasonrun opened this issue Oct 12, 2022 · 0 comments

Comments

@seasonrun
Copy link

There are two choices when set quota, the default is "Size of cluster", another is "Size of hard threshold"(in OneFS Version: 8.1.0.2 ), the current function SetIsiQuotaHardThreshold didn't define this parameter, so the "Show available space as" on the vm will display the root path quota. but what we need is "Size of hard threshold". I think we can transfer another parameter to solve this problem like this.

type IsiQuotaReq struct { Container bool json:"container"Enforced bool json:"enforced"IncludeSnapshots bool json:"include_snapshots"Path string json:"path"Thresholds isiThresholdsReqjson:"thresholds"ThresholdsIncludeOverhead bool json:"thresholds_include_overhead"Type string json:"type" }

`func SetIsiQuotaHardThreshold(
ctx context.Context,
client api.Client,
path string, size int64) (err error) {

// PAPI call: POST https://1.2.3.4:8080/platform/1/quota/quotas
//             { "enforced" : true,
//               "include_snapshots" : false,
//               "path" : "/ifs/volumes/volume_name",
//               "thresholds_include_overhead" : false,
//               "type" : "directory",
//               "thresholds" : { "advisory" : null,
//                                "hard" : 1234567890,
//                                "soft" : null
//                              }
//             }
var data = &IsiQuotaReq{
            Container:      true,
	Enforced:         true,
	IncludeSnapshots: false,
	Path:             path,
	ThresholdsIncludeOverhead: false,
	Type:       "directory",
	Thresholds: isiThresholdsReq{Advisory: nil, Hard: size, Soft: nil},
}

var quotaResp IsiQuota
err = client.Post(ctx, quotaPath, "", nil, nil, data, &quotaResp)
return err

}
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant