Using sysfs has two advantages over using dmidecode:
1. It's faster; no need to start a process (actually two processes,
sh -c 'dmidecode -s ...' and the dmidecode process itself)
for each value we want to collect.
2. It makes it possible to collect DMI info on hosts without
dmidecode, such as CoreOS hosts.
When present (it's not present e.g. on RHEL 5 hosts),
sysfs is at least as reliable as using dmidecode directly.
However, the UUID is returned incorrectly on some VMWare VMs
(those with hardware version 13) - the byte order is swapped around.
Some such affected VMs show the same wrong UUID in sysfs and some show
the correct UUID in sysfs and the wrong UUID only in dmidecode.
The workaround for hosts showing the wrong uuid (byte order swapped)
is to use an Awk script that parses raw dmidecode output
(script given in the first link above). In this commit,
the use of the awk script is not limited to affected VMWare VMs because
(a) there is no clearcut and easy way to identify affected hosts and
(b) the awk script works on all hosts anyway - it is strictly more reliable
than "dmidecode -s system-uuid".
Also, (c) the awk script even works on hosts that have an older version
of dmidecode that doesn't support the "system-uuid" keyword
The fallback to get the uuid from sysfs is still needed for hosts
that have sysfs but not dmidecode (such as CoreOS).
1. Hosts without dmidecode (which formerly would not have dmi inventory at all)
will now have dmi inventory taken from sysfs. (E.g. coreos hosts)
2. Hosts currently showing the wrong UUID or an error message in place
of a UUID will now show the correct UUID via dmidecode and Awk.
(E.g. VMWare 13 VMs, or RHEL 5 hosts with dmidecode-2.7-1.28.2.el5)
3. Other hosts will start pulling their dmi inventory from sysfs instead
of from "dmidecode -s ...", except UUID which they will pull from
"dmidecode -u -t1 | awk ...". The values will all remain the same.
Performancewise, pulling from sysfs will be strictly faster than
pulling from "dmidecode -s ...", which should offset the negligible
impact from using the awk script for collection of one value (uuid).
(I also cleaned up the comment list of "other values you may want to collect"
since system-uuid has been collected by default since