Nir Soffer has uploaded a new change for review.

Change subject: lvm: Handle specila "unknown device" pv_name
......................................................................

lvm: Handle specila "unknown device" pv_name

When a pv is missing (e.g. device was lost or target is disconnected),
lvm return the special value "unknown device". Keeping this value cause
vdsm to fail when checking device properties when trying to access
"/dev/mapper/unknown device".

Now we check lvm output and filter out pvs named "unknown devie".

Change-Id: I539c766112edce4a3f55d3aa0caac00d8d8c1cca
Bug-Url: https://bugzilla.redhat.com/1176517
Signed-off-by: Nir Soffer <[email protected]>
---
M vdsm/storage/lvm.py
1 file changed, 9 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/52/36352/1

diff --git a/vdsm/storage/lvm.py b/vdsm/storage/lvm.py
index 86edf55..c7c66f1 100644
--- a/vdsm/storage/lvm.py
+++ b/vdsm/storage/lvm.py
@@ -59,6 +59,9 @@
 LV_ATTR_BITS = ("voltype", "permission", "allocations", "fixedminor", "state",
                 "devopen", "target", "zero")
 
+# Returned by lvm commands for pv_name when a pv name is not available.
+UNKNOWN_DEVICE = "unknown device"
+
 PV = namedtuple("PV", PV_FIELDS + ",guid")
 VG = namedtuple("VG", VG_FIELDS + ",writeable,partial")
 VG_ATTR = namedtuple("VG_ATTR", VG_ATTR_BITS)
@@ -329,6 +332,9 @@
             for line in out:
                 fields = [field.strip() for field in line.split(SEPARATOR)]
                 pv = makePV(*fields)
+                if pv.name == UNKNOWN_DEVICE:
+                    log.error("Missing PV: %s in vg: %s", pv.uuid, pv.vg_name)
+                    continue
                 self._pvs[pv.name] = pv
                 updatedPVs[pv.name] = pv
             # If we updated all the PVs drop stale flag
@@ -383,6 +389,9 @@
                 uuid = fields[VG._fields.index("uuid")]
                 pvNameIdx = VG._fields.index("pv_name")
                 pv_name = fields[pvNameIdx]
+                if pv_name == UNKNOWN_DEVICE:
+                    # PV is missing, e.g. device lost of target not connected
+                    continue
                 if uuid not in vgsFields:
                     fields[pvNameIdx] = [pv_name]  # Make a pv_names list
                     vgsFields[uuid] = fields


-- 
To view, visit http://gerrit.ovirt.org/36352
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I539c766112edce4a3f55d3aa0caac00d8d8c1cca
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to