summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTony Asleson <tasleson@redhat.com>2016-09-28 11:18:10 -0500
committerTony Asleson <tasleson@redhat.com>2016-09-28 12:07:48 -0500
commitbd96036835e088de6a59811834b5fa0747274a62 (patch)
treea89f37e64213063f1bc8d822ea95f77b42a21ee4
parentbe5eb995d356610b0748b05b65f74c34934526e4 (diff)
downloadlvm2-bd96036835e088de6a59811834b5fa0747274a62.tar.gz
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.
-rw-r--r--daemons/lvmdbusd/cmdhandler.py4
-rwxr-xr-xdaemons/lvmdbusd/lvmdb.py7
-rw-r--r--daemons/lvmdbusd/objectmanager.py8
3 files changed, 14 insertions, 5 deletions
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