mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-23 22:50:09 +03:00
Feature #3848: Virtual networks should have an associated networking driver.
(cherry picked from commit 7e90463693ef6639bd4f15f5b6f5079664f6a1e2) This cherry still needs to merge files from original contribution by goberle <goberle@unistra.fr>: - src/sunstone/public/app/tabs/vnets-tab/form-panels/wizard.hbs
This commit is contained in:
parent
c6076a173a
commit
9de771ea31
@ -457,6 +457,11 @@ private:
|
||||
// Binded physical attributes
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Name of the vn mad
|
||||
*/
|
||||
string vn_mad;
|
||||
|
||||
/**
|
||||
* Name of the bridge this VNW binds to
|
||||
*/
|
||||
|
@ -886,11 +886,13 @@ IMAGE_RESTRICTED_ATTR = "SOURCE"
|
||||
# Normal VNets do not have restricted attributes.
|
||||
#*******************************************************************************
|
||||
|
||||
VNET_RESTRICTED_ATTR = "VN_MAD"
|
||||
VNET_RESTRICTED_ATTR = "PHYDEV"
|
||||
VNET_RESTRICTED_ATTR = "VLAN_ID"
|
||||
VNET_RESTRICTED_ATTR = "VLAN"
|
||||
VNET_RESTRICTED_ATTR = "BRIDGE"
|
||||
|
||||
VNET_RESTRICTED_ATTR = "AR/VN_MAD"
|
||||
VNET_RESTRICTED_ATTR = "AR/PHYDEV"
|
||||
VNET_RESTRICTED_ATTR = "AR/VLAN_ID"
|
||||
VNET_RESTRICTED_ATTR = "AR/VLAN"
|
||||
|
@ -61,12 +61,13 @@ module DriverExecHelper
|
||||
# @param [String, Symbol] action name of the action
|
||||
# @param [String] parameters arguments for the script
|
||||
# @param [String, nil] default_name alternative name for the script
|
||||
# @param [String, ''] subdirectory of the action
|
||||
# @return [String] command line needed to execute the action
|
||||
def action_command_line(action, parameters, default_name=nil)
|
||||
def action_command_line(action, parameters, default_name=nil, subdirectory='')
|
||||
if action_is_local? action
|
||||
script_path=@local_scripts_path
|
||||
script_path=File.join(@local_scripts_path, subdirectory)
|
||||
else
|
||||
script_path=@remote_scripts_path
|
||||
script_path=File.join(@remote_scripts_path, subdirectory)
|
||||
end
|
||||
|
||||
File.join(script_path, action_script_name(action, default_name))+
|
||||
|
@ -142,11 +142,21 @@ define(function(require) {
|
||||
|
||||
$("#vnetCreateARTab #vnetCreateARTabUpdate", context).hide();
|
||||
|
||||
$('#vn_mad_from_host', context).change(function() {
|
||||
if ($(this).prop('checked')) {
|
||||
$('select#network_mode,label[for="network_mode"]', context).prop('wizard_field_disabled', true);
|
||||
} else {
|
||||
$('select#network_mode,label[for="network_mode"]', context).prop('wizard_field_disabled', false);
|
||||
}
|
||||
});
|
||||
|
||||
$('#network_mode', context).change(function() {
|
||||
$('input,select#vlan,label[for!="network_mode"]', $(this).parent()).hide();
|
||||
$('input', $(this).parent()).val("");
|
||||
switch ($(this).val()) {
|
||||
case "default":
|
||||
$('input#vn_mad_from_host,label[for="vn_mad_from_host"]', context).show();
|
||||
$('input#vn_mad,label[for="vn_mad"]', context).hide().prop('wizard_field_disabled', true);
|
||||
$('input#bridge,label[for="bridge"]', context).show().prop('wizard_field_disabled', false);
|
||||
$('input#phydev,label[for="phydev"]', context).hide().prop('wizard_field_disabled', true);
|
||||
$('select#vlan,label[for="vlan"]', context).hide().prop('wizard_field_disabled', true);
|
||||
@ -157,8 +167,11 @@ define(function(require) {
|
||||
|
||||
$('input#phydev', context).removeAttr('required');
|
||||
$('input#bridge', context).attr('required', '');
|
||||
$('input#vn_mad', context).removeAttr('required');
|
||||
break;
|
||||
case "802.1Q":
|
||||
$('input#vn_mad_from_host,label[for="vn_mad_from_host"]', context).show();
|
||||
$('input#vn_mad,label[for="vn_mad"]', context).hide().prop('wizard_field_disabled', true);
|
||||
$('input#bridge,label[for="bridge"]', context).show().prop('wizard_field_disabled', false);
|
||||
$('input#phydev,label[for="phydev"]', context).show().prop('wizard_field_disabled', false);
|
||||
$('select#vlan,label[for="vlan"]', context).show().prop('wizard_field_disabled', false);
|
||||
@ -169,8 +182,11 @@ define(function(require) {
|
||||
|
||||
$('input#phydev', context).removeAttr('required');
|
||||
$('input#bridge', context).removeAttr('required');
|
||||
$('input#vn_mad', context).removeAttr('required');
|
||||
break;
|
||||
case "vxlan":
|
||||
$('input#vn_mad_from_host,label[for="vn_mad_from_host"]', context).show();
|
||||
$('input#vn_mad,label[for="vn_mad"]', context).hide().prop('wizard_field_disabled', true);
|
||||
$('input#bridge,label[for="bridge"]', context).show().prop('wizard_field_disabled', false);
|
||||
$('input#phydev,label[for="phydev"]', context).show().prop('wizard_field_disabled', false);
|
||||
$('select#vlan,label[for="vlan"]', context).show().prop('wizard_field_disabled', false);
|
||||
@ -181,8 +197,11 @@ define(function(require) {
|
||||
|
||||
$('input#phydev', context).removeAttr('required');
|
||||
$('input#bridge', context).removeAttr('required');
|
||||
$('input#vn_mad', context).removeAttr('required');
|
||||
break;
|
||||
case "ebtables":
|
||||
$('input#vn_mad_from_host,label[for="vn_mad_from_host"]', context).show();
|
||||
$('input#vn_mad,label[for="vn_mad"]', context).hide().prop('wizard_field_disabled', true);
|
||||
$('input#bridge,label[for="bridge"]', context).show().prop('wizard_field_disabled', false);
|
||||
$('input#phydev,label[for="phydev"]', context).hide().prop('wizard_field_disabled', true);
|
||||
$('select#vlan,label[for="vlan"]', context).show().prop('wizard_field_disabled', false);
|
||||
@ -193,8 +212,11 @@ define(function(require) {
|
||||
|
||||
$('input#phydev', context).removeAttr('required');
|
||||
$('input#bridge', context).attr('required', '');
|
||||
$('input#vn_mad', context).removeAttr('required');
|
||||
break;
|
||||
case "openvswitch":
|
||||
$('input#vn_mad_from_host,label[for="vn_mad_from_host"]', context).show();
|
||||
$('input#vn_mad,label[for="vn_mad"]', context).hide().prop('wizard_field_disabled', true);
|
||||
$('input#bridge,label[for="bridge"]', context).show().prop('wizard_field_disabled', false);
|
||||
$('input#phydev,label[for="phydev"]', context).hide().prop('wizard_field_disabled', true);
|
||||
$('select#vlan,label[for="vlan"]', context).show().prop('wizard_field_disabled', false);
|
||||
@ -205,8 +227,11 @@ define(function(require) {
|
||||
|
||||
$('input#phydev', context).removeAttr('required');
|
||||
$('input#bridge', context).attr('required', '');
|
||||
$('input#vn_mad', context).removeAttr('required');
|
||||
break;
|
||||
case "vmware":
|
||||
$('input#vn_mad_from_host,label[for="vn_mad_from_host"]', context).show();
|
||||
$('input#vn_mad,label[for="vn_mad"]', context).hide().prop('wizard_field_disabled', true);
|
||||
$('input#bridge,label[for="bridge"]', context).show();
|
||||
$('input#phydev,label[for="phydev"]', context).hide();
|
||||
$('select#vlan,label[for="vlan"]', context).show();
|
||||
@ -217,6 +242,22 @@ define(function(require) {
|
||||
|
||||
$('input#phydev', context).removeAttr('required');
|
||||
$('input#bridge', context).attr('required', '');
|
||||
$('input#vn_mad', context).removeAttr('required');
|
||||
break;
|
||||
case "custom":
|
||||
$('input#vn_mad_from_host,label[for="vn_mad_from_host"]', context).hide();
|
||||
$('input#vn_mad,label[for="vn_mad"]', context).show().prop('wizard_field_disabled', false);
|
||||
$('input#bridge,label[for="bridge"]', context).show().prop('wizard_field_disabled', false);
|
||||
$('input#phydev,label[for="phydev"]', context).show().prop('wizard_field_disabled', false);
|
||||
$('select#vlan,label[for="vlan"]', context).show().prop('wizard_field_disabled', false);
|
||||
$('input#vlan_id,label[for="vlan_id"]', context).show().prop('wizard_field_disabled', false);
|
||||
$('input#ip_spoofing,label[for="ip_spoofing"]', context).show().prop('wizard_field_disabled', false);
|
||||
$('input#mac_spoofing,label[for="mac_spoofing"]', context).show().prop('wizard_field_disabled', false);
|
||||
$('input#mtu,label[for="mtu"]', context).show().prop('wizard_field_disabled', false);
|
||||
|
||||
$('input#phydev', context).removeAttr('required');
|
||||
$('input#bridge', context).removeAttr('required');
|
||||
$('input#vn_mad', context).attr('required', '');
|
||||
break;
|
||||
}
|
||||
|
||||
@ -353,6 +394,8 @@ define(function(require) {
|
||||
|
||||
// Show all network mode inputs, and make them not required. This will change
|
||||
// if a different network model is selected
|
||||
$('input#vn_mad_from_host,label[for="vn_mad_from_host"]', context).show();
|
||||
$('input#vn_mad,label[for="vn_mad"]', context).show().prop('wizard_field_disabled', false).removeAttr('required');
|
||||
$('input#bridge,label[for="bridge"]', context).show().prop('wizard_field_disabled', false).removeAttr('required');
|
||||
$('input#phydev,label[for="phydev"]', context).show().prop('wizard_field_disabled', false).removeAttr('required');
|
||||
$('select#vlan,label[for="vlan"]', context).show().prop('wizard_field_disabled', false).removeAttr('required');
|
||||
|
@ -46,7 +46,6 @@ class VmmAction
|
||||
# List of xpaths required by the VNM driver actions
|
||||
XPATH_LIST = %w(
|
||||
ID DEPLOY_ID
|
||||
TEMPLATE/NIC
|
||||
TEMPLATE/SECURITY_GROUP_RULE
|
||||
HISTORY_RECORDS/HISTORY/HOSTNAME
|
||||
)
|
||||
@ -89,33 +88,59 @@ class VmmAction
|
||||
@data[:vm] = Base64.encode64(vm_template).delete("\n")
|
||||
|
||||
# VM data for VNM
|
||||
vm_template_xml = REXML::Document.new(vm_template).root
|
||||
vm_vnm_xml = REXML::Document.new('<VM></VM>').root
|
||||
|
||||
XPATH_LIST.each do |xpath|
|
||||
elements = vm_template_xml.elements.each(xpath) do |element|
|
||||
add_element_to_path(vm_vnm_xml, element, xpath)
|
||||
end
|
||||
end
|
||||
vnm_src_drivers, vm_vnm_src_xml = prepare_vnm_drivers_xml(vm_template, @data[:net_drv])
|
||||
|
||||
# Initialize streams and vnm
|
||||
@ssh_src = @vmm.get_ssh_stream(action, @data[:host], @id)
|
||||
@vnm_src = VirtualNetworkDriver.new(@data[:net_drv],
|
||||
@vnm_src = VirtualNetworkDriver.new(vnm_src_drivers,
|
||||
:local_actions => @vmm.options[:local_actions],
|
||||
:message => vm_vnm_xml.to_s,
|
||||
:message => vm_vnm_src_xml.to_s,
|
||||
:ssh_stream => @ssh_src)
|
||||
|
||||
if @data[:dest_host] and !@data[:dest_host].empty?
|
||||
vnm_dst_drivers, vm_vnm_dst_xml = prepare_vnm_drivers_xml(vm_template, @data[:dest_driver])
|
||||
|
||||
@ssh_dst = @vmm.get_ssh_stream(action, @data[:dest_host], @id)
|
||||
@vnm_dst = VirtualNetworkDriver.new(@data[:dest_driver],
|
||||
@vnm_dst = VirtualNetworkDriver.new(vnm_dst_drivers,
|
||||
:local_actions => @vmm.options[:local_actions],
|
||||
:message => vm_vnm_xml.to_s,
|
||||
:message => vm_vnm_dst_xml.to_s,
|
||||
:ssh_stream => @ssh_dst)
|
||||
end
|
||||
|
||||
@tm = TransferManagerDriver.new(nil)
|
||||
end
|
||||
|
||||
#Prepares the list of drivers executed on the host and the xml that will be sent to the network drivers
|
||||
# @param[String] The template of the VM.
|
||||
# @param[String] The host networking driver.
|
||||
# @return[Array] Returns a list of network drivers and the associated xml template.
|
||||
def prepare_vnm_drivers_xml(vm_template, host_vn_driver)
|
||||
vm_template_xml = REXML::Document.new(vm_template).root
|
||||
vm_vnm_xml = REXML::Document.new('<VM></VM>').root
|
||||
vnm_drivers = []
|
||||
|
||||
XPATH_LIST.each do |xpath|
|
||||
vm_template_xml.elements.each(xpath) do |element|
|
||||
add_element_to_path(vm_vnm_xml, element, xpath)
|
||||
end
|
||||
end
|
||||
|
||||
vm_template_xml.elements.each("TEMPLATE/NIC") do |element|
|
||||
vn_mad = element.get_text("VN_MAD").to_s
|
||||
|
||||
if vn_mad.empty?
|
||||
vn_mad = host_vn_driver
|
||||
e = element.add_element("VN_MAD")
|
||||
e.add_text(REXML::CData.new(vn_mad))
|
||||
end
|
||||
|
||||
vnm_drivers << vn_mad unless vnm_drivers.include?(vn_mad)
|
||||
add_element_to_path(vm_vnm_xml, element, "TEMPLATE/NIC")
|
||||
end
|
||||
|
||||
return vnm_drivers, vm_vnm_xml
|
||||
end
|
||||
|
||||
#Execute a set of steps defined with
|
||||
# - :driver :vmm or :vnm to execute the step
|
||||
# - :action for the step
|
||||
|
@ -814,11 +814,17 @@ void AddressRange::set_vnet(VectorAttribute *nic, const vector<string> &inherit)
|
||||
{
|
||||
nic->replace("AR_ID", id);
|
||||
|
||||
string vn_mad = attr->vector_value("VN_MAD");
|
||||
string bridge = attr->vector_value("BRIDGE");
|
||||
string vlan = attr->vector_value("VLAN");
|
||||
string vlanid = attr->vector_value("VLAN_ID");
|
||||
string phydev = attr->vector_value("PHYDEV");
|
||||
|
||||
if (!vn_mad.empty())
|
||||
{
|
||||
nic->replace("VN_MAD", vn_mad);
|
||||
}
|
||||
|
||||
if (!bridge.empty())
|
||||
{
|
||||
nic->replace("BRIDGE", bridge);
|
||||
|
@ -124,6 +124,12 @@ int VirtualNetwork::insert(SqlDB * db, string& error_str)
|
||||
goto error_name;
|
||||
}
|
||||
|
||||
// ------------ VN_MAD --------------------
|
||||
|
||||
erase_template_attribute("VN_MAD", vn_mad);
|
||||
|
||||
add_template_attribute("VN_MAD", vn_mad);
|
||||
|
||||
// ------------ PHYDEV --------------------
|
||||
|
||||
erase_template_attribute("PHYDEV", phydev);
|
||||
@ -262,12 +268,17 @@ int VirtualNetwork::post_update_template(string& error)
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
/* Update Configuration Attributes (class & template) */
|
||||
/* - VN_MAD */
|
||||
/* - PHYDEV */
|
||||
/* - VLAN_ID */
|
||||
/* - VLAN */
|
||||
/* - BRIDGE */
|
||||
/* - SECURITY_GROUPS */
|
||||
/* ---------------------------------------------------------------------- */
|
||||
erase_template_attribute("VN_MAD", vn_mad);
|
||||
|
||||
add_template_attribute("VN_MAD", vn_mad);
|
||||
|
||||
erase_template_attribute("PHYDEV", phydev);
|
||||
|
||||
add_template_attribute("PHYDEV", phydev);
|
||||
@ -446,6 +457,15 @@ string& VirtualNetwork::to_xml_extended(string& xml, bool extended,
|
||||
os << "<PARENT_NETWORK_ID/>";
|
||||
}
|
||||
|
||||
if (!vn_mad.empty())
|
||||
{
|
||||
os << "<VN_MAD><![CDATA[" << vn_mad << "]]></VN_MAD>";
|
||||
}
|
||||
else
|
||||
{
|
||||
os << "<VN_MAD/>";
|
||||
}
|
||||
|
||||
if (!phydev.empty())
|
||||
{
|
||||
os << "<PHYDEV>" << one_util::escape_xml(phydev) << "</PHYDEV>";
|
||||
@ -503,6 +523,7 @@ int VirtualNetwork::from_xml(const string &xml_str)
|
||||
// Permissions
|
||||
rc += perms_from_xml();
|
||||
|
||||
xpath(vn_mad, "/VNET/VN_MAD", "");
|
||||
xpath(phydev, "/VNET/PHYDEV", "");
|
||||
xpath(vlan_id,"/VNET/VLAN_ID","");
|
||||
xpath(parent_vid,"/VNET/PARENT_NETWORK_ID",-1);
|
||||
@ -589,6 +610,11 @@ int VirtualNetwork::nic_attribute(
|
||||
nic->replace("VLAN", "NO");
|
||||
}
|
||||
|
||||
if (!vn_mad.empty())
|
||||
{
|
||||
nic->replace("VN_MAD", vn_mad);
|
||||
}
|
||||
|
||||
if (!phydev.empty())
|
||||
{
|
||||
nic->replace("PHYDEV", phydev);
|
||||
|
@ -26,15 +26,16 @@ class VirtualNetworkDriver
|
||||
# @param [String] name of the vnet driver to use, as listed in remotes/vnet
|
||||
# @option ops [String] :ssh_stream to be used for command execution
|
||||
# @option ops [String] :message from ONE
|
||||
def initialize(directory, options={})
|
||||
def initialize(vnm_drivers, options={})
|
||||
@vnm_drivers = vnm_drivers
|
||||
|
||||
@options = options
|
||||
@ssh_stream = options[:ssh_stream]
|
||||
@message = options[:message]
|
||||
@options = options
|
||||
@ssh_stream = options[:ssh_stream]
|
||||
@message = options[:message]
|
||||
|
||||
@vm_encoded = Base64.encode64(@message).delete("\n")
|
||||
@vm_encoded = Base64.encode64(@message).delete("\n")
|
||||
|
||||
initialize_helper("vnm/#{directory}", options)
|
||||
initialize_helper("vnm", options)
|
||||
end
|
||||
|
||||
# Calls remotes or local action checking the action name and
|
||||
@ -54,24 +55,34 @@ class VirtualNetworkDriver
|
||||
cmd_params = "#{@vm_encoded}"
|
||||
cmd_params << " #{options[:parameters]}" if options[:parameters]
|
||||
|
||||
cmd = action_command_line(aname, cmd_params)
|
||||
result = RESULT[:success]
|
||||
infos = ""
|
||||
|
||||
if action_is_local?(aname)
|
||||
execution = LocalCommand.run(cmd, log_method(id))
|
||||
elsif @ssh_stream != nil
|
||||
if options[:stdin]
|
||||
cmdin = "cat << EOT | #{cmd}"
|
||||
stdin = "#{options[:stdin]}\nEOT\n"
|
||||
@vnm_drivers.each do |subdirectory|
|
||||
cmd = action_command_line(aname, cmd_params, nil, subdirectory)
|
||||
|
||||
if action_is_local?(aname)
|
||||
execution = LocalCommand.run(cmd, log_method(id))
|
||||
elsif @ssh_stream != nil
|
||||
if options[:stdin]
|
||||
cmdin = "cat << EOT | #{cmd}"
|
||||
stdin = "#{options[:stdin]}\nEOT\n"
|
||||
else
|
||||
cmdin = cmd
|
||||
stdin = nil
|
||||
end
|
||||
|
||||
execution = @ssh_stream.run(cmdin, stdin, cmd)
|
||||
else
|
||||
cmdin = cmd
|
||||
stdin = nil
|
||||
return RESULT[:failure], "Network action #{aname} needs a ssh stream."
|
||||
end
|
||||
|
||||
execution = @ssh_stream.run(cmdin, stdin, cmd)
|
||||
else
|
||||
return RESULT[:failure], "Network action #{aname} needs a ssh stream."
|
||||
result, info = get_info_from_execution(execution)
|
||||
infos <<= info
|
||||
|
||||
return [result, infos] if DriverExecHelper.failed?(result)
|
||||
end
|
||||
|
||||
return get_info_from_execution(execution)
|
||||
return [result, infos]
|
||||
end
|
||||
end
|
||||
|
@ -19,15 +19,20 @@
|
||||
$: << File.dirname(__FILE__)
|
||||
$: << File.join(File.dirname(__FILE__), "..")
|
||||
|
||||
require 'vnmmad'
|
||||
require 'vlan_tag_driver'
|
||||
|
||||
template64 = ARGV[0]
|
||||
template64 = ARGV[0]
|
||||
deploy_id = nil
|
||||
hypervisor = nil
|
||||
xpath_filter = VLANTagDriver::XPATH_FILTER
|
||||
|
||||
begin
|
||||
hm = VLANTagDriver.from_base64(template64)
|
||||
hm.deactivate
|
||||
filter_driver = VNMMAD::VNMDriver.filter_driver(template64)
|
||||
filter_driver = VNMMAD::VNMDriver.filter_driver(template64,
|
||||
deploy_id,
|
||||
hypervisor,
|
||||
xpath_filter)
|
||||
filter_driver.deactivate
|
||||
rescue Exception => e
|
||||
OpenNebula.log_error(e.message)
|
||||
|
@ -1 +0,0 @@
|
||||
../fw/post
|
39
src/vnm_mad/remotes/802.1Q/post
Executable file
39
src/vnm_mad/remotes/802.1Q/post
Executable file
@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
# -------------------------------------------------------------------------- #
|
||||
# Copyright 2002-2015, OpenNebula Project (OpenNebula.org), C12G Labs #
|
||||
# #
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
||||
# not use this file except in compliance with the License. You may obtain #
|
||||
# a copy of the License at #
|
||||
# #
|
||||
# http://www.apache.org/licenses/LICENSE-2.0 #
|
||||
# #
|
||||
# Unless required by applicable law or agreed to in writing, software #
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, #
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
||||
# See the License for the specific language governing permissions and #
|
||||
# limitations under the License. #
|
||||
#--------------------------------------------------------------------------- #
|
||||
|
||||
$: << File.dirname(__FILE__)
|
||||
$: << File.join(File.dirname(__FILE__), "..")
|
||||
|
||||
require 'vlan_tag_driver'
|
||||
|
||||
template64 = ARGV[0]
|
||||
deploy_id = ARGV[1]
|
||||
hypervisor = nil
|
||||
xpath_filter = VLANTagDriver::XPATH_FILTER
|
||||
|
||||
begin
|
||||
filter_driver = VNMMAD::VNMDriver.filter_driver(template64,
|
||||
deploy_id,
|
||||
hypervisor,
|
||||
xpath_filter)
|
||||
filter_driver.activate
|
||||
rescue Exception => e
|
||||
OpenNebula.log_error(e.message)
|
||||
OpenNebula.log_error(e.backtrace)
|
||||
exit 1
|
||||
end
|
@ -27,7 +27,7 @@ class VLANTagDriver < VNMMAD::VLANDriver
|
||||
|
||||
# DRIVER name and XPATH for relevant NICs
|
||||
DRIVER = "802.1Q"
|
||||
XPATH_FILTER = "TEMPLATE/NIC[VLAN='YES']"
|
||||
XPATH_FILTER = "TEMPLATE/NIC[VN_MAD='802.1Q']"
|
||||
|
||||
############################################################################
|
||||
# Create driver device operations are locked
|
||||
|
@ -17,9 +17,9 @@
|
||||
require 'vnmmad'
|
||||
|
||||
class EbtablesVLAN < VNMMAD::VNMDriver
|
||||
DRIVER = "ebtables"
|
||||
|
||||
XPATH_FILTER = "TEMPLATE/NIC[VLAN='YES']"
|
||||
DRIVER = "ebtables"
|
||||
XPATH_FILTER = "TEMPLATE/NIC[VN_MAD='ebtables']"
|
||||
|
||||
def initialize(vm, deploy_id = nil, hypervisor = nil)
|
||||
super(vm,XPATH_FILTER,deploy_id,hypervisor)
|
||||
|
@ -21,10 +21,22 @@ $: << File.join(File.dirname(__FILE__), "..")
|
||||
|
||||
require 'Ebtables'
|
||||
|
||||
template64 = ARGV[0]
|
||||
template64 = ARGV[0]
|
||||
deploy_id = nil
|
||||
hypervisor = nil
|
||||
xpath_filter = EbtablesVLAN::XPATH_FILTER
|
||||
|
||||
onevlan = EbtablesVLAN.from_base64(template64)
|
||||
onevlan.deactivate
|
||||
|
||||
filter_driver = VNMMAD::VNMDriver.filter_driver(template64)
|
||||
filter_driver.deactivate
|
||||
begin
|
||||
filter_driver = VNMMAD::VNMDriver.filter_driver(template64,
|
||||
deploy_id,
|
||||
hypervisor,
|
||||
xpath_filter)
|
||||
filter_driver.deactivate
|
||||
rescue Exception => e
|
||||
OpenNebula.log_error(e.message)
|
||||
OpenNebula.log_error(e.backtrace)
|
||||
exit 1
|
||||
end
|
||||
|
@ -21,14 +21,19 @@ $: << File.join(File.dirname(__FILE__), "..")
|
||||
|
||||
require 'Ebtables'
|
||||
|
||||
template64 = ARGV[0]
|
||||
deploy_id = ARGV[1]
|
||||
template64 = ARGV[0]
|
||||
deploy_id = ARGV[1]
|
||||
hypervisor = nil
|
||||
xpath_filter = EbtablesVLAN::XPATH_FILTER
|
||||
|
||||
onevlan = EbtablesVLAN.from_base64(template64, deploy_id)
|
||||
onevlan.activate
|
||||
|
||||
begin
|
||||
filter_driver = VNMMAD::VNMDriver.filter_driver(template64, deploy_id)
|
||||
filter_driver = VNMMAD::VNMDriver.filter_driver(template64,
|
||||
deploy_id,
|
||||
hypervisor,
|
||||
xpath_filter)
|
||||
filter_driver.activate
|
||||
rescue Exception => e
|
||||
OpenNebula.log_error(e.message)
|
||||
|
@ -25,7 +25,11 @@ module VNMMAD
|
||||
XPATH_FILTER = "TEMPLATE/NIC"
|
||||
|
||||
# Creates a new SG driver and scans SG Rules
|
||||
def initialize(vm, deploy_id = nil, hypervisor = nil)
|
||||
def initialize(vm, deploy_id = nil, hypervisor = nil, xpath_filter = nil)
|
||||
if xpath_filter
|
||||
XPATH_FILTER.replace xpath_filter
|
||||
end
|
||||
|
||||
super(vm, XPATH_FILTER, deploy_id, hypervisor)
|
||||
@locking = true
|
||||
@commands = VNMNetwork::Commands.new
|
||||
|
@ -17,14 +17,13 @@
|
||||
require 'vnmmad'
|
||||
|
||||
class OpenvSwitchVLAN < VNMMAD::VNMDriver
|
||||
DRIVER = "ovswitch"
|
||||
|
||||
DRIVER = "ovswitch"
|
||||
XPATH_FILTER = "TEMPLATE/NIC[VN_MAD='ovswitch']"
|
||||
FIREWALL_PARAMS = [:black_ports_tcp,
|
||||
:black_ports_udp,
|
||||
:icmp]
|
||||
|
||||
XPATH_FILTER = "TEMPLATE/NIC"
|
||||
|
||||
def initialize(vm, deploy_id = nil, hypervisor = nil)
|
||||
super(vm,XPATH_FILTER,deploy_id,hypervisor)
|
||||
@locking = false
|
||||
|
@ -37,9 +37,9 @@ require 'CommandManager'
|
||||
require 'vnmmad'
|
||||
|
||||
class OpenNebulaVMware < VNMMAD::VNMDriver
|
||||
DRIVER = "vmware"
|
||||
|
||||
XPATH_FILTER = "TEMPLATE/NIC"
|
||||
DRIVER = "vmware"
|
||||
XPATH_FILTER = "TEMPLATE/NIC[VN_MAD='vmware']"
|
||||
VCLI_CMD = "/sbin/esxcfg-vswitch"
|
||||
|
||||
def initialize(vm, deploy_id = nil, hypervisor = nil)
|
||||
|
@ -19,15 +19,20 @@
|
||||
$: << File.dirname(__FILE__)
|
||||
$: << File.join(File.dirname(__FILE__), "..")
|
||||
|
||||
require 'vnmmad'
|
||||
require 'vxlan_driver'
|
||||
|
||||
template64 = ARGV[0]
|
||||
template64 = ARGV[0]
|
||||
deploy_id = nil
|
||||
hypervisor = nil
|
||||
xpath_filter = VXLANDriver::XPATH_FILTER
|
||||
|
||||
begin
|
||||
hm = VXLANDriver.from_base64(template64)
|
||||
hm.deactivate
|
||||
filter_driver = VNMMAD::VNMDriver.filter_driver(template64)
|
||||
filter_driver = VNMMAD::VNMDriver.filter_driver(template64,
|
||||
deploy_id,
|
||||
hypervisor,
|
||||
xpath_filter)
|
||||
filter_driver.deactivate
|
||||
rescue Exception => e
|
||||
OpenNebula.log_error(e.message)
|
||||
|
@ -1 +0,0 @@
|
||||
../fw/post
|
39
src/vnm_mad/remotes/vxlan/post
Executable file
39
src/vnm_mad/remotes/vxlan/post
Executable file
@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
# -------------------------------------------------------------------------- #
|
||||
# Copyright 2002-2015, OpenNebula Project (OpenNebula.org), C12G Labs #
|
||||
# #
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
||||
# not use this file except in compliance with the License. You may obtain #
|
||||
# a copy of the License at #
|
||||
# #
|
||||
# http://www.apache.org/licenses/LICENSE-2.0 #
|
||||
# #
|
||||
# Unless required by applicable law or agreed to in writing, software #
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, #
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
||||
# See the License for the specific language governing permissions and #
|
||||
# limitations under the License. #
|
||||
#--------------------------------------------------------------------------- #
|
||||
|
||||
$: << File.dirname(__FILE__)
|
||||
$: << File.join(File.dirname(__FILE__), "..")
|
||||
|
||||
require 'vxlan_driver'
|
||||
|
||||
template64 = ARGV[0]
|
||||
deploy_id = ARGV[1]
|
||||
hypervisor = nil
|
||||
xpath_filter = VXLANDriver::XPATH_FILTER
|
||||
|
||||
begin
|
||||
filter_driver = VNMMAD::VNMDriver.filter_driver(template64,
|
||||
deploy_id,
|
||||
hypervisor,
|
||||
xpath_filter)
|
||||
filter_driver.activate
|
||||
rescue Exception => e
|
||||
OpenNebula.log_error(e.message)
|
||||
OpenNebula.log_error(e.backtrace)
|
||||
exit 1
|
||||
end
|
@ -27,7 +27,7 @@ class VXLANDriver < VNMMAD::VLANDriver
|
||||
|
||||
# DRIVER name and XPATH for relevant NICs
|
||||
DRIVER = "vxlan"
|
||||
XPATH_FILTER = "TEMPLATE/NIC[VLAN='YES']"
|
||||
XPATH_FILTER = "TEMPLATE/NIC[VN_MAD='vxlan']"
|
||||
|
||||
############################################################################
|
||||
# Create driver device operations are locked
|
||||
|
Loading…
x
Reference in New Issue
Block a user