Open bcorijn opened 6 years ago
Do you know if there's a recommended way to detect if the instance is using NVMe backed instances? I've been using the following patch successfully on c5 instances for some time, but it feels quite kludgy. Listing instance types would be far from optimal also as new instance types would need to be added quite often.
diff --git a/bootstrapvz/providers/ec2/ebsvolume.py b/bootstrapvz/providers/ec2/ebsvolume.py
index a3aa8d8..51cfa01 100644
--- a/bootstrapvz/providers/ec2/ebsvolume.py
+++ b/bootstrapvz/providers/ec2/ebsvolume.py
@@ -27,12 +27,24 @@ class EBSVolume(Volume):
import string
self.instance_id = e.instance_id
- for letter in string.ascii_lowercase[5:]:
- dev_path = os.path.join('/dev', 'xvd' + letter)
- if not os.path.exists(dev_path):
- self.device_path = dev_path
- self.ec2_device_path = os.path.join('/dev', 'sd' + letter)
- break
+ if os.path.exists('/dev/xvda'):
+ for letter in string.ascii_lowercase[5:]:
+ dev_path = os.path.join('/dev', 'xvd' + letter)
+
+ if not os.path.exists(dev_path):
+ self.device_path = dev_path
+ self.ec2_device_path = os.path.join('/dev', 'sd' + letter)
+ break
+
+ if os.path.exists('/dev/nvme0'):
+ for index in range(1,20):
+ dev_path = os.path.join('/dev', "nvme%dn1" % index)
+
+ if not os.path.exists(dev_path):
+ letter = string.ascii_lowercase[4:][index]
+ self.device_path = dev_path
+ self.ec2_device_path = os.path.join('/dev', 'sd' + letter)
+ break
I just tried building an image using a new M5 instance, which failed during a partitioning step. I see bootstrap-vz expects disks to be in the
/dev/xvd + letter
or /dev/sd + letter` format, while the newest AWS generations have moved to NVMe: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/nvme-ebs-volumes.htmlSome extra information on the error: