Re: Permanent KeyError: 'TYPE' ->17.2.7: return self.blkid_api['TYPE'] == 'part'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



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/", 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/ 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/ 2023-11-10 07:00:01.552497107 +0000
+++ b/ceph_volume/util/ 2023-11-10 08:54:40.320718690 +0000

@@ -476,13 +476,13 @@
     def is_partition(self):
         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@xxxxxxx
To unsubscribe send an email to ceph-users-leave@xxxxxxx

[Index of Archives]     [Information on CEPH]     [Linux Filesystem Development]     [Ceph Development]     [Ceph Large]     [Ceph Dev]     [Linux USB Development]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [xfs]

  Powered by Linux