NSX|V3+P: allow removing qos policy from a port
Change-Id: I20b53ffa0a467d65f2324ade79b038f076bd241a
This commit is contained in:
@@ -683,7 +683,7 @@ class NsxPluginV3Base(agentschedulers_db.AZDhcpAgentSchedulerDbMixin,
|
|||||||
is_new_compute = updated_compute and not orig_compute
|
is_new_compute = updated_compute and not orig_compute
|
||||||
|
|
||||||
qos_policy_id = None
|
qos_policy_id = None
|
||||||
if validators.is_attr_set(updated_port.get(qos_consts.QOS_POLICY_ID)):
|
if qos_consts.QOS_POLICY_ID in updated_port:
|
||||||
qos_policy_id = updated_port[qos_consts.QOS_POLICY_ID]
|
qos_policy_id = updated_port[qos_consts.QOS_POLICY_ID]
|
||||||
elif original_port:
|
elif original_port:
|
||||||
# Look for the original QoS policy of this port
|
# Look for the original QoS policy of this port
|
||||||
|
@@ -778,6 +778,11 @@ class NsxPTestPorts(test_db_base_plugin_v2.TestPortsV2,
|
|||||||
res = self.plugin.get_port(self.ctx, port['id'])
|
res = self.plugin.get_port(self.ctx, port['id'])
|
||||||
self.assertEqual(policy_id, res['qos_policy_id'])
|
self.assertEqual(policy_id, res['qos_policy_id'])
|
||||||
|
|
||||||
|
# now remove the qos from the port
|
||||||
|
data['port']['qos_policy_id'] = None
|
||||||
|
res = self.plugin.update_port(self.ctx, port['id'], data)
|
||||||
|
self.assertIsNone(res['qos_policy_id'])
|
||||||
|
|
||||||
def test_create_ext_port_with_qos_fail(self):
|
def test_create_ext_port_with_qos_fail(self):
|
||||||
with self._create_l3_ext_network() as network:
|
with self._create_l3_ext_network() as network:
|
||||||
with self.subnet(network=network, cidr='10.0.0.0/24',
|
with self.subnet(network=network, cidr='10.0.0.0/24',
|
||||||
|
@@ -1116,6 +1116,11 @@ class TestPortsV2(test_plugin.TestPortsV2, NsxV3PluginTestCaseMixin,
|
|||||||
res = self.plugin.get_port(self.ctx, port['id'])
|
res = self.plugin.get_port(self.ctx, port['id'])
|
||||||
self.assertEqual(policy_id, res['qos_policy_id'])
|
self.assertEqual(policy_id, res['qos_policy_id'])
|
||||||
|
|
||||||
|
# now remove the qos from the port
|
||||||
|
data['port']['qos_policy_id'] = None
|
||||||
|
res = self.plugin.update_port(self.ctx, port['id'], data)
|
||||||
|
self.assertIsNone(res['qos_policy_id'])
|
||||||
|
|
||||||
def test_create_ext_port_with_qos_fail(self):
|
def test_create_ext_port_with_qos_fail(self):
|
||||||
with self._create_l3_ext_network() as network:
|
with self._create_l3_ext_network() as network:
|
||||||
with self.subnet(network=network, cidr='10.0.0.0/24'),\
|
with self.subnet(network=network, cidr='10.0.0.0/24'),\
|
||||||
|
Reference in New Issue
Block a user