mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-06 12:58:18 +03:00
F #6025: Simplify DPDK Management
* BRIDGE_TYPE can be updated after creating a network to set openvswitch_dpdk. This way DPDK and none DPDK datapath bridges can coexist. * When bridge_type is openvswtich_dpdk datapath_type=netdev is automatically added to the bridge. No need to change other configuration files. * Better port detection for dpdk switches
This commit is contained in:
parent
4e20e962b7
commit
f6799825f8
@ -377,7 +377,7 @@ error_common:
|
||||
|
||||
int VirtualNetwork::post_update_template(string& error)
|
||||
{
|
||||
string new_bridge;
|
||||
string new_bridge, new_br_type;
|
||||
string sg_str;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
@ -386,6 +386,7 @@ int VirtualNetwork::post_update_template(string& error)
|
||||
/* - PHYDEV */
|
||||
/* - VLAN_ID */
|
||||
/* - BRIDGE */
|
||||
/* - BRIDGE_TYPE */
|
||||
/* - SECURITY_GROUPS */
|
||||
/* ---------------------------------------------------------------------- */
|
||||
erase_template_attribute("VN_MAD", vn_mad);
|
||||
@ -429,6 +430,15 @@ int VirtualNetwork::post_update_template(string& error)
|
||||
|
||||
add_template_attribute("BRIDGE", bridge);
|
||||
|
||||
erase_template_attribute("BRIDGE_TYPE", new_br_type);
|
||||
|
||||
if (str_to_bridge_type(new_br_type) != UNDEFINED)
|
||||
{
|
||||
bridge_type = new_br_type;
|
||||
}
|
||||
|
||||
add_template_attribute("BRIDGE_TYPE", bridge_type);
|
||||
|
||||
security_groups.clear();
|
||||
|
||||
obj_template->get("SECURITY_GROUPS", sg_str);
|
||||
|
@ -104,8 +104,6 @@
|
||||
#
|
||||
# :ovs_bridge_conf:
|
||||
# :stp_enable: true
|
||||
# :datapath_type: netdev
|
||||
|
||||
|
||||
# These options will be added to the ip link add command. For example:
|
||||
#
|
||||
|
@ -79,16 +79,22 @@ module VNMMAD
|
||||
# devices/interface[@type='bridge']/mac[@address='<mac>']/../target"
|
||||
def get_tap(vm)
|
||||
dumpxml = vm.vm_info[:dumpxml]
|
||||
bxpath = "devices/interface[@type='bridge' or @type='vhostuser']/" \
|
||||
"mac[@address='#{self[:mac]}']/../"
|
||||
|
||||
return self unless dumpxml
|
||||
|
||||
if dumpxml
|
||||
dumpxml_root = REXML::Document.new(dumpxml).root
|
||||
|
||||
xpath = "devices/interface[@type='bridge' or @type='vhostuser']/" \
|
||||
"mac[@address='#{self[:mac]}']/../target"
|
||||
|
||||
tap = dumpxml_root.elements[xpath]
|
||||
tap = dumpxml_root.elements["#{bxpath}target"]
|
||||
|
||||
self[:tap] = tap.attributes['dev'] if tap
|
||||
|
||||
# DPDK interfaces (post phase) only have source not target
|
||||
if !self[:tap] || self[:tap].empty?
|
||||
source = dumpxml_root.elements["#{bxpath}source"]
|
||||
|
||||
self[:tap] = File.basename(source.attributes['path']) if source
|
||||
end
|
||||
|
||||
self
|
||||
|
@ -538,6 +538,11 @@ class OpenvSwitchVLAN < VNMMAD::VNMDriver
|
||||
def create_bridge
|
||||
return if @bridges.keys.include? @nic[:bridge]
|
||||
|
||||
if @nic[:bridge_type] == 'openvswitch_dpdk'
|
||||
@nic[:ovs_bridge_conf] = {} unless @nic[:ovs_bridge_conf]
|
||||
@nic[:ovs_bridge_conf]['datapath_type'] = 'netdev'
|
||||
end
|
||||
|
||||
OpenNebula.exec_and_log("#{command(:ovs_vsctl)} --may-exist add-br #{@nic[:bridge]}")
|
||||
|
||||
set_bridge_options
|
||||
|
Loading…
x
Reference in New Issue
Block a user