def test_ioclass_stats_set(prepare_and_cleanup):
    """Try to retrieve stats for all set ioclasses"""
    prepare()
    min_ioclass_id = 1
    max_ioclass_id = 11

    ioclass_config.create_ioclass_config(
        add_default_rule=True, ioclass_config_path=ioclass_config_path
    )

    TestProperties.LOGGER.info("Preparing ioclass config file")
    for i in range(min_ioclass_id, max_ioclass_id):
        ioclass_config.add_ioclass(
            ioclass_id=(i + 10),
            eviction_priority=22,
            allocation=True,
            rule=f"file_size:le:{4096*i}&done",
            ioclass_config_path=ioclass_config_path,
        )
    casadm.load_io_classes(cache_id, file=ioclass_config_path)

    TestProperties.LOGGER.info("Preparing ioclass config file")
    for i in range(32):
        if i != 0 or i not in range(min_ioclass_id, max_ioclass_id):
            with pytest.raises(Exception):
                assert casadm_parser.get_statistics(
                    cache_id=cache_id, io_class_id=True, filter=[StatsFilter.conf]
                )
def flush_cache(cache_id):
    casadm.flush(cache_id=cache_id)
    sync()
    casadm.reset_counters(cache_id=cache_id)
    stats = casadm_parser.get_statistics(cache_id=cache_id, filter=[StatsFilter.blk])
    for key, value in stats.items():
        assert value.get_value(Unit.Blocks4096) == 0
Beispiel #3
0
 def get_io_class_statistics(self,
                             io_class_id: int,
                             stat_filter: List[StatsFilter] = None,
                             percentage_val: bool = False):
     stats = get_statistics(self.cache_id, self.core_id, io_class_id,
                            stat_filter, percentage_val)
     return CoreIoClassStats(stats)
Beispiel #4
0
 def get_statistics_flat(self,
                         io_class_id: int = None,
                         stat_filter: List[StatsFilter] = None,
                         percentage_val: bool = False):
     return get_statistics(self.cache_id, self.core_id, io_class_id,
                           stat_filter, percentage_val)
Beispiel #5
0
 def get_statistics(self,
                    stat_filter: List[StatsFilter] = None,
                    percentage_val: bool = False):
     stats = get_statistics(self.cache_id, self.core_id, None, stat_filter,
                            percentage_val)
     return CoreStats(stats)