To be able to build both PV and HVM images, it is not possible to use both /dev/sd[f-p] and [1-16] as the HVM images get attached at /dev/sdf but must be mounted a /dev/sdf1.

This reduces the number of simultaneous packer runs possible significantly, but unless you are Netflix, who have Aminator anyway, this is probably never going to be an issue
This commit is contained in:
Peter Sankauskas 2014-07-29 16:07:49 -07:00
parent 19d0961a41
commit a59ee93bca
1 changed files with 6 additions and 5 deletions

View File

@ -27,13 +27,14 @@ func AvailableDevice() (string, error) {
continue
}
for i := 1; i < 16; i++ {
device := fmt.Sprintf("/dev/%s%c%d", prefix, letter, i)
if _, err := os.Stat(device); err != nil {
// To be able to build both Paravirtual and HVM images, the unnumbered
// device and the first numbered one must be available.
// E.g. /dev/xvdf and /dev/xvdf1
numbered_device := fmt.Sprintf("%s%d", device, 1)
if _, err := os.Stat(numbered_device); err != nil {
return device, nil
}
}
}
return "", errors.New("available device could not be found")
}