Exemplo n.º 1
0
    def test_get_blkio_value_empty(self):
        """Test reading of blkio information with empty file.
        """
        data = self._blkio_sectors_empty
        treadmill.cgroups.get_data.side_effect = [data]

        data = cgutils.get_blkio_value('mycgrp', 'blkio.sectors')
        treadmill.cgroups.get_data.assert_called_with('blkio', 'mycgrp',
                                                      'blkio.sectors')
        self.assertEqual(data, {})
Exemplo n.º 2
0
    def test_get_blkio_value_empty(self):
        """Test reading of blkio information with empty file"""

        with io.open(self._BLKIO_SECTORS_EMPTY) as f:
            data = f.read()
            treadmill.cgroups.get_data.side_effect = [data]

        data = cgutils.get_blkio_value('mycgrp', 'blkio.sectors')
        treadmill.cgroups.get_data.assert_called_with('blkio', 'mycgrp',
                                                      'blkio.sectors')
        self.assertEqual(data, {})
Exemplo n.º 3
0
def read_blkio_value_stats(cgrp, *pseudofiles):
    """ read blkio value based cgroup pseudofiles
    """
    if pseudofiles is None or not pseudofiles:
        pseudofiles = _BLKIO_VALUE_TYPE

    metrics = {}
    for pseudofile in pseudofiles:
        blkio_info = cgutils.get_blkio_value(cgrp, pseudofile)

        metrics[pseudofile] = blkio_info

    return metrics