From a59ee93bcac73f58eabe77aebbe3b21e80da967c Mon Sep 17 00:00:00 2001 From: Peter Sankauskas Date: Tue, 29 Jul 2014 16:07:49 -0700 Subject: [PATCH] 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 --- builder/amazon/chroot/device.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/builder/amazon/chroot/device.go b/builder/amazon/chroot/device.go index 77b7b444a..a0c0b9dc8 100644 --- a/builder/amazon/chroot/device.go +++ b/builder/amazon/chroot/device.go @@ -27,11 +27,12 @@ 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 { - return device, 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 } }