1
0
mirror of https://github.com/gluster/glusterd2.git synced 2026-02-05 12:45:38 +01:00

disperse data count and redundancy count added to API response

Fixes: #1192
Signed-off-by: Aravinda VK <avishwan@redhat.com>
This commit is contained in:
Aravinda VK
2018-09-26 10:38:38 +05:30
committed by Prashanth Pai
parent 5b2d07b69b
commit 5c11d4e7d8
3 changed files with 39 additions and 27 deletions

View File

@@ -630,9 +630,13 @@ func testDisperse(t *testing.T, tc *testCluster) {
Force: true,
}
_, err := client.VolumeCreate(createReq)
volinfo, err := client.VolumeCreate(createReq)
r.Nil(err)
r.Equal(3, volinfo.DisperseCount)
r.Equal(2, volinfo.DisperseDataCount)
r.Equal(1, volinfo.DisperseRedundancyCount)
r.Nil(client.VolumeStart(disperseVolName, true), "disperse volume start failed")
}

View File

@@ -182,12 +182,14 @@ func CreateSubvolInfo(sv *[]Subvol) []api.Subvol {
}
subvols = append(subvols, api.Subvol{
Name: subvol.Name,
Type: api.SubvolType(subvol.Type),
Bricks: blist,
ReplicaCount: subvol.ReplicaCount,
ArbiterCount: subvol.ArbiterCount,
DisperseCount: subvol.DisperseCount,
Name: subvol.Name,
Type: api.SubvolType(subvol.Type),
Bricks: blist,
ReplicaCount: subvol.ReplicaCount,
ArbiterCount: subvol.ArbiterCount,
DisperseCount: subvol.DisperseCount,
DisperseDataCount: subvol.DisperseCount - subvol.RedundancyCount,
DisperseRedundancyCount: subvol.RedundancyCount,
})
}
return subvols
@@ -215,6 +217,8 @@ func CreateVolumeInfoResp(v *Volinfo) *api.VolumeInfo {
resp.ReplicaCount = resp.Subvols[0].ReplicaCount
resp.ArbiterCount = resp.Subvols[0].ArbiterCount
resp.DisperseCount = resp.Subvols[0].DisperseCount
resp.DisperseDataCount = resp.Subvols[0].DisperseDataCount
resp.DisperseRedundancyCount = resp.Subvols[0].DisperseRedundancyCount
return resp
}

View File

@@ -16,13 +16,15 @@ type BrickInfo struct {
// Subvol contains static information about sub volume
type Subvol struct {
Name string `json:"name"`
Type SubvolType `json:"type"`
Bricks []BrickInfo `json:"bricks"`
Subvols []Subvol `json:"subvols,omitempty"`
ReplicaCount int `json:"replica-count"`
ArbiterCount int `json:"arbiter-count"`
DisperseCount int `json:"disperse-count"`
Name string `json:"name"`
Type SubvolType `json:"type"`
Bricks []BrickInfo `json:"bricks"`
Subvols []Subvol `json:"subvols,omitempty"`
ReplicaCount int `json:"replica-count"`
ArbiterCount int `json:"arbiter-count"`
DisperseCount int `json:"disperse-count"`
DisperseDataCount int `json:"disperse-data-count,omitempty"`
DisperseRedundancyCount int `json:"disperse-redundancy-count,omitempty"`
}
// SizeInfo represents sizing information.
@@ -53,19 +55,21 @@ type BricksStatusResp []BrickStatus
// VolumeInfo contains static information about the volume.
// Clients should NOT use this struct directly.
type VolumeInfo struct {
ID uuid.UUID `json:"id"`
Name string `json:"name"`
Type VolType `json:"type"`
Transport string `json:"transport"`
DistCount int `json:"distribute-count"`
ReplicaCount int `json:"replica-count"`
ArbiterCount int `json:"arbiter-count,omitempty"`
DisperseCount int `json:"disperse-count,omitempty"`
Options map[string]string `json:"options"`
State VolState `json:"state"`
Subvols []Subvol `json:"subvols"`
Metadata map[string]string `json:"metadata"`
SnapList []string `json:"snap-list"`
ID uuid.UUID `json:"id"`
Name string `json:"name"`
Type VolType `json:"type"`
Transport string `json:"transport"`
DistCount int `json:"distribute-count"`
ReplicaCount int `json:"replica-count"`
ArbiterCount int `json:"arbiter-count,omitempty"`
DisperseCount int `json:"disperse-count,omitempty"`
DisperseDataCount int `json:"disperse-data-count,omitempty"`
DisperseRedundancyCount int `json:"disperse-redundancy-count,omitempty"`
Options map[string]string `json:"options"`
State VolState `json:"state"`
Subvols []Subvol `json:"subvols"`
Metadata map[string]string `json:"metadata"`
SnapList []string `json:"snap-list"`
}
// VolumeStatusResp response contains the statuses of all bricks of the volume.