def process(self, device, results, log): log.info("Collecting logical disks (md) for device %s" % device.id) rm = self.relMap() for device in parse_mdstat(results): om = self.objectMap() om.id = self.prepId("md%s" % device["id"]) om.description = "/dev/md%s" % device["id"] om.hostresindex = int(device["id"]) om.diskType = device["type"] om.size = device.get("blocks", 0) om.stripesize = device.get("stripesize", 0) rm.append(om) return rm
def processResults(self, cmd, result): """ Process the results of "cat /proc/mdstat". """ ifs = {} for dp in cmd.points: dp.component = dp.data['componentScanValue'] points = ifs.setdefault(dp.component, {}) points[dp.id] = dp for device in parse_mdstat(cmd.result.output): component = self.prepId('md%s' % device['id']) points = ifs.get(component, None) if points: for name,value in device.items(): dp = points.get(name, None) if dp is not None: if value in ('-',''): value = 0 result.values.append((dp, float(value))) log.debug(pformat(result)) return result