Add "default" behaviour to QoS policies

This patch implements the "default" behaviour for QoS policies.
If this flag is enabled for a QoS policy in a project, all
new networks created will have this QoS policy assigned by default.

If a new QoS policy is created or updated with this flag and another
QoS policy in the same project is set as the default policy, the new
one won't be created or updated. To set another QoS policy as default,
the current one must be unset.

DocImpact: A "default" flag is introduced for QoS policies. If this flag
           is enabled in a QoS policy (attached to a project), then all
           networks created in this project would have this QoS policy
           assigned, unless an explicit policy is specified.
APIImpact

Closes-Bug: #1639220
Change-Id: If5ff2b00fa828f93aa089e275ddbd1ff542b79d4
This commit is contained in:
Rodolfo Alonso Hernandez
2017-02-01 15:15:16 +00:00
committed by Kevin Benton
parent e137e63db3
commit 9d69822e43
23 changed files with 530 additions and 116 deletions

View File

@@ -82,7 +82,8 @@ class QosTestJSON(base.BaseAdminNetworkTest):
def test_policy_update(self):
policy = self.create_qos_policy(name='test-policy',
description='',
shared=False)
shared=False,
tenant_id=self.admin_client.tenant_id)
self.admin_client.update_qos_policy(policy['id'],
description='test policy desc2',
shared=True)
@@ -119,7 +120,8 @@ class QosTestJSON(base.BaseAdminNetworkTest):
def test_shared_policy_update(self):
policy = self.create_qos_policy(name='test-policy',
description='',
shared=True)
shared=True,
tenant_id=self.admin_client.tenant_id)
self.admin_client.update_qos_policy(policy['id'],
description='test policy desc2')
@@ -606,7 +608,8 @@ class RbacSharedQosPoliciesTest(base.BaseAdminNetworkTest):
def test_policy_sharing_with_wildcard(self):
qos_pol = self.create_qos_policy(
name=data_utils.rand_name('test-policy'),
description='test-shared-policy', shared=False)
description='test-shared-policy', shared=False,
tenant_id=self.admin_client.tenant_id)
self.assertNotIn(qos_pol, self.client2.list_qos_policies()['policies'])
# test update shared False -> True