Hi,

On Wed, 8 Nov 2023, Sascha Lucas wrote:

On Tue, 7 Nov 2023, Harry G Coin wrote:

"/usr/lib/python3.6/site-packages/ceph_volume/util/device.py", line 482, in is_partition
/usr/bin/docker: stderr     return self.blkid_api['TYPE'] == 'part'
/usr/bin/docker: stderr KeyError: 'TYPE'

Problem found: in my case this is caused by DRBD secondary block devices, which can not be read until promoted to primary.

ceph_volume/util/disk.py runs in blkid():

$ blkid -c /dev/null -p /dev/drbd4
blkid: error: /dev/drbd4: Wrong medium type

but does not care about its return code.

A quick fix is to use the get() method to automatically fall back to None for non existing keys:

--- a/ceph_volume/util/device.py 2023-11-10 07:00:01.552497107 +0000
+++ b/ceph_volume/util/device.py 2023-11-10 08:54:40.320718690 +0000

@@ -476,13 +476,13 @@
     @property
     def is_partition(self):
         self.load_blkid_api()
         if self.disk_api:
             return self.disk_api['TYPE'] == 'part'
         elif self.blkid_api:
-            return self.blkid_api['TYPE'] == 'part'
+            return self.blkid_api.get('TYPE') == 'part'
         return False

Don't know why this is triggered in 17.2.7.

@ceph-devs: should I report this somewhere else?

TIA, Sascha.
_______________________________________________
ceph-users mailing list -- ceph-users@ceph.io
To unsubscribe send an email to ceph-users-le...@ceph.io

Reply via email to