mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-21 14:50:08 +03:00
Merge branch 'master' of git.opennebula.org:one
This commit is contained in:
commit
2a2f0ca7b4
@ -17,8 +17,9 @@
|
||||
require 'OpenNebulaNetwork'
|
||||
|
||||
class OpenNebulaHM < OpenNebulaNetwork
|
||||
XPATH_FILTER = "TEMPLATE/NIC[VLAN='YES']"
|
||||
def initialize(vm, hypervisor = nil)
|
||||
super(vm,hypervisor)
|
||||
super(vm,XPATH_FILTER,hypervisor)
|
||||
@bridges = get_interfaces
|
||||
end
|
||||
|
||||
|
@ -15,8 +15,10 @@
|
||||
#--------------------------------------------------------------------------- #
|
||||
|
||||
class OpenNebulaFirewall < OpenNebulaNetwork
|
||||
XPATH_FILTER = "TEMPLATE/NIC[ICMP|WHITE_PORTS_TCP|WHITE_PORTS_UDP|" <<
|
||||
"BLACK_PORTS_TCP|BLACK_PORTS_UDP]"
|
||||
def initialize(vm, hypervisor = nil)
|
||||
super(vm,hypervisor)
|
||||
super(vm,XPATH_FILTER,hypervisor)
|
||||
end
|
||||
def activate
|
||||
vm_id = @vm['ID']
|
||||
|
@ -45,14 +45,15 @@ COMMANDS = {
|
||||
class VM
|
||||
attr_accessor :nics, :vm_info
|
||||
|
||||
def initialize(vm_root, hypervisor)
|
||||
@vm_root = vm_root
|
||||
@hypervisor = hypervisor
|
||||
@vm_info = Hash.new
|
||||
def initialize(vm_root, xpath_filter, hypervisor)
|
||||
@vm_root = vm_root
|
||||
@xpath_filter = xpath_filter
|
||||
@hypervisor = hypervisor
|
||||
@vm_info = Hash.new
|
||||
|
||||
nics = Nics.new(@hypervisor)
|
||||
|
||||
@vm_root.elements.each("TEMPLATE/NIC[VLAN='YES']") do |nic_element|
|
||||
@vm_root.elements.each(@xpath_filter) do |nic_element|
|
||||
nic = nics.new_nic
|
||||
|
||||
nic_element.elements.each('*') do |nic_attribute|
|
||||
@ -96,14 +97,14 @@ class OpenNebulaNetwork
|
||||
self.new(vm_xml, hypervisor)
|
||||
end
|
||||
|
||||
def initialize(vm_tpl, hypervisor=nil)
|
||||
def initialize(vm_tpl, xpath_filter, hypervisor=nil)
|
||||
if !hypervisor
|
||||
@hypervisor = detect_hypervisor
|
||||
else
|
||||
@hypervisor = hypervisor
|
||||
end
|
||||
|
||||
@vm = VM.new(REXML::Document.new(vm_tpl).root, @hypervisor)
|
||||
@vm = VM.new(REXML::Document.new(vm_tpl).root, xpath_filter, @hypervisor)
|
||||
end
|
||||
|
||||
def process(&block)
|
||||
|
@ -17,8 +17,9 @@
|
||||
require 'OpenNebulaNetwork'
|
||||
|
||||
class EbtablesVLAN < OpenNebulaNetwork
|
||||
XPATH_FILTER = "TEMPLATE/NIC[VLAN='YES']"
|
||||
def initialize(vm, hypervisor = nil)
|
||||
super(vm,hypervisor)
|
||||
super(vm,XPATH_FILTER,hypervisor)
|
||||
end
|
||||
|
||||
def ebtables(rule)
|
||||
|
@ -17,8 +17,9 @@
|
||||
require 'OpenNebulaNetwork'
|
||||
|
||||
class OpenvSwitchVLAN < OpenNebulaNetwork
|
||||
XPATH_FILTER = "TEMPLATE/NIC[VLAN='YES']"
|
||||
def initialize(vm, hypervisor = nil)
|
||||
super(vm,hypervisor)
|
||||
super(vm,XPATH_FILTER,hypervisor)
|
||||
end
|
||||
|
||||
def activate
|
||||
|
@ -43,7 +43,7 @@ describe 'networking' do
|
||||
$capture_commands = {
|
||||
/virsh.*dumpxml/ => OUTPUT[:virsh_dumpxml]
|
||||
}
|
||||
onevlan = OpenNebulaNetwork.new(OUTPUT[:onevm_show],"kvm")
|
||||
onevlan = OpenNebulaNetwork.new(OUTPUT[:onevm_show],"TEMPLATE/NIC","kvm")
|
||||
nics_expected = [{:bridge=>"br0",
|
||||
:ip=>"172.16.0.100",
|
||||
:mac=>"02:00:ac:10:00:64",
|
||||
|
Loading…
x
Reference in New Issue
Block a user