diff --git a/daemons/lvmdbusd/cmdhandler.py b/daemons/lvmdbusd/cmdhandler.py index c8c7baab1..3cb2cbd99 100644 --- a/daemons/lvmdbusd/cmdhandler.py +++ b/daemons/lvmdbusd/cmdhandler.py @@ -469,7 +469,7 @@ def lvm_full_report_json(): 'pv_used', 'dev_size', 'pv_mda_size', 'pv_mda_free', 'pv_ba_start', 'pv_ba_size', 'pe_start', 'pv_pe_count', 'pv_pe_alloc_count', 'pv_attr', 'pv_tags', 'vg_name', - 'vg_uuid'] + 'vg_uuid', 'pv_missing'] pv_seg_columns = ['pvseg_start', 'pvseg_size', 'segtype', 'pv_uuid', 'lv_uuid', 'pv_name'] @@ -522,7 +522,7 @@ def pv_retrieve_with_segs(device=None): 'pv_used', 'dev_size', 'pv_mda_size', 'pv_mda_free', 'pv_ba_start', 'pv_ba_size', 'pe_start', 'pv_pe_count', 'pv_pe_alloc_count', 'pv_attr', 'pv_tags', 'vg_name', - 'vg_uuid', 'pvseg_start', 'pvseg_size', 'segtype'] + 'vg_uuid', 'pvseg_start', 'pvseg_size', 'segtype', 'pv_missing'] # Lvm has some issues where it returns failure when querying pvs when other # operations are in process, see: diff --git a/daemons/lvmdbusd/lvmdb.py b/daemons/lvmdbusd/lvmdb.py index ac60a80a2..9529e03e1 100755 --- a/daemons/lvmdbusd/lvmdb.py +++ b/daemons/lvmdbusd/lvmdb.py @@ -433,6 +433,12 @@ class DataStore(object): rc.append(self.pvs[self.pv_path_to_uuid[s]]) return rc + def pv_missing(self, pv_uuid): + if pv_uuid in self.pvs: + if self.pvs[pv_uuid]['pv_missing'] == '': + return False + return True + def fetch_vgs(self, vg_name): if not vg_name: return self.vgs.values() @@ -516,6 +522,7 @@ if __name__ == "__main__": print("PVS") for v in ds.pvs.values(): pp.pprint(v) + print('PV missing is %s' % ds.pv_missing(v['pv_uuid'])) print("VGS") for v in ds.vgs.values(): diff --git a/daemons/lvmdbusd/objectmanager.py b/daemons/lvmdbusd/objectmanager.py index 3284e1c45..71149a5b8 100644 --- a/daemons/lvmdbusd/objectmanager.py +++ b/daemons/lvmdbusd/objectmanager.py @@ -320,10 +320,12 @@ class ObjectManager(AutomatedProperties): # We have a uuid and a lvm_id we can do sanity checks to ensure # that they are consistent - # If a PV is missing it's device path is '[unknown]'. When - # we see the lvm_id as such we will re-assign to None + # If a PV is missing it's device path is '[unknown]' or some + # other text derivation of unknown. When we find that a PV is + # missing we will clear out the lvm_id as it's likely not unique + # and thus not useful and potentially harmful for lookups. if path_create == pv_obj_path_generate and \ - lvm_id == '[unknown]': + cfg.db.pv_missing(uuid): lvm_id = None # Lets check for the uuid first