mirror of
https://github.com/ceph/ceph
synced 2025-01-20 10:01:45 +00:00
mgr/rbd_support: return 'rbd mirror snapshot schedule status' as json
Signed-off-by: Mykola Golub <mgolub@suse.com>
This commit is contained in:
parent
b2e825debc
commit
84ec26d0e4
@ -694,15 +694,19 @@ class MirrorSnapshotScheduleHandler:
|
||||
return -errno.EINVAL, '', "Invalid level spec {}: {}".format(
|
||||
level_spec_name, e)
|
||||
|
||||
result = ""
|
||||
scheduled_images = []
|
||||
with self.lock:
|
||||
for schedule_time in sorted(self.queue):
|
||||
for pool_id, namespace, image_id in self.queue[schedule_time]:
|
||||
if not level_spec.matches(pool_id, namespace, image_id):
|
||||
continue
|
||||
image_name = self.images[pool_id][namespace][image_id]
|
||||
result += "{} {}\n".format(schedule_time, image_name)
|
||||
return 0, result, ""
|
||||
scheduled_images.append({
|
||||
'schedule_time' : schedule_time,
|
||||
'image' : image_name
|
||||
})
|
||||
return 0, json.dumps({'scheduled_images' : scheduled_images},
|
||||
indent=4, sort_keys=True), ""
|
||||
|
||||
def handle_command(self, inbuf, prefix, cmd):
|
||||
if prefix == 'add':
|
||||
|
Loading…
Reference in New Issue
Block a user