From 72e7ca1576e595eb89c580b1bc39351872ab8bb7 Mon Sep 17 00:00:00 2001
From: Lars Beckers <lars.beckers@rwth-aachen.de>
Date: Sun, 17 Nov 2019 12:25:33 +0100
Subject: [PATCH] add ganeti upstream patch for ceph mimic compat

---
 patches/ganeti/fix_rbd_showmapped_mimic.patch | 33 +++++++++++++++++++
 1 file changed, 33 insertions(+)
 create mode 100644 patches/ganeti/fix_rbd_showmapped_mimic.patch

diff --git a/patches/ganeti/fix_rbd_showmapped_mimic.patch b/patches/ganeti/fix_rbd_showmapped_mimic.patch
new file mode 100644
index 0000000..c57b46b
--- /dev/null
+++ b/patches/ganeti/fix_rbd_showmapped_mimic.patch
@@ -0,0 +1,33 @@
+From fa9a8fc141334b176380370b9622a28ad4a066fb Mon Sep 17 00:00:00 2001
+From: Ansgar Jazdzewski <ajaz@spreadshirt.net>
+Date: Tue, 19 Feb 2019 10:31:07 +0100
+Subject: [PATCH] fix 'rbd showmapped' for ceph mimic
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+The json ouput changed from list to dict
+* http://docs.ceph.com/docs/master/releases/mimic/ - The rbd CLI’s
+showmapped JSON and XML output has changed.)
+---
+ lib/storage/bdev.py | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/lib/storage/bdev.py b/lib/storage/bdev.py
+index c7d5f3b6d..7aa09cee6 100644
+--- a/lib/storage/bdev.py
++++ b/lib/storage/bdev.py
+@@ -1064,8 +1064,12 @@ def _ParseRbdShowmappedJson(output, volume_pool, volume_name):
+     except ValueError, err:
+       base.ThrowError("Unable to parse JSON data: %s" % err)
+ 
++    # since ceph mimic the json output changed from dict to list
++    if isinstance(devices, dict):
++      devices = devices.values()
++
+     rbd_dev = None
+-    for d in devices.values(): # pylint: disable=E1103
++    for d in devices:
+       try:
+         name = d["name"]
+       except KeyError:
-- 
GitLab