Skip to content

Commit

Permalink
Merge pull request #114 from andir/treat-aliased-devices-the-same
Browse files Browse the repository at this point in the history
volumes: treat non-aliased devices as equivalent to aliased ones
  • Loading branch information
grahamc committed Sep 22, 2020
2 parents 76f65a2 + 94265b4 commit 34307d3
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions nixops_aws/backends/ec2.py
Original file line number Diff line number Diff line change
Expand Up @@ -1551,10 +1551,12 @@ def create( # noqa: C901

# Detect if volumes were manually detached. If so, reattach
# them.
mapped_devices = self._get_instance().block_device_mapping.keys()

for device_stored, v in self.block_device_mapping.items():
if (
device_name_to_boto_expected(device_stored)
not in self._get_instance().block_device_mapping.keys()
device_name_to_boto_expected(device_stored) not in mapped_devices
and device_stored not in mapped_devices
and not v.get("needsAttach", False)
and v.get("volumeId", None)
):
Expand Down Expand Up @@ -2041,8 +2043,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 34307d3

Please sign in to comment.