diff options
| -rw-r--r-- | nova/compute/manager.py | 2 | ||||
| -rw-r--r-- | nova/virt/libvirt/connection.py | 3 | ||||
| -rw-r--r-- | nova/virt/libvirt/vif.py | 9 |
3 files changed, 5 insertions, 9 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 98f3cc86f..2ade43503 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -299,7 +299,6 @@ class ComputeManager(manager.SchedulerDependentManager): network_info = self.network_api.allocate_for_instance(context, instance, vpn=is_vpn) LOG.debug(_("instance network_info: |%s|"), network_info) - self.driver.plug_vifs(context, instance, network_info) else: # TODO(tr3buchet) not really sure how this should be handled. # virt requires network_info to be passed in but stub_network @@ -646,7 +645,6 @@ class ComputeManager(manager.SchedulerDependentManager): 'rescuing') network_info = self.network_api.get_instance_nw_info(context, instance_ref) - self.driver.plug_vifs(context, instance_ref, network_info) _update_state = lambda result: self._update_state_callback( self, context, instance_id, result) self.driver.rescue(instance_ref, _update_state, network_info) diff --git a/nova/virt/libvirt/connection.py b/nova/virt/libvirt/connection.py index 5f347989c..5cedcf2c1 100644 --- a/nova/virt/libvirt/connection.py +++ b/nova/virt/libvirt/connection.py @@ -966,8 +966,7 @@ class LibvirtConnection(driver.ComputeDriver): nics = [] for (network, mapping) in network_info: - nics.append(self.vif_driver.get_configurations(instance, network, - mapping)) + nics.append(self.vif_driver.plug(instance, network, mapping)) # FIXME(vish): stick this in db inst_type_id = instance['instance_type_id'] inst_type = instance_types.get_instance_type(inst_type_id) diff --git a/nova/virt/libvirt/vif.py b/nova/virt/libvirt/vif.py index 820055cf0..d35a3c8f6 100644 --- a/nova/virt/libvirt/vif.py +++ b/nova/virt/libvirt/vif.py @@ -33,7 +33,7 @@ flags.DEFINE_bool('allow_project_net_traffic', class LibvirtBridge(object): """Linux bridge VIF for Libvirt.""" - def get_configurations(self, instance, network, mapping): + def get_configurations(self, network, mapping): """Get a dictionary of VIF configurations for bridge type.""" # Assume that the gateway also acts as the dhcp server. dhcp_server = mapping['gateway'] @@ -76,6 +76,7 @@ class LibvirtBridgeDriver(VIFDriver, LibvirtBridge): """Ensure that the bridge exists, and add VIF to it.""" linux_net.ensure_bridge(network['bridge'], network['bridge_interface']) + return self.get_configurations(network, mapping) def unplug(self, instance, network, mapping): pass @@ -88,6 +89,7 @@ class LibvirtVlanBridgeDriver(VIFDriver, LibvirtBridge): """Ensure that VLAN and bridge exist and add VIF to the bridge.""" linux_net.ensure_vlan_bridge(network['vlan'], network['bridge'], network['bridge_interface']) + return self.get_configurations(network, mapping) def unplug(self, instance, network, mapping): pass @@ -96,7 +98,7 @@ class LibvirtVlanBridgeDriver(VIFDriver, LibvirtBridge): class LibvirtOpenVswitchDriver(VIFDriver): """VIF driver for Open vSwitch.""" - def get_configurations(self, instance, network, mapping): + def plug(self, instance, network, mapping): vif_id = str(instance['id']) + "-" + str(network['id']) dev = "tap-%s" % vif_id utils.execute('sudo', 'ip', 'tuntap', 'add', dev, 'mode', 'tap') @@ -115,9 +117,6 @@ class LibvirtOpenVswitchDriver(VIFDriver): print "using result = %s" % str(result) return result - def plug(self, instance, network, mapping): - pass - def unplug(self, instance, network, mapping): vif_id = str(instance['id']) + "-" + str(network['id']) dev = "tap-%s" % vif_id |
