From 91476512738450555ba33fecc6ed1ab998f09738 Mon Sep 17 00:00:00 2001 From: Andreas Rammhold Date: Fri, 18 Sep 2020 14:38:02 +0200 Subject: [PATCH] volumes: treat non-aliased devices as equivalent to aliased ones The AWS API provides us with some non-sensical device names that might have nothing to do with reality. For some reason there is weird renaming going on from the values that boto3 (the AWS API bindings) returns to us to what we actually configure on the machine. Apparently nowadays some volumes are not properly being mapped from AWS to NixOps. Amazon doesn't appear to give much of a guarantee (or any) in terms of device names. Accepting the "real" device name instead of the mapped device name gets rid of issue #105. In an ideal world Amazon would be providing WWUIDs, device paths or some other attribute that they can define with the block device. Since that doesn't (seem to) exist we must live with this change until someone comes up with a better solution. --- nixops_aws/backends/ec2.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/nixops_aws/backends/ec2.py b/nixops_aws/backends/ec2.py index 5544334d..172211f6 100644 --- a/nixops_aws/backends/ec2.py +++ b/nixops_aws/backends/ec2.py @@ -2041,8 +2041,12 @@ def _check(self, res): device_real ) # boto expects only sd names - if device_that_boto_expects not in instance.block_device_mapping.keys() and v.get( - "volumeId", None + mapped_devices = instance.block_device_mapping.keys() + + if ( + device_that_boto_expects not in mapped_devices + and device_real not in mapped_devices + and v.get("volumeId", None) ): res.disks_ok = False res.messages.append(