Ejemplo n.º 1
0
    def test_associate_disassociate_qos(self):
        """Test the following operations :

        1. associate_qos
        2. get_association_qos
        3. disassociate_qos
        4. disassociate_all_qos
        """

        # create a test volume-type
        vol_type = []
        for _ in range(0, 3):
            vol_type.append(self.create_volume_type())

        # associate the qos-specs with volume-types
        for i in range(0, 3):
            self._test_associate_qos(vol_type[i]["id"])

        # get the association of the qos-specs
        body = self.admin_volume_qos_client.show_association_qos(self.created_qos["id"])["qos_associations"]
        associations = [association["id"] for association in body]
        for i in range(0, 3):
            self.assertIn(vol_type[i]["id"], associations)

        # disassociate a volume-type with qos-specs
        self.admin_volume_qos_client.disassociate_qos(self.created_qos["id"], vol_type[0]["id"])
        operation = "disassociate"
        waiters.wait_for_qos_operations(
            self.admin_volume_qos_client, self.created_qos["id"], operation, vol_type[0]["id"]
        )

        # disassociate all volume-types from qos-specs
        self.admin_volume_qos_client.disassociate_all_qos(self.created_qos["id"])
        operation = "disassociate-all"
        waiters.wait_for_qos_operations(self.admin_volume_qos_client, self.created_qos["id"], operation)
Ejemplo n.º 2
0
    def test_unset_qos_key(self):
        qos = self._create_test_qos_specs()
        self.qos_client.set_qos_key(qos['id'], iops_bytes='500')['qos_specs']

        self.rbac_utils.switch_role(self, toggle_rbac_role=True)
        self.qos_client.unset_qos_key(qos['id'], ['iops_bytes'])
        waiters.wait_for_qos_operations(self.admin_qos_client,
                                        qos['id'],
                                        'qos-key-unset',
                                        args=['iops_bytes'])
Ejemplo n.º 3
0
    def test_unset_qos_key(self):
        qos = self._create_test_qos_specs()
        self.qos_client.set_qos_key(qos['id'], iops_bytes='500')['qos_specs']

        with self.override_role():
            self.qos_client.unset_qos_key(qos['id'], ['iops_bytes'])
        waiters.wait_for_qos_operations(self.qos_client,
                                        qos['id'],
                                        'qos-key-unset',
                                        args=['iops_bytes'])
Ejemplo n.º 4
0
    def test_disassociate_all_qos(self):
        qos = self._create_test_qos_specs()
        vol_type = self.create_volume_type()['id']
        self.qos_client.associate_qos(qos['id'], vol_type)
        self.addCleanup(test_utils.call_and_ignore_notfound_exc,
                        self.qos_client.disassociate_qos, qos['id'], vol_type)

        self.rbac_utils.switch_role(self, toggle_rbac_role=True)
        self.qos_client.disassociate_all_qos(qos['id'])
        waiters.wait_for_qos_operations(self.admin_qos_client, qos['id'],
                                        'disassociate-all')
Ejemplo n.º 5
0
    def test_disassociate_all_qos(self):
        qos = self._create_test_qos_specs()
        vol_type = self.create_volume_type()['id']
        self.qos_client.associate_qos(qos['id'], vol_type)
        self.addCleanup(test_utils.call_and_ignore_notfound_exc,
                        self.qos_client.disassociate_qos, qos['id'], vol_type)

        with self.override_role():
            self.qos_client.disassociate_all_qos(qos['id'])
        waiters.wait_for_qos_operations(self.qos_client, qos['id'],
                                        'disassociate-all')
Ejemplo n.º 6
0
 def test_disassociate_all_qos(self):
     qos = self._create_test_qos_specs()
     # create a test volume-type
     vol_type = self.create_volume_type()['id']
     # associate the qos-specs with volume-types
     self.qos_client.associate_qos(qos['id'], vol_type)
     self.addCleanup(test_utils.call_and_ignore_notfound_exc,
                     self.qos_client.disassociate_qos, qos['id'], vol_type)
     self.rbac_utils.switch_role(self, toggle_rbac_role=True)
     # disassociate all volume-types from qos-specs
     self.qos_client.disassociate_all_qos(qos['id'])
     operation = 'disassociate-all'
     waiters.wait_for_qos_operations(self.qos_client, qos['id'], operation)
Ejemplo n.º 7
0
 def test_unset_qos_key(self):
     # Create a qos
     qos = self._create_test_qos_specs()
     # Set key
     self.qos_client.set_qos_key(qos['id'], iops_bytes='500')['qos_specs']
     self.rbac_utils.switch_role(self, toggle_rbac_role=True)
     # Unset key
     keys = ['iops_bytes']
     self.qos_client.unset_qos_key(qos['id'], keys)
     operation = 'qos-key-unset'
     waiters.wait_for_qos_operations(self.qos_client,
                                     qos['id'],
                                     operation,
                                     args=keys)
Ejemplo n.º 8
0
    def test_set_unset_qos_key(self):
        """Test the addition of a specs key to qos-specs"""
        args = {"iops_bytes": "500"}
        body = self.admin_volume_qos_client.set_qos_key(self.created_qos["id"], iops_bytes="500")["qos_specs"]
        self.assertEqual(args, body)
        body = self.admin_volume_qos_client.show_qos(self.created_qos["id"])["qos_specs"]
        self.assertEqual(args["iops_bytes"], body["specs"]["iops_bytes"])

        # test the deletion of a specs key from qos-specs
        keys = ["iops_bytes"]
        self.admin_volume_qos_client.unset_qos_key(self.created_qos["id"], keys)
        operation = "qos-key-unset"
        waiters.wait_for_qos_operations(self.admin_volume_qos_client, self.created_qos["id"], operation, keys)
        body = self.admin_volume_qos_client.show_qos(self.created_qos["id"])["qos_specs"]
        self.assertNotIn(keys[0], body["specs"])
Ejemplo n.º 9
0
    def test_associate_disassociate_qos(self):
        """Test the following operations :

        1. associate_qos
        2. get_association_qos
        3. disassociate_qos
        4. disassociate_all_qos
        """

        # create a test volume-type
        vol_type = []
        for _ in range(0, 3):
            vol_type.append(self.create_volume_type())

        # associate the qos-specs with volume-types
        for i in range(0, 3):
            self._test_associate_qos(vol_type[i]['id'])

        # get the association of the qos-specs
        associations = self._test_get_association_qos()

        for i in range(0, 3):
            self.assertIn(vol_type[i]['id'], associations)

        # disassociate a volume-type with qos-specs
        self.admin_volume_qos_client.disassociate_qos(self.created_qos['id'],
                                                      vol_type[0]['id'])
        operation = 'disassociate'
        waiters.wait_for_qos_operations(self.admin_volume_qos_client,
                                        self.created_qos['id'], operation,
                                        vol_type[0]['id'])
        associations = self._test_get_association_qos()
        self.assertNotIn(vol_type[0]['id'], associations)

        # disassociate all volume-types from qos-specs
        self.admin_volume_qos_client.disassociate_all_qos(
            self.created_qos['id'])
        operation = 'disassociate-all'
        waiters.wait_for_qos_operations(self.admin_volume_qos_client,
                                        self.created_qos['id'], operation)
        associations = self._test_get_association_qos()
        self.assertEmpty(associations)
Ejemplo n.º 10
0
    def test_set_unset_qos_key(self):
        """Test the addition of a specs key to qos-specs"""
        args = {'iops_bytes': '500'}
        body = self.admin_volume_qos_client.set_qos_key(
            self.created_qos['id'], iops_bytes='500')['qos_specs']
        self.assertEqual(args, body)
        body = self.admin_volume_qos_client.show_qos(
            self.created_qos['id'])['qos_specs']
        self.assertEqual(args['iops_bytes'], body['specs']['iops_bytes'])

        # test the deletion of a specs key from qos-specs
        keys = ['iops_bytes']
        self.admin_volume_qos_client.unset_qos_key(self.created_qos['id'],
                                                   keys)
        operation = 'qos-key-unset'
        waiters.wait_for_qos_operations(self.admin_volume_qos_client,
                                        self.created_qos['id'], operation,
                                        keys)
        body = self.admin_volume_qos_client.show_qos(
            self.created_qos['id'])['qos_specs']
        self.assertNotIn(keys[0], body['specs'])
Ejemplo n.º 11
0
    def test_set_unset_qos_key(self):
        """Test the addition of a specs key to qos-specs"""
        args = {'iops_bytes': '500'}
        body = self.admin_volume_qos_client.set_qos_key(
            self.created_qos['id'],
            iops_bytes='500')['qos_specs']
        self.assertEqual(args, body)
        body = self.admin_volume_qos_client.show_qos(
            self.created_qos['id'])['qos_specs']
        self.assertEqual(args['iops_bytes'], body['specs']['iops_bytes'])

        # test the deletion of a specs key from qos-specs
        keys = ['iops_bytes']
        self.admin_volume_qos_client.unset_qos_key(self.created_qos['id'],
                                                   keys)
        operation = 'qos-key-unset'
        waiters.wait_for_qos_operations(self.admin_volume_qos_client,
                                        self.created_qos['id'],
                                        operation, keys)
        body = self.admin_volume_qos_client.show_qos(
            self.created_qos['id'])['qos_specs']
        self.assertNotIn(keys[0], body['specs'])