def detect_areca(hw_lst): 'Detect Areca controller configuration' device = areca.sys_info() if not device: sys.stderr.write('Info: detect_areca: No controller found\n') return if "ControllerName" not in device.keys(): sys.stderr.write('Info: detect_areca: Cannot found controller name\n') return sys.stderr.write('Info: detect_areca: Found %s version %s\n' % (device['ControllerName'], device['FirmwareVersion'])) areca.disable_password() for info in device.keys(): hw_lst.append(('areca', 'system', info, device[info])) adsys = areca.adsys_info() for info in adsys.keys(): hw_lst.append(('areca', 'system', info, adsys[info])) cfg = areca.sys_showcfg() for info in cfg.keys(): hw_lst.append(('areca', 'config', info, cfg[info])) hw_info = areca.hw_info() for info in hw_info.keys(): hw_lst.append(('areca', 'hardware', info, hw_info[info])) pwr_info = areca.hdd_pwr_info() for info in pwr_info.keys(): hw_lst.append(('areca', 'power', info, pwr_info[info])) for disk_number in range(1, 255): disk_info = areca.disk_info(disk_number) # If we don't have info about that disk, let's stop here if len(disk_info) < 2: break # Extracting disk information for info in disk_info: hw_lst.append( ('areca', "disk%d" % disk_number, info, disk_info[info]))
def detect_areca(hw_lst): 'Detect Areca controller configuration' device = areca.sys_info() if not device: sys.stderr.write('Info: detect_areca: No controller found\n') return if "ControllerName" not in device.keys(): sys.stderr.write('Info: detect_areca: Cannot found controller name\n') return sys.stderr.write('Info: detect_areca: Found %s version %s\n' % (device['ControllerName'], device['FirmwareVersion'])) areca.disable_password() for info in device.keys(): hw_lst.append(('areca', 'system', info, device[info])) adsys = areca.adsys_info() for info in adsys.keys(): hw_lst.append(('areca', 'system', info, adsys[info])) cfg = areca.sys_showcfg() for info in cfg.keys(): hw_lst.append(('areca', 'config', info, cfg[info])) hw_info = areca.hw_info() for info in hw_info.keys(): hw_lst.append(('areca', 'hardware', info, hw_info[info])) pwr_info = areca.hdd_pwr_info() for info in pwr_info.keys(): hw_lst.append(('areca', 'power', info, pwr_info[info])) for disk_number in range(1, 255): disk_info = areca.disk_info(disk_number) # If we don't have info about that disk, let's stop here if len(disk_info) < 2: break # Extracting disk information for info in disk_info: hw_lst.append(('areca', "disk%d" % disk_number, info, disk_info[info]))
def test_diskinfo(self): self.output = sample('areca_disks_info') self.assertEqual(areca.disk_info(1), {'DeviceLocation': 'Enclosure#1 Slot#8', 'DeviceState': 'NORMAL', 'DeviceTemperature': 27, 'DeviceTemperature/unit': 'C', 'DeviceType': 'SATA(5001B4D4188DF017)', 'DiskCapacity': '1000.2', 'DiskCapacity/unit': 'GB', 'FirmwareRev.': 'JP4OA3MA', 'MediaErrorCount': 0, 'ModelName': 'Hitachi HDS721010CLA330', 'SerialNumber': 'JPS930N121H4YV', 'SmartCalibrationRetries': 'N.A.(N.A.)', 'SmartReadErrorRate': '100(16)', 'SmartReallocationCount': '100(5)', 'SmartSeekErrorRate': '100(67)', 'SmartSpinupRetries': '100(60)', 'SmartSpinupTime': '122(24)', 'TimeoutCount': 0})