Esempio n. 1
0
    def test_map_qos_spec_no_key_present(self):
        qos_spec = {}
        mock_get_name = self.mock_object(na_utils, 'get_qos_policy_group_name')
        mock_get_name.return_value = 'fake_qos_policy'
        expected = {
            'policy_name': 'fake_qos_policy',
        }

        result = na_utils.map_qos_spec(qos_spec, fake.VOLUME)

        self.assertEqual(expected, result)
Esempio n. 2
0
    def test_map_qos_spec_no_key_present(self):
        qos_spec = {}
        mock_get_name = self.mock_object(na_utils, 'get_qos_policy_group_name')
        mock_get_name.return_value = 'fake_qos_policy'
        expected = {
            'policy_name': 'fake_qos_policy',
            'max_throughput': None,
        }

        result = na_utils.map_qos_spec(qos_spec, fake.VOLUME)

        self.assertEqual(expected, result)
Esempio n. 3
0
    def test_map_qos_spec_maxbpspergib(self):
        qos_spec = {'maxBPSperGiB': 100000}
        mock_get_name = self.mock_object(na_utils, 'get_qos_policy_group_name')
        mock_get_name.return_value = 'fake_qos_policy'
        expected = {
            'policy_name': 'fake_qos_policy',
            'max_throughput': '4200000B/s',
        }

        result = na_utils.map_qos_spec(qos_spec, fake.VOLUME)

        self.assertEqual(expected, result)
Esempio n. 4
0
    def test_map_qos_spec_maxiops(self):
        qos_spec = {'maxIOPs': 33000}
        mock_get_name = self.mock_object(na_utils, 'get_qos_policy_group_name')
        mock_get_name.return_value = 'fake_qos_policy'
        expected = {
            'policy_name': 'fake_qos_policy',
            'max_throughput': '33000iops',
        }

        result = na_utils.map_qos_spec(qos_spec, fake.VOLUME)

        self.assertEqual(expected, result)
Esempio n. 5
0
    def test_map_qos_spec_maxbpspergib(self):
        qos_spec = {'maxBPSperGiB': 100000}
        mock_get_name = self.mock_object(na_utils, 'get_qos_policy_group_name')
        mock_get_name.return_value = 'fake_qos_policy'
        expected = {
            'policy_name': 'fake_qos_policy',
            'max_throughput': '4200000B/s',
        }

        result = na_utils.map_qos_spec(qos_spec, fake.VOLUME)

        self.assertEqual(expected, result)
Esempio n. 6
0
    def test_map_qos_spec_maxiops(self):
        qos_spec = {'maxIOPs': 33000}
        mock_get_name = self.mock_object(na_utils, 'get_qos_policy_group_name')
        mock_get_name.return_value = 'fake_qos_policy'
        expected = {
            'policy_name': 'fake_qos_policy',
            'max_throughput': '33000iops',
        }

        result = na_utils.map_qos_spec(qos_spec, fake.VOLUME)

        self.assertEqual(expected, result)
Esempio n. 7
0
    def test_map_qos_spec_none(self):
        qos_spec = None

        result = na_utils.map_qos_spec(qos_spec, fake.VOLUME)

        self.assertIsNone(result)
Esempio n. 8
0
    def test_map_qos_spec_none(self):
        qos_spec = None

        result = na_utils.map_qos_spec(qos_spec, fake.VOLUME)

        self.assertIsNone(result)