Merge pull request #731 from bpradipt/ppc64_uuid
Handle system UUID retrieval for Power(ppc64) Systems
This commit is contained in:
commit
a6b21f65a2
@ -24,10 +24,11 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
blockDir = "/sys/block"
|
||||
cacheDir = "/sys/devices/system/cpu/cpu"
|
||||
netDir = "/sys/class/net"
|
||||
dmiDir = "/sys/class/dmi"
|
||||
blockDir = "/sys/block"
|
||||
cacheDir = "/sys/devices/system/cpu/cpu"
|
||||
netDir = "/sys/class/net"
|
||||
dmiDir = "/sys/class/dmi"
|
||||
ppcDevTree = "/proc/device-tree"
|
||||
)
|
||||
|
||||
type CacheInfo struct {
|
||||
@ -235,7 +236,15 @@ func (self *realSysFs) GetCacheInfo(id int, name string) (CacheInfo, error) {
|
||||
func (self *realSysFs) GetSystemUUID() (string, error) {
|
||||
id, err := ioutil.ReadFile(path.Join(dmiDir, "id", "product_uuid"))
|
||||
if err != nil {
|
||||
return "", err
|
||||
//If running on baremetal Power then UID is /proc/device-tree/system-id
|
||||
id, err = ioutil.ReadFile(path.Join(ppcDevTree, "system-id"))
|
||||
if err != nil {
|
||||
//If running on a KVM guest on Power then UUID is /proc/device-tree/vm,uuid
|
||||
id, err = ioutil.ReadFile(path.Join(ppcDevTree, "vm,uuid"))
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
}
|
||||
}
|
||||
return strings.TrimSpace(string(id)), nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user