From a90c0f52bbd8277374f76ac5b81c385da0896fe4 Mon Sep 17 00:00:00 2001 From: marvin Date: Thu, 11 Jul 2019 19:36:22 +0800 Subject: [PATCH] Enable data interface if vswitch is unaccelerated starlingx will by-pass data interfaces configuration by default, and this will cause issues such as fail to set the IP for data interfaces when vswitch type is VSWITCH_TYPE_NONE. this patch checks if the vswitch type is VSWITCH_TYPE_NONE,and if so, permit it to generate a static configuration for interfaces with an ifclass of INTERFACE_CLASS_DATA which will allow puppet to configure the data interface after host unlock. Change-Id: I66d8c7750a68b319bbfec2dcaa5d09aea41fa864 Closes-bug: #1832697 Signed-off-by: marvin --- .../sysinv/sysinv/sysinv/puppet/interface.py | 28 +++++++++++++++---- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/sysinv/sysinv/sysinv/sysinv/puppet/interface.py b/sysinv/sysinv/sysinv/sysinv/puppet/interface.py index 86c7fc1e3a..4ee5a71c18 100644 --- a/sysinv/sysinv/sysinv/sysinv/puppet/interface.py +++ b/sysinv/sysinv/sysinv/sysinv/puppet/interface.py @@ -134,6 +134,7 @@ class InterfacePuppet(base.BasePuppet): 'gateways': self._get_gateway_index(), 'floatingips': self._get_floating_ip_index(), 'datanets': self._get_datanetworks(host), + 'vswitchtype': self._vswitch_type(), } return context @@ -314,6 +315,15 @@ def is_worker_subfunction(context): return False +def is_vswitch_type_unaccelerated(context): + """ + Determine if the underlying device vswitch type is unaccelerated. + """ + if context['vswitchtype'] == constants.VSWITCH_TYPE_NONE: + return True + return False + + def is_pci_interface(iface): """ Determine if the interface is one of the PCI device types. @@ -615,17 +625,19 @@ def get_interface_address_method(context, iface, network_id=None): """ networktype = find_networktype_by_network_id(context, network_id) - if not iface.ifclass or iface.ifclass == constants.INTERFACE_CLASS_NONE \ + if iface.ifclass == constants.INTERFACE_CLASS_DATA: + if is_vswitch_type_unaccelerated(context): + return STATIC_METHOD + # All data interfaces configured in the kernel because they are not + # natively supported in vswitch or need to be shared with the kernel + # because of a platform VLAN should be left as manual config + return MANUAL_METHOD + elif not iface.ifclass or iface.ifclass == constants.INTERFACE_CLASS_NONE \ or not networktype: # Interfaces that are configured purely as a dependency from other # interfaces (i.e., vlan lower interface, bridge member, bond slave) # should be left as manual config return MANUAL_METHOD - elif iface.ifclass == constants.INTERFACE_CLASS_DATA: - # All data interfaces configured in the kernel because they are not - # natively supported in vswitch or need to be shared with the kernel - # because of a platform VLAN should be left as manual config - return MANUAL_METHOD elif iface.ifclass in PCI_INTERFACE_CLASSES: return MANUAL_METHOD else: @@ -704,6 +716,10 @@ def needs_interface_config(context, iface): elif not is_worker_subfunction(context): return False elif is_data_interface(context, iface): + if is_vswitch_type_unaccelerated(context): + # a platform interface configuration will use the host interface when + # the vswitch is unaccelerated. + return True if not is_dpdk_compatible(context, iface): # vswitch interfaces for devices that are not natively supported by # the DPDK are created as regular Linux devices and then bridged in