Reviewed-By: Zhou Zheng Sheng <zhshzhou(a)linux.vnet.ibm.com>
Tested on my VM. Before the patch, the devices are listed as follow.
vdb5 vdb6 mpathb vdb1 mpatha
After the patch, the devices are listed as follow.
mpatha mpathb vdb1 vdb5 vdb6
on 2014/04/01 22:34, Rodrigo Trujillo wrote:
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(a)linux.vnet.ibm.com>
---
src/kimchi/control/host.py | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/kimchi/control/host.py b/src/kimchi/control/host.py
index cfc24bd..ee9fe7b 100644
--- a/src/kimchi/control/host.py
+++ b/src/kimchi/control/host.py
@@ -64,6 +64,12 @@ 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):
--
Thanks and best regards!
Zhou Zheng Sheng / 周征晟
E-mail: zhshzhou(a)linux.vnet.ibm.com
Telephone: 86-10-82454397