Ejemplo n.º 1
0
 def unplug_tap(self, instance, vif):
     """Unplug a VIF_TYPE_TAP virtual interface."""
     dev = self.get_vif_devname(vif)
     try:
         linux_net_utils.delete_net_dev(dev)
     except processutils.ProcessExecutionError:
         LOG.exception(_("Failed while unplugging vif"), instance=instance)
Ejemplo n.º 2
0
 def unplug_tap(self, instance, vif):
     """Unplug a VIF_TYPE_TAP virtual interface."""
     dev = self.get_vif_devname(vif)
     try:
         linux_net_utils.delete_net_dev(dev)
     except processutils.ProcessExecutionError:
         LOG.exception(_("Failed while unplugging vif"), instance=instance)
Ejemplo n.º 3
0
def _post_unplug_wiring_delete_veth(instance, vif):
    v1_name = get_vif_devname(vif)
    try:
        if _is_ovs_vif_port(vif):
            linux_net.delete_ovs_vif_port(vif['network']['bridge'], v1_name,
                                          True)
        else:
            network_utils.delete_net_dev(v1_name)
    except processutils.ProcessExecutionError:
        LOG.exception("Failed to delete veth for vif", vif=vif)
Ejemplo n.º 4
0
    def unplug_vrouter(self, instance, vif):
        """Unplug Contrail's network port

        Unbind the vif from a Contrail virtual port.
        """
        dev = self.get_vif_devname(vif)
        port_id = vif['id']
        try:
            nova.privsep.libvirt.unplug_contrail_vif(port_id)
            linux_net_utils.delete_net_dev(dev)
        except processutils.ProcessExecutionError:
            LOG.exception(_("Failed while unplugging vif"), instance=instance)
Ejemplo n.º 5
0
    def unplug_iovisor(self, instance, vif):
        """Unplug using PLUMgrid IO Visor Driver

        Delete network device and to their respective
        connection to the Virtual Domain in PLUMgrid Platform.
        """
        dev = self.get_vif_devname(vif)
        try:
            nova.privsep.libvirt.unplug_plumgrid_vif(dev)
            linux_net_utils.delete_net_dev(dev)
        except processutils.ProcessExecutionError:
            LOG.exception(_("Failed while unplugging vif"), instance=instance)
Ejemplo n.º 6
0
    def unplug_vrouter(self, instance, vif):
        """Unplug Contrail's network port

        Unbind the vif from a Contrail virtual port.
        """
        dev = self.get_vif_devname(vif)
        port_id = vif['id']
        try:
            nova.privsep.libvirt.unplug_contrail_vif(port_id)
            linux_net_utils.delete_net_dev(dev)
        except processutils.ProcessExecutionError:
            LOG.exception(_("Failed while unplugging vif"), instance=instance)
Ejemplo n.º 7
0
    def unplug_iovisor(self, instance, vif):
        """Unplug using PLUMgrid IO Visor Driver

        Delete network device and to their respective
        connection to the Virtual Domain in PLUMgrid Platform.
        """
        dev = self.get_vif_devname(vif)
        try:
            nova.privsep.libvirt.unplug_plumgrid_vif(dev)
            linux_net_utils.delete_net_dev(dev)
        except processutils.ProcessExecutionError:
            LOG.exception(_("Failed while unplugging vif"), instance=instance)
Ejemplo n.º 8
0
def _post_unplug_wiring_delete_veth(instance, vif):
    """Wire/plug the virtual interface for the instance into the bridge that
    lxd is using.

    :param instance: the instance to plug into the bridge
    :type instance: ???
    :param vif: the virtual interface to plug into the bridge
    :type vif: :class:`nova.network.model.VIF`
    """
    v1_name = get_vif_devname(vif)
    try:
        if _is_ovs_vif_port(vif):
            linux_net.delete_ovs_vif_port(vif['network']['bridge'], v1_name,
                                          True)
        else:
            network_utils.delete_net_dev(v1_name)
    except processutils.ProcessExecutionError:
        LOG.exception("Failed to delete veth for vif {}".foramt(vif),
                      instance=instance)
Ejemplo n.º 9
0
def _create_veth_pair(dev1_name, dev2_name, mtu=None):
    """Create a pair of veth devices with the specified names,
    deleting any previous devices with those names.
    """
    for dev in [dev1_name, dev2_name]:
        network_utils.delete_net_dev(dev)

    utils.execute('ip',
                  'link',
                  'add',
                  dev1_name,
                  'type',
                  'veth',
                  'peer',
                  'name',
                  dev2_name,
                  run_as_root=True)

    for dev in [dev1_name, dev2_name]:
        utils.execute('ip', 'link', 'set', dev, 'up', run_as_root=True)
        network_utils.set_device_mtu(dev, mtu)