mitchellh/packer — pull request #1381 by pas256 (2014-07-30 05:28:37+00:00)
Title: Enable amazon-chroot to build both PV and HVM images

As discussed in Issue #1311, the `amazon-chroot` builder accepted the virtualization type config (since it was part of the common config) but did nothing with it. This PR fixes #1311.

Build HVM images is a little more involved than just adding that flag to the register AMI API call.

To be able to build both PV and HVM images, it is not possible to use both `/dev/sd[f-p][1-16]` as possible mount devices. The mount command a PV image that is attached to `/dev/sdf` is:

mount /dev/xvdf /mnt/point

while for an HVM image that is attached to `/dev/sdf`, its mount command is

mount /dev/xvdf1 /mnt/point

Notice the "1".

I have modified the code to allow for building both PV and HVM images, but at the expense of limiting the number of concurrent AMIs to 11 ("f" to "p"). Unless you are Netflix, who have Aminator anyway, I doubt this will impact anyone, but it is worth noting.

For this to work, Issue #1360 also needs to be merged.

I'm still learning Go and would appreciate a code review.