[Kimchi-devel] [PATCH V5] Sort device paths shown when creating a logical storage pool

Rodrigo Trujillo rodrigo.trujillo at linux.vnet.ibm.com
Wed Apr 2 20:15:20 UTC 2014


This patch sorts the host partitions list returned by backend by
partition path. Then UI is going to show paths sorted, improving
the user experience.

Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo at linux.vnet.ibm.com>
---
 src/kimchi/control/host.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/kimchi/control/host.py b/src/kimchi/control/host.py
index cfc24bd..a0818c7 100644
--- a/src/kimchi/control/host.py
+++ b/src/kimchi/control/host.py
@@ -64,6 +64,13 @@ class Partitions(Collection):
         super(Partitions, self).__init__(model)
         self.resource = Partition
 
+    # Defining get_resources in order to return list of partitions in UI
+    # sorted by their path
+    def _get_resources(self, flag_filter):
+        res_list = super(Partitions, self)._get_resources(flag_filter)
+        res_list.sort(key=lambda x: x.info['path'])
+        return res_list
+
 
 class Partition(Resource):
     def __init__(self, model, id):
-- 
1.8.5.3




More information about the Kimchi-devel mailing list