diff options
author | minl1 <min.li1@citrix.com> | 2017-03-29 15:19:27 +0800 |
---|---|---|
committer | minl1 <min.li1@citrix.com> | 2017-03-30 11:29:02 +0800 |
commit | 7fcbf4caa0d5644ab514b28b61559bf63df8ddcb (patch) | |
tree | 63886670c6084157b8e0667e4b4d5dd0abec84a3 /guestmetric | |
parent | 3a916607ce22059887c307f39345e6f643364f0b (diff) | |
download | vyos-xe-guest-utilities-7fcbf4caa0d5644ab514b28b61559bf63df8ddcb.tar.gz vyos-xe-guest-utilities-7fcbf4caa0d5644ab514b28b61559bf63df8ddcb.zip |
CA-247330:XSO-676 log spams of 'CollectDisk error'with Linux guest agent
Diffstat (limited to 'guestmetric')
-rw-r--r-- | guestmetric/guestmetric_linux.go | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/guestmetric/guestmetric_linux.go b/guestmetric/guestmetric_linux.go index b4553b2..6c656ea 100644 --- a/guestmetric/guestmetric_linux.go +++ b/guestmetric/guestmetric_linux.go @@ -201,16 +201,15 @@ func (c *Collector) CollectDisk() (GuestMetric, error) { real_dev := "" if c.Client != nil { nodename, err := readSysfs(fmt.Sprintf("/sys/block/%s/device/nodename", disk)) - if err != nil { - return nil, err - } - backend, err := c.Client.Read(fmt.Sprintf("%s/backend", nodename)) - if err != nil { - return nil, err - } - real_dev, err = c.Client.Read(fmt.Sprintf("%s/dev", backend)) - if err != nil { - return nil, err + if err == nil { + backend, err := c.Client.Read(fmt.Sprintf("%s/backend", nodename)) + if err != nil { + return nil, err + } + real_dev, err = c.Client.Read(fmt.Sprintf("%s/dev", backend)) + if err != nil { + return nil, err + } } } name := path |