Add in filtering of EBS volumes on availability-zone (#1468)

This commit is contained in:
keirbadger 2018-03-21 15:58:32 +00:00 committed by Jack Danger
parent 1b20f21a75
commit fecdf388c2
2 changed files with 7 additions and 0 deletions

View File

@ -1835,6 +1835,8 @@ class Volume(TaggedEC2Resource):
return self.id
elif filter_name == 'encrypted':
return str(self.encrypted).lower()
elif filter_name == 'availability-zone':
return self.zone.name
else:
return super(Volume, self).get_filter_value(
filter_name, 'DescribeVolumes')

View File

@ -186,6 +186,11 @@ def test_volume_filters():
{volume1.id, volume3.id, volume4.id}
)
volumes_by_availability_zone = conn.get_all_volumes(filters={'availability-zone': 'us-east-1b'})
set([vol.id for vol in volumes_by_availability_zone if vol.id in volume_ids]).should.equal(
{volume2.id}
)
@mock_ec2_deprecated
def test_volume_attach_and_detach():