From 0fab7072ac676f20c815abebba5567608bb6995d Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Fri, 29 May 2020 13:31:18 -0400 Subject: [PATCH] Sort all Ceph lists by numeric ID --- daemon-common/ceph.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/daemon-common/ceph.py b/daemon-common/ceph.py index fd97c180..3fe037f8 100644 --- a/daemon-common/ceph.py +++ b/daemon-common/ceph.py @@ -336,7 +336,7 @@ def get_list_osd(zk_conn, limit, is_fuzzy=True): else: osd_list.append(getOSDInformation(zk_conn, osd)) - return True, osd_list + return True, sorted(osd_list, key = lambda x: int(x['id'])) def format_list_osd(osd_list): osd_list_output = [] @@ -666,7 +666,7 @@ def get_list_pool(zk_conn, limit, is_fuzzy=True): else: pool_list.append(getPoolInformation(zk_conn, pool)) - return True, pool_list + return True, sorted(pool_list, key = lambda x: int(x['id'])) def format_list_pool(pool_list): pool_list_output = [] @@ -1061,7 +1061,7 @@ def get_list_volume(zk_conn, pool, limit, is_fuzzy=True): else: volume_list.append(getVolumeInformation(zk_conn, pool_name, volume_name)) - return True, volume_list + return True, sorted(volume_list, key = lambda x: int(x['id'])) def format_list_volume(volume_list): volume_list_output = [] @@ -1272,7 +1272,7 @@ def get_list_snapshot(zk_conn, pool, volume, limit, is_fuzzy=True): else: snapshot_list.append({'pool': pool_name, 'volume': volume_name, 'snapshot': snapshot_name}) - return True, snapshot_list + return True, sorted(snapshot_list, key = lambda x: int(x['id'])) def format_list_snapshot(snapshot_list): snapshot_list_output = []