From: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
When listing storage volumes, directory will be listed
Signed-off-by: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
---
src/kimchi/control/base.py | 2 +-
src/kimchi/control/storagevolumes.py | 5 +++++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/kimchi/control/base.py b/src/kimchi/control/base.py
index ac24b3f..1854428 100644
--- a/src/kimchi/control/base.py
+++ b/src/kimchi/control/base.py
@@ -279,7 +279,7 @@ class Collection(object):
if not res.is_authorized():
continue
- if all(key in res.data and res.data[key] == val
+ if all(key in res.data and (res.data[key] == val or res.data[key] in val)
for key, val in fields_filter.iteritems()):
data.append(res.data)
return data
diff --git a/src/kimchi/control/storagevolumes.py b/src/kimchi/control/storagevolumes.py
index c4d6c41..c6f6ce0 100644
--- a/src/kimchi/control/storagevolumes.py
+++ b/src/kimchi/control/storagevolumes.py
@@ -30,6 +30,11 @@ class StorageVolumes(Collection):
self.resource_args = [self.pool, ]
self.model_args = [self.pool, ]
+ def filter_data(self, resources, fields_filter):
+ # filter directory from storage volumes
+ fields_filter.update({'type': ['file', 'block',
'network']})
+ return super(StorageVolumes, self).filter_data(resources, fields_filter)
+
class StorageVolume(Resource):
def __init__(self, model, pool, ident):
--
1.8.3.2