def disassociate_qos_specs(context, specs_id, type_id): """Disassociate qos_specs from volume type.""" try: db.qos_specs_disassociate(context, specs_id, type_id) except db_exc.DBError as e: LOG.exception(_('DB error: %s') % e) LOG.warn(_('Failed to disassociate qos specs ' '%(id)s with type: %(vol_type_id)s') % dict(id=specs_id, vol_type_id=type_id)) raise exception.QoSSpecsDisassociateFailed(specs_id=specs_id, type_id=type_id)
def disassociate_qos_specs(context, specs_id, type_id): """Disassociate qos_specs from volume type.""" try: get_qos_specs(context, specs_id) db.qos_specs_disassociate(context, specs_id, type_id) except db_exc.DBError: LOG.exception(_LE("DB error:")) LOG.warning( _LW("Failed to disassociate qos specs " "%(id)s with type: %(vol_type_id)s"), dict(id=specs_id, vol_type_id=type_id), ) raise exception.QoSSpecsDisassociateFailed(specs_id=specs_id, type_id=type_id)
def disassociate_qos_specs(context, specs_id, type_id): """Disassociate qos_specs from volume type.""" try: get_qos_specs(context, specs_id) db.qos_specs_disassociate(context, specs_id, type_id) except db_exc.DBError as e: LOG.exception(_('DB error: %s') % e) LOG.warn(_('Failed to disassociate qos specs ' '%(id)s with type: %(vol_type_id)s') % dict(id=specs_id, vol_type_id=type_id)) raise exception.QoSSpecsDisassociateFailed(specs_id=specs_id, type_id=type_id)
def test_qos_specs_disassociate(self): type_id = volume_types.create(self.ctxt, 'TypeName')['id'] specs_id = self._create_qos_specs('FakeQos') db.volume_type_qos_associate(self.ctxt, type_id, specs_id) res = db.qos_specs_associations_get(self.ctxt, specs_id) self.assertEqual(res[0]['id'], type_id) self.assertEqual(res[0]['qos_specs_id'], specs_id) db.qos_specs_disassociate(self.ctxt, specs_id, type_id) res = db.qos_specs_associations_get(self.ctxt, specs_id) self.assertEqual(len(res), 0) res = db.volume_type_get(self.ctxt, type_id) self.assertEqual(res['qos_specs_id'], None)
def test_qos_specs_disassociate(self): type_id = volume_types.create(self.ctxt, 'TypeName')['id'] specs_id = self._create_qos_specs('FakeQos') db.volume_type_qos_associate(self.ctxt, type_id, specs_id) res = db.qos_specs_associations_get(self.ctxt, specs_id) self.assertEqual(type_id, res[0]['id']) self.assertEqual(specs_id, res[0]['qos_specs_id']) db.qos_specs_disassociate(self.ctxt, specs_id, type_id) res = db.qos_specs_associations_get(self.ctxt, specs_id) self.assertEqual(0, len(res)) res = db.volume_type_get(self.ctxt, type_id) self.assertIsNone(res['qos_specs_id'])
def test_qos_specs_disassociate(self): type_id = volume_types.create(self.ctxt, "TypeName")["id"] specs_id = self._create_qos_specs("FakeQos") db.volume_type_qos_associate(self.ctxt, type_id, specs_id) res = db.qos_specs_associations_get(self.ctxt, specs_id) self.assertEqual(res[0]["id"], type_id) self.assertEqual(res[0]["qos_specs_id"], specs_id) db.qos_specs_disassociate(self.ctxt, specs_id, type_id) res = db.qos_specs_associations_get(self.ctxt, specs_id) self.assertEqual(len(res), 0) res = db.volume_type_get(self.ctxt, type_id) self.assertIsNone(res["qos_specs_id"])