Merge pull request #517 from DenverJ/volume_snapshot_filters

Add filter for volume-id on volumes.
This commit is contained in:
Steve Pulec 2016-01-24 16:19:55 -05:00
commit f35986b3fc
2 changed files with 6 additions and 0 deletions

View File

@ -1505,6 +1505,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]))