Skip to content

Commit 34307d3

Browse files
authored
Merge pull request #114 from andir/treat-aliased-devices-the-same
volumes: treat non-aliased devices as equivalent to aliased ones
2 parents 76f65a2 + 94265b4 commit 34307d3

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

nixops_aws/backends/ec2.py

+10-4
Original file line numberDiff line numberDiff line change
@@ -1551,10 +1551,12 @@ def create( # noqa: C901
15511551

15521552
# Detect if volumes were manually detached. If so, reattach
15531553
# them.
1554+
mapped_devices = self._get_instance().block_device_mapping.keys()
1555+
15541556
for device_stored, v in self.block_device_mapping.items():
15551557
if (
1556-
device_name_to_boto_expected(device_stored)
1557-
not in self._get_instance().block_device_mapping.keys()
1558+
device_name_to_boto_expected(device_stored) not in mapped_devices
1559+
and device_stored not in mapped_devices
15581560
and not v.get("needsAttach", False)
15591561
and v.get("volumeId", None)
15601562
):
@@ -2041,8 +2043,12 @@ def _check(self, res):
20412043
device_real
20422044
) # boto expects only sd names
20432045

2044-
if device_that_boto_expects not in instance.block_device_mapping.keys() and v.get(
2045-
"volumeId", None
2046+
mapped_devices = instance.block_device_mapping.keys()
2047+
2048+
if (
2049+
device_that_boto_expects not in mapped_devices
2050+
and device_real not in mapped_devices
2051+
and v.get("volumeId", None)
20462052
):
20472053
res.disks_ok = False
20482054
res.messages.append(

0 commit comments

Comments
 (0)