mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-02 01:18:26 +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_used', 'dev_size', 'pv_mda_size', 'pv_mda_free',
|
||||||
'pv_ba_start', 'pv_ba_size', 'pe_start', 'pv_pe_count',
|
'pv_ba_start', 'pv_ba_size', 'pe_start', 'pv_pe_count',
|
||||||
'pv_pe_alloc_count', 'pv_attr', 'pv_tags', 'vg_name',
|
'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_seg_columns = ['pvseg_start', 'pvseg_size', 'segtype',
|
||||||
'pv_uuid', 'lv_uuid', 'pv_name']
|
'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_used', 'dev_size', 'pv_mda_size', 'pv_mda_free',
|
||||||
'pv_ba_start', 'pv_ba_size', 'pe_start', 'pv_pe_count',
|
'pv_ba_start', 'pv_ba_size', 'pe_start', 'pv_pe_count',
|
||||||
'pv_pe_alloc_count', 'pv_attr', 'pv_tags', 'vg_name',
|
'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
|
# Lvm has some issues where it returns failure when querying pvs when other
|
||||||
# operations are in process, see:
|
# operations are in process, see:
|
||||||
|
@ -433,6 +433,12 @@ class DataStore(object):
|
|||||||
rc.append(self.pvs[self.pv_path_to_uuid[s]])
|
rc.append(self.pvs[self.pv_path_to_uuid[s]])
|
||||||
return rc
|
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):
|
def fetch_vgs(self, vg_name):
|
||||||
if not vg_name:
|
if not vg_name:
|
||||||
return self.vgs.values()
|
return self.vgs.values()
|
||||||
@ -516,6 +522,7 @@ if __name__ == "__main__":
|
|||||||
print("PVS")
|
print("PVS")
|
||||||
for v in ds.pvs.values():
|
for v in ds.pvs.values():
|
||||||
pp.pprint(v)
|
pp.pprint(v)
|
||||||
|
print('PV missing is %s' % ds.pv_missing(v['pv_uuid']))
|
||||||
|
|
||||||
print("VGS")
|
print("VGS")
|
||||||
for v in ds.vgs.values():
|
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
|
# We have a uuid and a lvm_id we can do sanity checks to ensure
|
||||||
# that they are consistent
|
# that they are consistent
|
||||||
|
|
||||||
# If a PV is missing it's device path is '[unknown]'. When
|
# If a PV is missing it's device path is '[unknown]' or some
|
||||||
# we see the lvm_id as such we will re-assign to None
|
# 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 \
|
if path_create == pv_obj_path_generate and \
|
||||||
lvm_id == '[unknown]':
|
cfg.db.pv_missing(uuid):
|
||||||
lvm_id = None
|
lvm_id = None
|
||||||
|
|
||||||
# Lets check for the uuid first
|
# Lets check for the uuid first
|
||||||
|
Loading…
Reference in New Issue
Block a user