diff --git a/quantum/plugins/cisco/models/virt_phy_sw_v2.py b/quantum/plugins/cisco/models/virt_phy_sw_v2.py index fd084b746f..faef734d37 100644 --- a/quantum/plugins/cisco/models/virt_phy_sw_v2.py +++ b/quantum/plugins/cisco/models/virt_phy_sw_v2.py @@ -52,7 +52,8 @@ class VirtualPhysicalSwitchModelV2(quantum_plugin_base_v2.QuantumPluginBaseV2): supported_extension_aliases = [] _plugins = {} _inventory = {} - _methods_to_delegate = ['get_network', 'get_networks', + _methods_to_delegate = ['create_network_bulk', + 'get_network', 'get_networks', 'create_port_bulk', 'get_port', 'get_ports', 'create_subnet', 'create_subnet_bulk', @@ -98,20 +99,23 @@ class VirtualPhysicalSwitchModelV2(quantum_plugin_base_v2.QuantumPluginBaseV2): def __getattribute__(self, name): """ This delegates the calls to the methods implemented only by the OVS - sub-plugin. + sub-plugin. Note: Currently, bulking is handled by the caller + (PluginV2), and this model class expects to receive only non-bulking + calls. If, however, a bulking call is made, this will method will + delegate the call to the OVS plugin. """ - super_getattr = super(VirtualPhysicalSwitchModelV2, - self).__getattribute__ - methods = super_getattr('_methods_to_delegate') + super_getattribute = super(VirtualPhysicalSwitchModelV2, + self).__getattribute__ + methods = super_getattribute('_methods_to_delegate') if name in methods: - plugin = super_getattr('_plugins')[const.VSWITCH_PLUGIN] + plugin = super_getattribute('_plugins')[const.VSWITCH_PLUGIN] return getattr(plugin, name) try: - return super_getattr(name) + return super_getattribute(name) except AttributeError: - plugin = super_getattr('_plugins')[const.VSWITCH_PLUGIN] + plugin = super_getattribute('_plugins')[const.VSWITCH_PLUGIN] return getattr(plugin, name) def _func_name(self, offset=0): @@ -240,24 +244,6 @@ class VirtualPhysicalSwitchModelV2(quantum_plugin_base_v2.QuantumPluginBaseV2): # TODO (Sumit): Check if we need to perform any rollback here raise - def create_network_bulk(self, context, networks): - """ - Perform this operation in the context of the configured device - plugins. - """ - LOG.debug(_("create_network_bulk() called")) - try: - args = [context, networks] - ovs_output = self._plugins[ - const.VSWITCH_PLUGIN].create_network_bulk(context, networks) - LOG.debug(_("ovs_output: %s"), ovs_output) - vlanids = self._get_all_segmentation_ids() - ovs_networks = ovs_output - return ovs_output - except: - # TODO (Sumit): Check if we need to perform any rollback here - raise - def update_network(self, context, id, network): """ Perform this operation in the context of the configured device diff --git a/quantum/plugins/cisco/network_plugin.py b/quantum/plugins/cisco/network_plugin.py index 270136cfc8..5c31235670 100644 --- a/quantum/plugins/cisco/network_plugin.py +++ b/quantum/plugins/cisco/network_plugin.py @@ -39,12 +39,12 @@ class PluginV2(db_base_plugin_v2.QuantumDbPluginV2): Meta-Plugin with v2 API support for multiple sub-plugins. """ supported_extension_aliases = ["Cisco Credential", "Cisco qos"] - _methods_to_delegate = ['create_network', 'create_network_bulk', + _methods_to_delegate = ['create_network', 'delete_network', 'update_network', 'get_network', 'get_networks', - 'create_port', 'create_port_bulk', 'delete_port', + 'create_port', 'delete_port', 'update_port', 'get_port', 'get_ports', - 'create_subnet', 'create_subnet_bulk', + 'create_subnet', 'delete_subnet', 'update_subnet', 'get_subnet', 'get_subnets', ] _master = True @@ -72,6 +72,8 @@ class PluginV2(db_base_plugin_v2.QuantumDbPluginV2): """ When the configured model class offers to manage the state of the logical resources, we delegate the core API calls directly to it. + Note: Bulking calls will be handled by this class, and turned into + non-bulking calls to be considered for delegation. """ master = object.__getattribute__(self, "_master") methods = object.__getattribute__(self, "_methods_to_delegate")