Skip to content

Commit

Permalink
Merge pull request #173 from sulakshm/ln/fastpath
Browse files Browse the repository at this point in the history
pxc: extend for fastpath info
  • Loading branch information
lpabon authored Nov 10, 2020
2 parents 26d651e + 607cdb0 commit 107b1d2
Show file tree
Hide file tree
Showing 3 changed files with 20,908 additions and 12,564 deletions.
47 changes: 47 additions & 0 deletions handler/volume/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ func (p *VolumeDescribeFormatter) AddVolumeDetails(
if err != nil {
return err
}
err = p.addFastpathInfo(v, t)
if err != nil {
return err
}
err = p.addVolumeStatsInfo(v, t)
if err != nil {
return err
Expand Down Expand Up @@ -313,6 +317,49 @@ func (p *VolumeDescribeFormatter) addVolumeBasicInfo(
if len(v.GetLocator().GetVolumeLabels()) != 0 {
util.AddMap(t, "Labels:", v.GetLocator().GetVolumeLabels())
}

return nil
}

func (p *VolumeDescribeFormatter) addFastpathInfo(
v *api.Volume,
t *tabby.Tabby,
) error {
spec := v.GetSpec()
fpConfig := v.GetFpConfig()

// Extend for reporting fastpath info
t.AddLine("Fastpath:")
t.AddLine(" Preference:", spec.GetFpPreference())
if spec.GetFpPreference() && fpConfig != nil {
t.AddLine(" Promoted:", fpConfig.GetPromote())
t.AddLine(" Dirty:", fpConfig.GetDirty())
t.AddLine(" State:", fpConfig.GetStatus())
t.AddLine(" Coordinator:", fpConfig.GetCoordUuid())
t.AddLine(" Replicas:", len(fpConfig.GetReplicas()))
for i, r := range fpConfig.GetReplicas() {
t.AddLine(" Replica:", i)
t.AddLine(" On Node:", r.GetNodeUuid())
t.AddLine(" Protocol:", r.GetProtocol())
t.AddLine(" Secure:", r.GetAcl())
t.AddLine(" Exported:", r.GetExported())
if r.GetExported() {
t.AddLine(" Target:", r.GetTarget())
t.AddLine(" Source:", r.GetExportedDevice())
if r.GetBlock() {
t.AddLine(" Type: BlockDevice")
} else {
t.AddLine(" Type: File")
}
}

t.AddLine(" Imported:", r.GetImported())
if r.Imported {
t.AddLine(" Mapped local device:", r.GetDevpath())
}
}
}

return nil
}

Expand Down
Loading

0 comments on commit 107b1d2

Please sign in to comment.