Skip to content

Commit

Permalink
Merge pull request #30 from utkarshmani1997/jiva-#886-uptime
Browse files Browse the repository at this point in the history
Add uptime and volume name in stats struct
  • Loading branch information
payes authored Nov 14, 2017
2 parents 1b59911 + 1d61a1e commit d782173
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
10 changes: 6 additions & 4 deletions controller/rest/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,12 @@ type VolumeStats struct {
TotalWriteTime string `json:"TotalWriteTime"`
TotalWriteBlockCount string `json:"TotatWriteBlockCount"`

UsedLogicalBlocks string `json:"UsedLogicalBlocks"`
UsedBlocks string `json:"UsedBlocks"`
SectorSize string `json:"SectorSize"`
Size string `json:"Size"`
UsedLogicalBlocks string `json:"UsedLogicalBlocks"`
UsedBlocks string `json:"UsedBlocks"`
SectorSize string `json:"SectorSize"`
Size string `json:"Size"`
UpTime float64 `json:"UpTime"`
Name string `json:"Name"`
}

type SnapshotInput struct {
Expand Down
3 changes: 3 additions & 0 deletions controller/rest/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package rest
import (
"net/http"
"strconv"
"time"

"github.com/gorilla/mux"
"github.com/rancher/go-rancher/api"
Expand Down Expand Up @@ -54,6 +55,8 @@ func (s *Server) GetVolumeStats(rw http.ResponseWriter, req *http.Request) error
UsedBlocks: strconv.FormatInt(stats.UsedBlocks, 10),
SectorSize: strconv.FormatInt(stats.SectorSize, 10),
Size: strconv.FormatInt(s.c.GetSize(), 10),
UpTime: time.Since(s.c.StartTime).Seconds(),
Name: s.c.Name,
}
apiContext.Write(volumeStats)
return nil
Expand Down

0 comments on commit d782173

Please sign in to comment.