mirror of
https://github.com/minio/minio.git
synced 2025-11-09 13:39:46 -05:00
Add dry-run query param for HealFormat API (#3618)
This commit is contained in:
committed by
Harshavardhana
parent
fc880f9b23
commit
0e693e0284
@@ -251,13 +251,20 @@ __Example__
|
||||
```
|
||||
|
||||
<a name="HealFormat"></a>
|
||||
### HealFormat() error
|
||||
### HealFormat(isDryRun bool) error
|
||||
Heal storage format on available disks. This is used when disks were replaced or were found with missing format. This is supported only for erasure-coded backend.
|
||||
|
||||
__Example__
|
||||
|
||||
``` go
|
||||
err := madmClnt.HealFormat()
|
||||
isDryRun := true
|
||||
err := madmClnt.HealFormat(isDryRun)
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
|
||||
isDryRun = false
|
||||
err = madmClnt.HealFormat(isDryRun)
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
|
||||
@@ -39,8 +39,16 @@ func main() {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
|
||||
// Heal storage format on available disks.
|
||||
err = madmClnt.HealFormat()
|
||||
// Attempt healing format in dry-run mode.
|
||||
isDryRun := true
|
||||
err = madmClnt.HealFormat(isDryRun)
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
|
||||
// Perform actual healing of format.
|
||||
isDryRun = false
|
||||
err = madmClnt.HealFormat(isDryRun)
|
||||
if err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
|
||||
@@ -344,7 +344,7 @@ func (adm *AdminClient) HealBucket(bucket string, dryrun bool) error {
|
||||
queryVal.Set("heal", "")
|
||||
queryVal.Set(string(healBucket), bucket)
|
||||
if dryrun {
|
||||
queryVal.Set(string(healDryRun), "yes")
|
||||
queryVal.Set(string(healDryRun), "")
|
||||
}
|
||||
|
||||
hdrs := make(http.Header)
|
||||
@@ -378,7 +378,7 @@ func (adm *AdminClient) HealObject(bucket, object string, dryrun bool) error {
|
||||
queryVal.Set(string(healBucket), bucket)
|
||||
queryVal.Set(string(healObject), object)
|
||||
if dryrun {
|
||||
queryVal.Set(string(healDryRun), "yes")
|
||||
queryVal.Set(string(healDryRun), "")
|
||||
}
|
||||
|
||||
hdrs := make(http.Header)
|
||||
@@ -405,9 +405,12 @@ func (adm *AdminClient) HealObject(bucket, object string, dryrun bool) error {
|
||||
}
|
||||
|
||||
// HealFormat - heal storage format on available disks.
|
||||
func (adm *AdminClient) HealFormat() error {
|
||||
func (adm *AdminClient) HealFormat(dryrun bool) error {
|
||||
queryVal := url.Values{}
|
||||
queryVal.Set("heal", "")
|
||||
if dryrun {
|
||||
queryVal.Set(string(healDryRun), "")
|
||||
}
|
||||
|
||||
// Set x-minio-operation to format.
|
||||
hdrs := make(http.Header)
|
||||
|
||||
Reference in New Issue
Block a user