Skip to content

Commit

Permalink
Only use the zbus client if it's set (#1064)
Browse files Browse the repository at this point in the history
  • Loading branch information
Muhamad Azmy authored Nov 18, 2020
1 parent d8cb7e3 commit c9efed8
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions pkg/provision/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -430,18 +430,24 @@ func (e *Engine) updateStats() error {
wl := e.statser.CurrentWorkloads()
r := e.statser.CurrentUnits()

storaged := stubs.NewStorageModuleStub(e.zbusCl)
if e.zbusCl != nil {
// TODO: this is a very specific zos code that should not be
// here. this is a quick fix for the tfgateways
// but should be implemented cleanely after
storaged := stubs.NewStorageModuleStub(e.zbusCl)

cache, err := storaged.GetCacheFS()
if err != nil {
return err
}
cache, err := storaged.GetCacheFS()
if err != nil {
return err
}

switch cache.DiskType {
case pkg.SSDDevice:
r.Sru += float64(cache.Usage.Size / gib)
case pkg.HDDDevice:
r.Hru += float64(cache.Usage.Size / gib)
}

switch cache.DiskType {
case pkg.SSDDevice:
r.Sru += float64(cache.Usage.Size / gib)
case pkg.HDDDevice:
r.Hru += float64(cache.Usage.Size / gib)
}

log.Info().
Expand Down

0 comments on commit c9efed8

Please sign in to comment.