Hello Federico Simoncelli, Allon Mureinik,

I'd like you to do a code review.  Please visit

    http://gerrit.ovirt.org/36782

to review the following change.

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

lvm: Handle special "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 in an unhelpful way when checking device properties when
trying to access "unknown device":

    OSError: [Errno 19] Could not find dm device named `unknown device`

Now we check lvm output and filter out pvs named "unknown device". If a
pv is missing, it will not be listed in the vg pv_name list, and in the
pvs cache.

When reloading vgs, we will see now this error:

    vg 04598ee3-46ff-4bb3-b8b2-4434f375302e has pv_count 2 but pv_names
    ('/dev/mapper/1IET_00070003',)

Previously this error was not logged since vg.pv_name included also
"unknown device".

When reloading pvs, we will see a new error:

    Missing pv: wPIujw-Wmcj-V2O6-r8Fl-X485-mXm7-UxCO3Q in vg:
    04598ee3-46ff-4bb3-b8b2-4434f375302e

Finally, a missing pv will show this error during domain selftest:

    StorageDomainAccessError: Domain is either partially accessible or
    entirely inaccessible: ('04598ee3-46ff-4bb3-b8b2-4434f375302e',)

This error was masked before by the OSError above.

Change-Id: I539c766112edce4a3f55d3aa0caac00d8d8c1cca
Bug-Url: https://bugzilla.redhat.com/1176517
Signed-off-by: Nir Soffer <[email protected]>
Reviewed-on: http://gerrit.ovirt.org/36352
Reviewed-by: Allon Mureinik <[email protected]>
Reviewed-by: Federico Simoncelli <[email protected]>
---
M vdsm/storage/lvm.py
1 file changed, 9 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/82/36782/1

diff --git a/vdsm/storage/lvm.py b/vdsm/storage/lvm.py
index 86edf55..aa3c04b 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/36782
To unsubscribe, visit http://gerrit.ovirt.org/settings

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

Reply via email to