Пример #1
0
 def unplug_hw_veb(self, instance, vif):
     # TODO(vladikr): This code can be removed once the minimum version of
     # Libvirt is incleased above 1.3.5, as vlan will be set by libvirt
     if vif['vnic_type'] == network_model.VNIC_TYPE_MACVTAP:
         # The ip utility doesn't accept the MAC 00:00:00:00:00:00.
         # Therefore, keep the MAC unchanged.  Later operations on
         # the same VF will not be affected by the existing MAC.
         linux_net_utils.set_vf_interface_vlan(vif['profile']['pci_slot'],
                                         mac_addr=vif['address'])
     elif vif['vnic_type'] == network_model.VNIC_TYPE_DIRECT:
         if "trusted" in vif['profile']:
             linux_net.set_vf_trusted(vif['profile']['pci_slot'], False)
Пример #2
0
 def unplug_hw_veb(self, instance, vif):
     # TODO(vladikr): This code can be removed once the minimum version of
     # Libvirt is incleased above 1.3.5, as vlan will be set by libvirt
     if vif['vnic_type'] == network_model.VNIC_TYPE_MACVTAP:
         # The ip utility doesn't accept the MAC 00:00:00:00:00:00.
         # Therefore, keep the MAC unchanged.  Later operations on
         # the same VF will not be affected by the existing MAC.
         linux_net_utils.set_vf_interface_vlan(vif['profile']['pci_slot'],
                                         mac_addr=vif['address'])
     elif vif['vnic_type'] == network_model.VNIC_TYPE_DIRECT:
         if "trusted" in vif['profile']:
             linux_net.set_vf_trusted(vif['profile']['pci_slot'], False)
Пример #3
0
    def plug_hw_veb(self, instance, vif):
        # TODO(vladikr): This code can be removed once the minimum version of
        # Libvirt is incleased above 1.3.5, as vlan will be set by libvirt
        if vif['vnic_type'] == network_model.VNIC_TYPE_MACVTAP:
            linux_net_utils.set_vf_interface_vlan(
                vif['profile']['pci_slot'],
                mac_addr=vif['address'],
                vlan=vif['details'][network_model.VIF_DETAILS_VLAN])

        elif vif['vnic_type'] == network_model.VNIC_TYPE_DIRECT:
            trusted = strutils.bool_from_string(
                vif['profile'].get('trusted', "False"))
            if trusted:
                linux_net.set_vf_trusted(vif['profile']['pci_slot'], True)
Пример #4
0
    def plug_hw_veb(self, instance, vif):
        # TODO(vladikr): This code can be removed once the minimum version of
        # Libvirt is incleased above 1.3.5, as vlan will be set by libvirt
        if vif['vnic_type'] == network_model.VNIC_TYPE_MACVTAP:
            linux_net_utils.set_vf_interface_vlan(
                vif['profile']['pci_slot'],
                mac_addr=vif['address'],
                vlan=vif['details'][network_model.VIF_DETAILS_VLAN])

        elif vif['vnic_type'] == network_model.VNIC_TYPE_DIRECT:
            trusted = strutils.bool_from_string(
                vif['profile'].get('trusted', "False"))
            if trusted:
                linux_net.set_vf_trusted(vif['profile']['pci_slot'], True)
Пример #5
0
 def unplug_hw_veb(self, instance, vif):
     # TODO(sean-k-mooney): remove in Train after backporting 0 mac
     # change as this should no longer be needed with libvirt >= 3.2.0.
     if vif['vnic_type'] == network_model.VNIC_TYPE_MACVTAP:
         # NOTE(sean-k-mooney): Retaining the vm mac on the vf
         # after unplugging the vif prevents the PF from transmitting
         # a packet with that destination address. This would create a
         # a network partition in the event a vm is migrated or the neuton
         # port is reused for another vm before the VF is reused.
         # The ip utility accepts the MAC 00:00:00:00:00:00 which can
         # be used to reset the VF mac when no longer in use by a vm.
         # As such we hardcode the 00:00:00:00:00:00 mac.
         set_vf_interface_vlan(vif['profile']['pci_slot'],
                               mac_addr='00:00:00:00:00:00')
     elif vif['vnic_type'] == network_model.VNIC_TYPE_DIRECT:
         if "trusted" in vif['profile']:
             linux_net.set_vf_trusted(vif['profile']['pci_slot'], False)
Пример #6
0
 def unplug_hw_veb(self, instance, vif):
     # TODO(sean-k-mooney): remove in Train after backporting 0 mac
     # change as this should no longer be needed with libvirt >= 3.2.0.
     if vif['vnic_type'] == network_model.VNIC_TYPE_MACVTAP:
         # NOTE(sean-k-mooney): Retaining the vm mac on the vf
         # after unplugging the vif prevents the PF from transmitting
         # a packet with that destination address. This would create a
         # a network partition in the event a vm is migrated or the neuton
         # port is reused for another vm before the VF is reused.
         # The ip utility accepts the MAC 00:00:00:00:00:00 which can
         # be used to reset the VF mac when no longer in use by a vm.
         # As such we hardcode the 00:00:00:00:00:00 mac.
         linux_net_utils.set_vf_interface_vlan(vif['profile']['pci_slot'],
                                               mac_addr='00:00:00:00:00:00')
     elif vif['vnic_type'] == network_model.VNIC_TYPE_DIRECT:
         if "trusted" in vif['profile']:
             linux_net.set_vf_trusted(vif['profile']['pci_slot'], False)
Пример #7
0
    def plug_hw_veb(self, instance, vif):
        # TODO(adrianc): The piece of code for MACVTAP can be removed once:
        #  1. neutron SR-IOV agent does not rely on the administrative mac
        #     as depicted in https://bugs.launchpad.net/neutron/+bug/1841067
        #  2. libvirt driver does not change mac address for macvtap VNICs
        #     or Alternatively does not rely on recreating libvirt's nodev
        #     name from the current mac address set on the netdevice.
        #     See: virt.libvrit.driver.LibvirtDriver._get_pcinet_info
        if vif['vnic_type'] == network_model.VNIC_TYPE_MACVTAP:
            set_vf_interface_vlan(
                vif['profile']['pci_slot'],
                mac_addr=vif['address'],
                vlan=vif['details'][network_model.VIF_DETAILS_VLAN])

        elif vif['vnic_type'] == network_model.VNIC_TYPE_DIRECT:
            trusted = strutils.bool_from_string(vif['profile'].get(
                'trusted', "False"))
            if trusted:
                linux_net.set_vf_trusted(vif['profile']['pci_slot'], True)
Пример #8
0
 def plug_hw_veb(self, instance, vif):
     if vif['vnic_type'] == network_model.VNIC_TYPE_DIRECT:
         trusted = strutils.bool_from_string(vif['profile'].get(
             'trusted', "False"))
         if trusted:
             linux_net.set_vf_trusted(vif['profile']['pci_slot'], True)