mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-30 01:47:56 +03:00
lvmdbusd: Use 'pv_missing' column instead of '[unknown]'
Previously using '[unknown]' for PV device path comparison which is incorrect as it's not always true.
This commit is contained in:
parent
be5eb995d3
commit
bd96036835
@ -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:
|
||||
|
@ -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():
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user