Skip to content

Commit

Permalink
Merge pull request #380 from vmarmol/release
Browse files Browse the repository at this point in the history
Check filesystem before accessing it in UI.
  • Loading branch information
vishh committed Dec 19, 2014
2 parents 37db214 + 6ad13d1 commit 7c5e69f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
6 changes: 4 additions & 2 deletions container/raw/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ func (self *rawContainerHandler) GetSpec() (info.ContainerSpec, error) {
}

func (self *rawContainerHandler) getFsStats(stats *info.ContainerStats) error {

// Get Filesystem information only for the root cgroup.
if self.name == "/" {
filesystems, err := self.fsInfo.GetGlobalFsInfo()
Expand All @@ -210,7 +209,10 @@ func (self *rawContainerHandler) getFsStats(stats *info.ContainerStats) error {
}
for _, fs := range filesystems {
stats.Filesystem = append(stats.Filesystem,
info.FsStats{fs.Device, fs.Capacity, fs.Capacity - fs.Free,
info.FsStats{
fs.Device,
fs.Capacity,
fs.Capacity - fs.Free,
fs.DiskStats.ReadsCompleted,
fs.DiskStats.ReadsMerged,
fs.DiskStats.SectorsRead,
Expand Down
9 changes: 6 additions & 3 deletions pages/static/containers_js.go
Original file line number Diff line number Diff line change
Expand Up @@ -1750,10 +1750,13 @@ function startFileSystemUsage(elementId, machineInfo, stats) {
// A map of device name to DOM elements.
window.cadvisor.fsUsage.elements = {};

var curr = stats.stats[stats.stats.length - 1];
var cur = stats.stats[stats.stats.length - 1];
var el = $("<div>");
for (var i = 0; i < curr.filesystem.length; i++) {
var data = curr.filesystem[i];
if (!cur.filesystem) {
return;
}
for (var i = 0; i < cur.filesystem.length; i++) {
var data = cur.filesystem[i];
el.append($("<div>")
.addClass("row col-sm-12")
.append($("<h4>")
Expand Down

0 comments on commit 7c5e69f

Please sign in to comment.