def detect_megacli(hw_lst): 'Detect LSI MegaRAID controller configuration.' ctrl_num = megacli.adp_count() if ctrl_num > 0: for ctrl in range(ctrl_num): enc = megacli.enc_info(ctrl) for disk_num in range(megacli.pd_get_num(ctrl)): disk = 'disk%d' % disk_num info = megacli.pdinfo(ctrl, enc['DeviceId'], disk_num) hw_lst.append(('disk', disk, 'ctrl', str(ctrl_num))) hw_lst.append(('disk', disk, 'type', info['PdType'])) hw_lst.append(('disk', disk, 'id', '%s:%d' % (info['EnclosureDeviceId'], disk_num))) hw_lst.append(('disk', disk, 'size', info['CoercedSize'].split()[0])) return True else: return False
def test_pd_get_num(self): self.output = ''' Number of Physical Drives on Adapter 0: 6''' self.assertEqual(megacli.pd_get_num(0), 6)