Example #1
0
 def delete_qos(self, tenant_id, qos_id):
     """Delete a QoS level."""
     LOG.debug(_("delete_qos() called"))
     try:
         cdb.get_qos(tenant_id, qos_id)
     except Exception:
         raise cexc.QosNotFound(tenant_id=tenant_id, qos_id=qos_id)
     return cdb.remove_qos(tenant_id, qos_id)
Example #2
0
 def delete_qos(self, tenant_id, qos_id):
     """Delete a QoS level."""
     LOG.debug(_("delete_qos() called"))
     try:
         cdb.get_qos(tenant_id, qos_id)
     except Exception:
         raise cexc.QosNotFound(tenant_id=tenant_id,
                                qos_id=qos_id)
     return cdb.remove_qos(tenant_id, qos_id)
Example #3
0
 def rename_qos(self, tenant_id, qos_id, new_name):
     """Rename QoS level."""
     LOG.debug(_("rename_qos() called"))
     try:
         cdb.get_qos(tenant_id, qos_id)
     except Exception:
         raise cexc.QosNotFound(tenant_id=tenant_id, qos_id=qos_id)
     qos = cdb.update_qos(tenant_id, qos_id, new_name)
     return qos
Example #4
0
 def rename_qos(self, tenant_id, qos_id, new_name):
     """Rename QoS level."""
     LOG.debug(_("rename_qos() called"))
     try:
         cdb.get_qos(tenant_id, qos_id)
     except Exception:
         raise cexc.QosNotFound(tenant_id=tenant_id,
                                qos_id=qos_id)
     qos = cdb.update_qos(tenant_id, qos_id, new_name)
     return qos
Example #5
0
    def test_qos_get(self):
        qos11 = self._qos_test_obj(1, 1)
        qos11_id = cdb.add_qos(qos11.tenant, qos11.qname, qos11.desc).qos_id
        qos21 = self._qos_test_obj(2, 1)
        qos21_id = cdb.add_qos(qos21.tenant, qos21.qname, qos21.desc).qos_id
        qos22 = self._qos_test_obj(2, 2)
        qos22_id = cdb.add_qos(qos22.tenant, qos22.qname, qos22.desc).qos_id

        qos = cdb.get_qos(qos11.tenant, qos11_id)
        self._assert_equal(qos, qos11)
        qos = cdb.get_qos(qos21.tenant, qos21_id)
        self._assert_equal(qos, qos21)
        qos = cdb.get_qos(qos21.tenant, qos22_id)
        self._assert_equal(qos, qos22)

        with testtools.ExpectedException(c_exc.QosNotFound):
            cdb.get_qos(qos11.tenant, "dummyQosId")
        with testtools.ExpectedException(c_exc.QosNotFound):
            cdb.get_qos(qos11.tenant, qos21_id)
        with testtools.ExpectedException(c_exc.QosNotFound):
            cdb.get_qos(qos21.tenant, qos11_id)

        qos_all_t1 = cdb.get_all_qoss(qos11.tenant)
        self.assertEqual(len(qos_all_t1), 1)
        qos_all_t2 = cdb.get_all_qoss(qos21.tenant)
        self.assertEqual(len(qos_all_t2), 2)
        qos_all_t3 = cdb.get_all_qoss("tenant3")
        self.assertEqual(len(qos_all_t3), 0)
Example #6
0
    def test_qos_get(self):
        qos11 = self._qos_test_obj(1, 1)
        qos11_id = cdb.add_qos(qos11.tenant, qos11.qname, qos11.desc).qos_id
        qos21 = self._qos_test_obj(2, 1)
        qos21_id = cdb.add_qos(qos21.tenant, qos21.qname, qos21.desc).qos_id
        qos22 = self._qos_test_obj(2, 2)
        qos22_id = cdb.add_qos(qos22.tenant, qos22.qname, qos22.desc).qos_id

        qos = cdb.get_qos(qos11.tenant, qos11_id)
        self._assert_equal(qos, qos11)
        qos = cdb.get_qos(qos21.tenant, qos21_id)
        self._assert_equal(qos, qos21)
        qos = cdb.get_qos(qos21.tenant, qos22_id)
        self._assert_equal(qos, qos22)

        with testtools.ExpectedException(c_exc.QosNotFound):
            cdb.get_qos(qos11.tenant, "dummyQosId")
        with testtools.ExpectedException(c_exc.QosNotFound):
            cdb.get_qos(qos11.tenant, qos21_id)
        with testtools.ExpectedException(c_exc.QosNotFound):
            cdb.get_qos(qos21.tenant, qos11_id)

        qos_all_t1 = cdb.get_all_qoss(qos11.tenant)
        self.assertEqual(len(qos_all_t1), 1)
        qos_all_t2 = cdb.get_all_qoss(qos21.tenant)
        self.assertEqual(len(qos_all_t2), 2)
        qos_all_t3 = cdb.get_all_qoss("tenant3")
        self.assertEqual(len(qos_all_t3), 0)
Example #7
0
 def get_qos_details(self, tenant_id, qos_id):
     """Get QoS Details."""
     LOG.debug(_("get_qos_details() called"))
     try:
         qos_level = cdb.get_qos(tenant_id, qos_id)
     except Exception:
         raise cexc.QosNotFound(tenant_id=tenant_id, qos_id=qos_id)
     return qos_level
Example #8
0
 def get_qos_details(self, tenant_id, qos_id):
     """Get QoS Details."""
     LOG.debug(_("get_qos_details() called"))
     try:
         qos_level = cdb.get_qos(tenant_id, qos_id)
     except Exception:
         raise cexc.QosNotFound(tenant_id=tenant_id,
                                qos_id=qos_id)
     return qos_level
Example #9
0
 def test_qos_update(self):
     qos11 = self._qos_test_obj(1, 1)
     qos11_id = cdb.add_qos(qos11.tenant, qos11.qname, qos11.desc).qos_id
     cdb.update_qos(qos11.tenant, qos11_id)
     new_qname = "new qos name"
     new_qos = cdb.update_qos(qos11.tenant, qos11_id, new_qname)
     expected_qobj = self.QosObj(qos11.tenant, new_qname, qos11.desc)
     self._assert_equal(new_qos, expected_qobj)
     new_qos = cdb.get_qos(qos11.tenant, qos11_id)
     self._assert_equal(new_qos, expected_qobj)
     with testtools.ExpectedException(c_exc.QosNotFound):
         cdb.update_qos(qos11.tenant, "dummyQosId")
Example #10
0
 def test_qos_update(self):
     qos11 = self._qos_test_obj(1, 1)
     qos11_id = cdb.add_qos(qos11.tenant, qos11.qname, qos11.desc).qos_id
     cdb.update_qos(qos11.tenant, qos11_id)
     new_qname = "new qos name"
     new_qos = cdb.update_qos(qos11.tenant, qos11_id, new_qname)
     expected_qobj = self.QosObj(qos11.tenant, new_qname, qos11.desc)
     self._assert_equal(new_qos, expected_qobj)
     new_qos = cdb.get_qos(qos11.tenant, qos11_id)
     self._assert_equal(new_qos, expected_qobj)
     with testtools.ExpectedException(c_exc.QosNotFound):
         cdb.update_qos(qos11.tenant, "dummyQosId")
Example #11
0
 def get_qos_details(self, tenant_id, qos_id):
     """Get QoS Details."""
     LOG.debug(_("get_qos_details() called"))
     return cdb.get_qos(tenant_id, qos_id)
Example #12
0
 def get_qos_details(self, tenant_id, qos_id):
     """Get QoS Details."""
     LOG.debug(_("get_qos_details() called"))
     return cdb.get_qos(tenant_id, qos_id)