diff --git a/cmd/format.go b/cmd/format.go index 948a9189c4b3..0a7a9d1e14f3 100644 --- a/cmd/format.go +++ b/cmd/format.go @@ -343,9 +343,9 @@ func format(c *cli.Context) error { for _, flag := range c.LocalFlagNames() { switch flag { case "capacity": - format.Capacity = c.Uint64(flag) + format.Capacity = c.Uint64(flag) << 30 case "inodes": - format.Capacity = c.Uint64(flag) + format.Inodes = c.Uint64(flag) case "bucket": format.Bucket = c.String(flag) case "access-key": diff --git a/cmd/format_test.go b/cmd/format_test.go index 22eed3d13306..5c47d5aa4370 100644 --- a/cmd/format_test.go +++ b/cmd/format_test.go @@ -72,4 +72,17 @@ func TestFormat(t *testing.T) { if f.Name != testVolume { t.Fatalf("volume name %s != expected %s", f.Name, testVolume) } + + if err = Main([]string{"", "format", testMeta, testVolume, "--capacity", "1", "--inodes", "1000"}); err != nil { + t.Fatalf("format error: %s", err) + } + if body, err = rdb.Get(context.Background(), "setting").Bytes(); err != nil { + t.Fatalf("get setting: %s", err) + } + if err = json.Unmarshal(body, &f); err != nil { + t.Fatalf("json unmarshal: %s", err) + } + if f.Capacity != 1<<30 || f.Inodes != 1000 { + t.Fatalf("unexpected volume: %+v", f) + } }