예제 #1
0
    def avago_firmware(driver):

        devs = defaultdict(dict)
        try:
            sysctls = list(sysctl.filter('{0}.mps'.format(driver)))
        except OSError:
            return

        for k, v in sysctls:
            mibs = k.split('.', 3)
            if len(mibs) < 4:
                continue

            number, mib = mibs[2:4]

            try:
                major = int(v.split('.', 1)[0])
                devs[number][mib] = major
            except:
                continue

        for number, mibs in list(devs.items()):
            firmware_ver = mibs.get('firmware_version')
            driver_ver = mibs.get('driver_version')
            if int(firmware_ver) != int(driver_ver):
                dispatcher.rpc.call_sync('alerts.emit', {
                    'name': 'hardware.controller.firmware_mismatch',
                    'description': 'Firmware version {0} does not match driver version {1} for {2}'.format(
                        firmware_ver,
                        driver_ver,
                        driver,
                    ),
                    'severity': 'WARNING',
                })
예제 #2
0
    def avago_firmware(driver):
        devs = defaultdict(dict)
        try:
            sysctls = list(sysctl.filter('{0}.mps'.format(driver)))
        except OSError:
            return

        for k, v in sysctls:
            mibs = k.split('.', 3)
            if len(mibs) < 4:
                continue

            number, mib = mibs[2:4]

            try:
                major = int(v.split('.', 1)[0])
                devs[number][mib] = major
            except:
                continue

        for number, mibs in list(devs.items()):
            firmware_ver = mibs.get('firmware_version')
            driver_ver = mibs.get('driver_version')
            target = '{0}.{1}'.format(driver, number)
            alert = dispatcher.call_sync('alert.get_active_alert',
                                         'DiskControllerFirmwareMismatch',
                                         target)
            if int(firmware_ver) != int(driver_ver) and not alert:
                dispatcher.call_sync(
                    'alert.emit', {
                        'class':
                        'DiskControllerFirmwareMismatch',
                        'title':
                        'Firmware/driver version mismatch',
                        'target':
                        '{0}.{1}'.format(driver, number),
                        'description':
                        'Firmware version {0} does not match driver version {1} for {2}'
                        .format(
                            firmware_ver,
                            driver_ver,
                            driver,
                        )
                    })
            else:
                # Check if alert was issued
                alert = dispatcher.call_sync('alert.get_active_alert',
                                             'DiskControllerFirmwareMismatch',
                                             '{0}.{1}'.format(driver, number))

                if alert:
                    alert.cancel(alert['id'])
예제 #3
0
    def avago_firmware(driver):
        devs = defaultdict(dict)
        try:
            sysctls = list(sysctl.filter("{0}.mps".format(driver)))
        except OSError:
            return

        for k, v in sysctls:
            mibs = k.split(".", 3)
            if len(mibs) < 4:
                continue

            number, mib = mibs[2:4]

            try:
                major = int(v.split(".", 1)[0])
                devs[number][mib] = major
            except:
                continue

        for number, mibs in list(devs.items()):
            firmware_ver = mibs.get("firmware_version")
            driver_ver = mibs.get("driver_version")
            target = "{0}.{1}".format(driver, number)
            alert = dispatcher.call_sync("alert.get_active_alert", "DiskControllerFirmwareMismatch", target)
            if int(firmware_ver) != int(driver_ver) and not alert:
                dispatcher.call_sync(
                    "alert.emit",
                    {
                        "class": "DiskControllerFirmwareMismatch",
                        "title": "Firmware/driver version mismatch",
                        "target": "{0}.{1}".format(driver, number),
                        "description": "Firmware version {0} does not match driver version {1} for {2}".format(
                            firmware_ver, driver_ver, driver
                        ),
                    },
                )
            else:
                # Check if alert was issued
                alert = dispatcher.call_sync(
                    "alert.get_active_alert", "DiskControllerFirmwareMismatch", "{0}.{1}".format(driver, number)
                )

                if alert:
                    alert.cancel(alert["id"])
    def avago_firmware(driver):
        devs = defaultdict(dict)
        try:
            sysctls = list(sysctl.filter('{0}.mps'.format(driver)))
        except OSError:
            return

        for k, v in sysctls:
            mibs = k.split('.', 3)
            if len(mibs) < 4:
                continue

            number, mib = mibs[2:4]

            try:
                major = int(v.split('.', 1)[0])
                devs[number][mib] = major
            except:
                continue

        for number, mibs in list(devs.items()):
            firmware_ver = mibs.get('firmware_version')
            driver_ver = mibs.get('driver_version')
            if int(firmware_ver) != int(driver_ver):
                dispatcher.call_sync('alert.emit', {
                    'class': 'DiskControllerFirmwareMismatch',
                    'title': 'Firmware/driver version mismatch',
                    'target': '{0}.{1}'.format(driver, number),
                    'description': 'Firmware version {0} does not match driver version {1} for {2}'.format(
                        firmware_ver,
                        driver_ver,
                        driver,
                    )
                })
            else:
                # Check if alert was issued
                alert = dispatcher.call_sync(
                    'alert.get_active_alert',
                    'DiskControllerFirmwareMismatch',
                    '{0}.{1}'.format(driver, number)
                )

                if alert:
                    alert.cancel(alert['id'])