Skip to content

Commit

Permalink
volumes: treat non-aliased devices as equivalent to aliased ones
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
andir committed Sep 18, 2020
1 parent 76f65a2 commit 9147651
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions nixops_aws/backends/ec2.py
Expand Up @@ -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(
Expand Down

0 comments on commit 9147651

Please sign in to comment.