Exemplo n.º 1
0
    def plug(self, vif, instance_info):
        if not hasattr(vif, "port_profile"):
            raise exception.MissingPortProfile()
        if not isinstance(vif.port_profile,
                          objects.vif.VIFPortProfileOpenVSwitch):
            raise exception.WrongPortProfile(
                profile=vif.port_profile.__class__.__name__)

        if isinstance(vif, objects.vif.VIFOpenVSwitch):
            if sys.platform != constants.PLATFORM_WIN32:
                linux_net.ensure_ovs_bridge(vif.network.bridge,
                    self._get_vif_datapath_type(vif),
                    timeout=self.config.ovs_vsctl_timeout,
                    ovsdb_connection=self.config.ovsdb_connection)
            else:
                self._plug_vif_windows(vif, instance_info)
        elif isinstance(vif, objects.vif.VIFBridge):
            if sys.platform != constants.PLATFORM_WIN32:
                self._plug_bridge(vif, instance_info)
            else:
                self._plug_vif_windows(vif, instance_info)
        elif isinstance(vif, objects.vif.VIFVHostUser):
            self._plug_vhostuser(vif, instance_info)
        elif isinstance(vif, objects.vif.VIFHostDevice):
            self._plug_vf_passthrough(vif, instance_info)
Exemplo n.º 2
0
 def plug(self, vif, instance_info):
     if not hasattr(vif, "port_profile"):
         raise exception.MissingPortProfile()
     if not isinstance(vif.port_profile, VIFPortProfileOVSRepresentor):
         raise exception.WrongPortProfile(
             profile=vif.port_profile.__class__.__name__)
     if isinstance(vif, objects.vif.VIFHostDevice):
         self._plug_agilio_passthrough(vif, instance_info)
     elif isinstance(vif, objects.vif.VIFVHostUser):
         self._plug_agilio_forwarder(vif, instance_info)
Exemplo n.º 3
0
 def unplug(self, vif, instance_info):
     if not hasattr(vif, "port_profile"):
         raise exception.MissingPortProfile()
     if not isinstance(vif.port_profile, VIFPortProfileOpenVSwitch):
         raise exception.WrongPortProfile(
             profile=vif.port_profile.__class__.__name__)
     representor = self._get_representor(vif)
     if isinstance(vif, obj.vif.VIFHostDevice):
         self._unplug_representor(vif, representor)
     elif isinstance(vif, obj.vif.VIFVHostUser):
         self._unplug_representor(vif, representor)
         self._unplug_forwarder(vif, representor)
Exemplo n.º 4
0
    def unplug(self, vif, instance_info):
        if not hasattr(vif, "port_profile"):
            raise exception.MissingPortProfile()
        if not isinstance(vif.port_profile,
                          objects.vif.VIFPortProfileOpenVSwitch):
            raise exception.WrongPortProfile(
                profile=vif.port_profile.__class__.__name__)

        if isinstance(vif, objects.vif.VIFOpenVSwitch):
            if sys.platform == constants.PLATFORM_WIN32:
                self._unplug_vif_windows(vif, instance_info)
        elif isinstance(vif, objects.vif.VIFBridge):
            if sys.platform != constants.PLATFORM_WIN32:
                self._unplug_bridge(vif, instance_info)
            else:
                self._unplug_vif_windows(vif, instance_info)
        elif isinstance(vif, objects.vif.VIFVHostUser):
            self._unplug_vhostuser(vif, instance_info)
Exemplo n.º 5
0
    def plug(self, vif, instance_info):
        if not hasattr(vif, "port_profile"):
            raise exception.MissingPortProfile()
        if not isinstance(vif.port_profile,
                          objects.vif.VIFPortProfileOpenVSwitch):
            raise exception.WrongPortProfile(
                profile=vif.port_profile.__class__.__name__)

        if isinstance(vif, objects.vif.VIFOpenVSwitch):
            if sys.platform != constants.PLATFORM_WIN32:
                linux_net.ensure_ovs_bridge(vif.network.bridge,
                                            constants.OVS_DATAPATH_SYSTEM)
            else:
                self._plug_vif_windows(vif, instance_info)
        elif isinstance(vif, objects.vif.VIFBridge):
            if sys.platform != constants.PLATFORM_WIN32:
                self._plug_bridge(vif, instance_info)
            else:
                self._plug_vif_windows(vif, instance_info)
        elif isinstance(vif, objects.vif.VIFVHostUser):
            self._plug_vhostuser(vif, instance_info)