Merge "qos: Delete bw limit rule when policy is deleted"
This commit is contained in:
commit
5282e80941
|
@ -69,18 +69,12 @@ class QosPortPolicyBinding(model_base.BASEV2):
|
|||
cascade='delete', lazy='joined'))
|
||||
|
||||
|
||||
class QosRuleColumns(models_v2.HasId):
|
||||
# NOTE(ihrachyshka): we may need to rework it later when we introduce types
|
||||
# that should not enforce uniqueness
|
||||
qos_policy_id = sa.Column(sa.String(36), nullable=False, unique=True)
|
||||
|
||||
__table_args__ = (
|
||||
sa.ForeignKeyConstraint(['qos_policy_id'], ['qos_policies.id']),
|
||||
model_base.BASEV2.__table_args__
|
||||
)
|
||||
|
||||
|
||||
class QosBandwidthLimitRule(QosRuleColumns, model_base.BASEV2):
|
||||
class QosBandwidthLimitRule(models_v2.HasId, model_base.BASEV2):
|
||||
__tablename__ = 'qos_bandwidth_limit_rules'
|
||||
qos_policy_id = sa.Column(sa.String(36),
|
||||
sa.ForeignKey('qos_policies.id',
|
||||
ondelete='CASCADE'),
|
||||
nullable=False,
|
||||
unique=True)
|
||||
max_kbps = sa.Column(sa.Integer)
|
||||
max_burst_kbps = sa.Column(sa.Integer)
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
# under the License.
|
||||
|
||||
from tempest_lib import exceptions
|
||||
import testtools
|
||||
|
||||
from neutron.services.qos import qos_consts
|
||||
from neutron.tests.api import base
|
||||
|
@ -285,6 +286,20 @@ class QosTestJSON(base.BaseAdminNetworkTest):
|
|||
self._disassociate_port(port['id'])
|
||||
self.admin_client.delete_qos_policy(policy['id'])
|
||||
|
||||
@test.attr(type='smoke')
|
||||
@test.idempotent_id('a2a5849b-dd06-4b18-9664-0b6828a1fc27')
|
||||
def test_qos_policy_delete_with_rules(self):
|
||||
policy = self.create_qos_policy(name='test-policy',
|
||||
description='test policy',
|
||||
shared=False)
|
||||
self.admin_client.create_bandwidth_limit_rule(
|
||||
policy['id'], 200, 1337)['bandwidth_limit_rule']
|
||||
|
||||
self.admin_client.delete_qos_policy(policy['id'])
|
||||
|
||||
with testtools.ExpectedException(exceptions.NotFound):
|
||||
self.admin_client.show_qos_policy(policy['id'])
|
||||
|
||||
|
||||
class QosBandwidthLimitRuleTestJSON(base.BaseAdminNetworkTest):
|
||||
@classmethod
|
||||
|
|
Loading…
Reference in New Issue