def virsh_check_nodecpustats_percpu(actual_stats):
        """
        Check the acual nodecpustats output value
        total time <= system uptime
        """

        # Normalise to seconds from nano seconds
        total = float((actual_stats['system'] + actual_stats['user'] +
                       actual_stats['idle'] + actual_stats['iowait']) / (10 ** 9))
        uptime = float(utils.get_uptime())
        if not total <= uptime:
            raise error.TestFail("Commands 'virsh nodecpustats' not succeeded"
                                 " as total time: %f is more"
                                 " than uptime: %f" % (total, uptime))
        return True
    def virsh_check_nodecpustats_percpu(actual_stats):
        """
        Check the acual nodecpustats output value
        total time <= system uptime
        """

        # Normalise to seconds from nano seconds
        total = float((actual_stats['system'] + actual_stats['user'] +
                       actual_stats['idle'] + actual_stats['iowait']) / (10 ** 9))
        uptime = float(utils.get_uptime())
        if not total <= uptime:
            raise error.TestFail("Commands 'virsh nodecpustats' not succeeded"
                                 " as total time: %f is more"
                                 " than uptime: %f" % (total, uptime))
        return True
Example #3
0
    def virsh_check_nodecpustats(actual_stats, cpu_count):
        """
        Check the acual nodecpustats output value
        total time <= system uptime
        """

        # Normalise to seconds from nano seconds and get for one cpu
        total = float(
            (
                (actual_stats["system"] + actual_stats["user"] + actual_stats["idle"] + actual_stats["iowait"])
                / (10 ** 9)
            )
            / (cpu_count)
        )
        uptime = float(utils.get_uptime())
        if not total <= uptime:
            raise error.TestFail(
                "Commands 'virsh nodecpustats' not succeeded"
                " as total time: %f is more"
                " than uptime: %f" % (total, uptime)
            )
        return True