Adding logic to RAID creation and volume attachments to ensure mdadm properly allocates the device number. If a block device triggers a mdadm scan, for instance during a EBS snapshot attachment, without having a proper mdadm.conf, a random device number is chosen (md127) and the assembly will fail. To ensure this doesn't happen we're queueing udev events, letting the RAID create or the existing snapshot volumes attach, then querying mdadm for its UUID and device number and tee'ing it to mdadm.conf. Once the RAID is in tact by means of creation or assembly, we're safe to start the udev message queue and finally we update initramfs to be sure the configuration perists reboots.
Fixing the md_device grep so it finds devices on ubuntu 12.04