Add in filtering of EBS volumes on availability-zone (#1468)
This commit is contained in:
parent
1b20f21a75
commit
fecdf388c2
@ -1835,6 +1835,8 @@ class Volume(TaggedEC2Resource):
|
|||||||
return self.id
|
return self.id
|
||||||
elif filter_name == 'encrypted':
|
elif filter_name == 'encrypted':
|
||||||
return str(self.encrypted).lower()
|
return str(self.encrypted).lower()
|
||||||
|
elif filter_name == 'availability-zone':
|
||||||
|
return self.zone.name
|
||||||
else:
|
else:
|
||||||
return super(Volume, self).get_filter_value(
|
return super(Volume, self).get_filter_value(
|
||||||
filter_name, 'DescribeVolumes')
|
filter_name, 'DescribeVolumes')
|
||||||
|
@ -186,6 +186,11 @@ def test_volume_filters():
|
|||||||
{volume1.id, volume3.id, volume4.id}
|
{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
|
@mock_ec2_deprecated
|
||||||
def test_volume_attach_and_detach():
|
def test_volume_attach_and_detach():
|
||||||
|
Loading…
Reference in New Issue
Block a user