From fdeb9c290bfdeb526fbf4c96ab2fb32ea0377331 Mon Sep 17 00:00:00 2001 From: Andrey Pavlov Date: Thu, 2 Apr 2015 18:17:49 +0300 Subject: [PATCH] add filters 'encrypted' and 'volume-type' to volumes Change-Id: I2b0a18a30c56206ffe5652cb33f350bf8e764016 --- ec2api/api/volume.py | 2 ++ ec2api/tests/unit/test_volume.py | 3 +++ 2 files changed, 5 insertions(+) diff --git a/ec2api/api/volume.py b/ec2api/api/volume.py index a05cb373..fed8b7ea 100644 --- a/ec2api/api/volume.py +++ b/ec2api/api/volume.py @@ -111,10 +111,12 @@ class VolumeDescriber(common.TaggableItemsDescriber): KIND = 'vol' FILTER_MAP = {'availability-zone': 'availabilityZone', 'create-time': 'createTime', + 'encrypted': 'encrypted', 'size': 'size', 'snapshot-id': 'snapshotId', 'status': 'status', 'volume-id': 'volumeId', + 'volume-type': 'volumeType', 'attachment.device': ['attachmentSet', 'device'], 'attachment.instance-id': ['attachmentSet', 'instanceId'], 'attachment.status': ['attachmentSet', 'status']} diff --git a/ec2api/tests/unit/test_volume.py b/ec2api/tests/unit/test_volume.py index 848eceeb..00c858dc 100644 --- a/ec2api/tests/unit/test_volume.py +++ b/ec2api/tests/unit/test_volume.py @@ -56,11 +56,14 @@ class VolumeTestCase(base.ApiTestCase): 'DescribeVolumes', 'volumeSet', [('availability-zone', fakes.NAME_AVAILABILITY_ZONE), ('create-time', fakes.TIME_CREATE_VOLUME_2), + ('encrypted', False), # TODO(ft): declare a constant for the volume size in fakes ('size', 1), ('snapshot-id', fakes.ID_EC2_SNAPSHOT_1), ('status', 'available'), ('volume-id', fakes.ID_EC2_VOLUME_1), + # TODO(ft): support filtering by none/empty value + # ('volume-type', ''), ('attachment.device', fakes.ROOT_DEVICE_NAME_INSTANCE_2), ('attachment.instance-id', fakes.ID_EC2_INSTANCE_2), ('attachment.status', 'attached')])