Add filter for volume-id on volumes.

This commit is contained in:
Denver Janke 2016-01-20 12:24:33 +10:00
parent 82b0b12e45
commit ee33ff582c
2 changed files with 6 additions and 0 deletions

View File

@ -1453,6 +1453,9 @@ class Volume(TaggedEC2Resource):
if filter_name == 'status':
return self.status
if filter_name == 'volume-id':
return self.id
filter_value = super(Volume, self).get_filter_value(filter_name)
if filter_value is None:

View File

@ -95,6 +95,9 @@ def test_volume_filters():
volumes_by_status = conn.get_all_volumes(filters={'status': 'in-use'})
set([vol.id for vol in volumes_by_status]).should.equal(set([block_mapping.volume_id]))
volumes_by_id = conn.get_all_volumes(filters={'volume-id': volume1.id})
set([vol.id for vol in volumes_by_id]).should.equal(set([volume1.id]))
volumes_by_tag_key = conn.get_all_volumes(filters={'tag-key': 'testkey1'})
set([vol.id for vol in volumes_by_tag_key]).should.equal(set([volume1.id]))