Blob Blame History Raw
commit c57e7d6d2dabe9e9d17d2e3aa4a2e77f7dc70acd
Author: Michal Zylowski <michal.zylowski@intel.com>
Date:   Tue Mar 27 20:27:19 2018 +0200

    Recognize RAID volume under reshape as DEVICE_TYPE_VOLUME

    Ledmon detects RAID device type by parsing value of sysfs file
    "metadata_version" (/sys/block/mdXXX/md/metadata_version). When IMSM
    RAID volume is under reshape, metadata_version file has value
    "external:-md127/0". In current ledmon version this md device will be
    wrongly recognized as container.

    Recognize volumes under reshape as DEVICE_TYPE_VOLUME not
    DEVICE_TYPE_CONTAINER.

    This patch also fixes problem with blinking during reshape on some
    environments.

    Signed-off-by: Michal Zylowski <michal.zylowski@intel.com>
    Resolves: #1669232

diff --git a/src/sysfs.c b/src/sysfs.c
index 1a18a8b..f42be09 100644
--- a/src/sysfs.c
+++ b/src/sysfs.c
@@ -125,7 +125,7 @@ static enum device_type _get_device_type(const char *path)
 	if (p != NULL) {
 		if (strlen(p) > 0) {
 			if (strncmp(p, "external:", 9) == 0) {
-				if (p[9] == '/')
+				if (p[9] == '/' || p[9] == '-')
 					result = DEVICE_TYPE_VOLUME;
 				else
 					result = DEVICE_TYPE_CONTAINER;