Tested-By: Christy Perez <christy(a)linux.vnet.ibm.com>
Before the patch:
/dev/mapper/mpathd
/dev/mapper/mpathb
/dev/mapper/mpatha1
/dev/mapper/mpathc
After the patch:
/dev/mapper/mpatha1
/dev/mapper/mpathb
/dev/mapper/mpathc
/dev/mapper/mpathd
On Tue, 2014-04-01 at 11:34 -0300, 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):
Regards,
- Christy