[fullstack] Be able to delete port when fake VM is destroyed
When a VM fixture is destroyed, the port now can be deleted instead of unbinding it. That will update the ML2 plugin cache. When the port is actually deleted from the system, the ML2 agent should detect it and trigger the deletion process. Change-Id: I0ecbaf6f6e0b5b6b538956f2b47e7f11ce21341b Closes-Bug: #1909234
This commit is contained in:
parent
24393a6e99
commit
7a204f63e9
|
@ -197,15 +197,16 @@ class FakeFullstackMachine(machine_fixtures.FakeMachineBase):
|
|||
)
|
||||
)
|
||||
|
||||
def destroy(self):
|
||||
def destroy(self, delete_port=False):
|
||||
"""Destroy this fake machine.
|
||||
|
||||
This should simulate deletion of a vm. It doesn't call cleanUp().
|
||||
"""
|
||||
self.safe_client.client.update_port(
|
||||
self.neutron_port['id'],
|
||||
{'port': {pbs.HOST_ID: ''}}
|
||||
)
|
||||
if delete_port:
|
||||
self.safe_client.client.delete_port(self.neutron_port['id'])
|
||||
else:
|
||||
self.safe_client.client.update_port(self.neutron_port['id'],
|
||||
{'port': {pbs.HOST_ID: ''}})
|
||||
# All associated vlan interfaces are deleted too
|
||||
# If VM is connected to Linuxbridge it hasn't got "delete_port" method
|
||||
# and it is not necessary to delete tap port connected to this bridge.
|
||||
|
|
|
@ -380,7 +380,7 @@ class TestBwLimitQoSOvs(_TestBwLimitQoS, base.BaseFullStackTestCase):
|
|||
vm, BANDWIDTH_LIMIT, BANDWIDTH_BURST, self.direction)
|
||||
|
||||
# Delete port with qos policy attached
|
||||
vm.destroy()
|
||||
vm.destroy(delete_port=True)
|
||||
self._wait_for_bw_rule_removed(vm, self.direction)
|
||||
self.assertIsNone(vm.bridge.find_qos(vm.port.name))
|
||||
self.assertIsNone(vm.bridge.find_queue(vm.port.name,
|
||||
|
@ -511,7 +511,7 @@ class _TestDscpMarkingQoS(BaseQoSRuleTestCase):
|
|||
self._wait_for_dscp_marking_rule_applied(vm, DSCP_MARK)
|
||||
|
||||
# Delete port with qos policy attached
|
||||
vm.destroy()
|
||||
vm.destroy(delete_port=True)
|
||||
self._wait_for_dscp_marking_rule_removed(vm)
|
||||
|
||||
|
||||
|
@ -746,7 +746,7 @@ class TestMinBwQoSOvs(_TestMinBwQoS, base.BaseFullStackTestCase):
|
|||
self.assertEqual(queue.uuid, queues[0]['_uuid'])
|
||||
|
||||
# Delete port with qos policy attached
|
||||
vm_qos.destroy()
|
||||
vm_qos.destroy(delete_port=True)
|
||||
self._wait_for_min_bw_rule_removed(vm_qos, self.direction)
|
||||
self.assertEqual(
|
||||
[],
|
||||
|
|
Loading…
Reference in New Issue