The networking_generic_switch.generic_switch_mech
Module¶
-
class
networking_generic_switch.generic_switch_mech.
GenericSwitchDriver
¶ Bases:
neutron_lib.plugins.ml2.api.MechanismDriver
-
bind_port
(context)¶ Attempt to bind a port.
- Parameters
context – PortContext instance describing the port
This method is called outside any transaction to attempt to establish a port binding using this mechanism driver. Bindings may be created at each of multiple levels of a hierarchical network, and are established from the top level downward. At each level, the mechanism driver determines whether it can bind to any of the network segments in the context.segments_to_bind property, based on the value of the context.host property, any relevant port or network attributes, and its own knowledge of the network topology. At the top level, context.segments_to_bind contains the static segments of the port’s network. At each lower level of binding, it contains static or dynamic segments supplied by the driver that bound at the level above. If the driver is able to complete the binding of the port to any segment in context.segments_to_bind, it must call context.set_binding with the binding details. If it can partially bind the port, it must call context.continue_binding with the network segments to be used to bind at the next lower level.
If the binding results are committed after bind_port returns, they will be seen by all mechanism drivers as update_port_precommit and update_port_postcommit calls. But if some other thread or process concurrently binds or updates the port, these binding results will not be committed, and update_port_precommit and update_port_postcommit will not be called on the mechanism drivers with these results. Because binding results can be discarded rather than committed, drivers should avoid making persistent state changes in bind_port, or else must ensure that such state changes are eventually cleaned up.
Implementing this method explicitly declares the mechanism driver as having the intention to bind ports. This is inspected by the QoS service to identify the available QoS rules you can use with ports.
-
create_network_postcommit
(context)¶ Create a network.
- Parameters
context – NetworkContext instance describing the new
network.
Called after the transaction commits. Call can block, though will block the entire process so care should be taken to not drastically affect performance. Raising an exception will cause the deletion of the resource.
-
create_network_precommit
(context)¶ Allocate resources for a new network.
- Parameters
context – NetworkContext instance describing the new
network.
Create a new network, allocating resources as necessary in the database. Called inside transaction context on session. Call cannot block. Raising an exception will result in a rollback of the current transaction.
-
create_port_postcommit
(context)¶ Create a port.
- Parameters
context – PortContext instance describing the port.
Called after the transaction completes. Call can block, though will block the entire process so care should be taken to not drastically affect performance. Raising an exception will result in the deletion of the resource.
-
create_port_precommit
(context)¶ Allocate resources for a new port.
- Parameters
context – PortContext instance describing the port.
Create a new port, allocating resources as necessary in the database. Called inside transaction context on session. Call cannot block. Raising an exception will result in a rollback of the current transaction.
-
create_subnet_postcommit
(context)¶ Create a subnet.
- Parameters
context – SubnetContext instance describing the new
subnet.
Called after the transaction commits. Call can block, though will block the entire process so care should be taken to not drastically affect performance. Raising an exception will cause the deletion of the resource.
-
create_subnet_precommit
(context)¶ Allocate resources for a new subnet.
- Parameters
context – SubnetContext instance describing the new
subnet. rt = context.current device_id = port[‘device_id’] device_owner = port[‘device_owner’] Create a new subnet, allocating resources as necessary in the database. Called inside transaction context on session. Call cannot block. Raising an exception will result in a rollback of the current transaction.
-
delete_network_postcommit
(context)¶ Delete a network.
- Parameters
context – NetworkContext instance describing the current
state of the network, prior to the call to delete it.
Called after the transaction commits. Call can block, though will block the entire process so care should be taken to not drastically affect performance. Runtime errors are not expected, and will not prevent the resource from being deleted.
-
delete_network_precommit
(context)¶ Delete resources for a network.
- Parameters
context – NetworkContext instance describing the current
state of the network, prior to the call to delete it.
Delete network resources previously allocated by this mechanism driver for a network. Called inside transaction context on session. Runtime errors are not expected, but raising an exception will result in rollback of the transaction.
-
delete_port_postcommit
(context)¶ Delete a port.
- Parameters
context – PortContext instance describing the current
state of the port, prior to the call to delete it.
Called after the transaction completes. Call can block, though will block the entire process so care should be taken to not drastically affect performance. Runtime errors are not expected, and will not prevent the resource from being deleted.
-
delete_port_precommit
(context)¶ Delete resources of a port.
- Parameters
context – PortContext instance describing the current
state of the port, prior to the call to delete it.
Called inside transaction context on session. Runtime errors are not expected, but raising an exception will result in rollback of the transaction.
-
delete_subnet_postcommit
(context)¶ Delete a subnet.
- Parameters
context – SubnetContext instance describing the current
state of the subnet, prior to the call to delete it.
Called after the transaction commits. Call can block, though will block the entire process so care should be taken to not drastically affect performance. Runtime errors are not expected, and will not prevent the resource from being deleted.
-
delete_subnet_precommit
(context)¶ Delete resources for a subnet.
- Parameters
context – SubnetContext instance describing the current
state of the subnet, prior to the call to delete it.
Delete subnet resources previously allocated by this mechanism driver for a subnet. Called inside transaction context on session. Runtime errors are not expected, but raising an exception will result in rollback of the transaction.
-
initialize
()¶ Perform driver initialization.
Called after all drivers have been loaded and the database has been initialized. No abstract methods defined below will be called prior to this method being called.
-
update_network_postcommit
(context)¶ Update a network.
- Parameters
context – NetworkContext instance describing the new
state of the network, as well as the original state prior to the update_network call.
Called after the transaction commits. Call can block, though will block the entire process so care should be taken to not drastically affect performance. Raising an exception will cause the deletion of the resource.
update_network_postcommit is called for all changes to the network state. It is up to the mechanism driver to ignore state or state changes that it does not know or care about.
-
update_network_precommit
(context)¶ Update resources of a network.
- Parameters
context – NetworkContext instance describing the new
state of the network, as well as the original state prior to the update_network call.
Update values of a network, updating the associated resources in the database. Called inside transaction context on session. Raising an exception will result in rollback of the transaction.
update_network_precommit is called for all changes to the network state. It is up to the mechanism driver to ignore state or state changes that it does not know or care about.
-
update_port_postcommit
(context)¶ Update a port.
- Parameters
context – PortContext instance describing the new
state of the port, as well as the original state prior to the update_port call.
Called after the transaction completes. Call can block, though will block the entire process so care should be taken to not drastically affect performance. Raising an exception will result in the deletion of the resource.
update_port_postcommit is called for all changes to the port state. It is up to the mechanism driver to ignore state or state changes that it does not know or care about.
-
update_port_precommit
(context)¶ Update resources of a port.
- Parameters
context – PortContext instance describing the new
state of the port, as well as the original state prior to the update_port call.
Called inside transaction context on session to complete a port update as defined by this mechanism driver. Raising an exception will result in rollback of the transaction.
update_port_precommit is called for all changes to the port state. It is up to the mechanism driver to ignore state or state changes that it does not know or care about.
-
update_subnet_postcommit
(context)¶ Update a subnet.
- Parameters
context – SubnetContext instance describing the new
state of the subnet, as well as the original state prior to the update_subnet call.
Called after the transaction commits. Call can block, though will block the entire process so care should be taken to not drastically affect performance. Raising an exception will cause the deletion of the resource.
update_subnet_postcommit is called for all changes to the subnet state. It is up to the mechanism driver to ignore state or state changes that it does not know or care about.
-
update_subnet_precommit
(context)¶ Update resources of a subnet.
- Parameters
context – SubnetContext instance describing the new
state of the subnet, as well as the original state prior to the update_subnet call.
Update values of a subnet, updating the associated resources in the database. Called inside transaction context on session. Raising an exception will result in rollback of the transaction.
update_subnet_precommit is called for all changes to the subnet state. It is up to the mechanism driver to ignore state or state changes that it does not know or care about.
-