diskimage-builder/elements/hwdiscovery
Victor Lowther dbacf3e8df Make pxe_mac accurate in two common cases.
If we are booting pxe booting using syslinux, and it has IPAPPEND 2 in
the boot stanza, then it will append the mac address of the device we
are booting from to the kernel parameters where we can get at it
pretty easily.

If we are booting physical hardware via UEFI over the network, we can
rely on the BootCurrent EFI variable to point at the boot entry for
the NIC we booted from, which will include the MAC address of that
nic.

If neither of those cases are in play, we can just fall back to the
all-physical-devices-with-links code.

This currently uses the Bash 4 support for associative arrays to handle
the netboot-in-UEFI case, if needed I can rewrite it to be Bash 3 compatible.

Change-Id: I5e50e30c60d6d732a09ab61251cbb9be08bb6113
2013-11-17 21:43:59 -06:00
..
binary-deps.d Build ramdisks in an image chroot. 2013-07-12 11:09:35 +01:00
init.d Make pxe_mac accurate in two common cases. 2013-11-17 21:43:59 -06:00
install.d Set file permission to be executable. 2013-08-20 08:44:43 +00:00
README.md Further fleshing out of hwdiscovery element 2012-12-06 21:55:30 +00:00

A ramdisk to report the hardware of a machine to an inventory service.

This will collect up some basic information about the hardware it boots on:

  • CPU cores
  • RAM
  • Disk
  • NIC mac address

This information will then be collated into a JSON document, base64 encoded and passed, via HTTP POST, to a URL that you must specify on the kernel commandline, thus:

HW_DISCOVERY_URL=http://1.2.3.4:56/hw_script.asp

This is currently fairly fragile as there can be a huge variability in the number of disks/NICs in servers and how they are configured.

If other elements wish to inject data into the hardware discovery data, they can - they should be specified before hwdiscovery to the image building script, and they should contain something like this in their init fragment:

_vendor_hwdiscovery_data="$_vendor_hwdiscovery_data "some vendor key" : "some data you care about", "some other vendor key" : "some other data you care about","

Note that you are essentially feeding JSON into the main hwdiscovery JSON.

This will allow any number of vendor specific hwdiscovery elements to chain together their JSON fragments and maintain consistency.