1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-25 06:03:36 +03:00
one/share/hooks/ebtables-vlan

24 lines
446 B
Ruby
Executable File

#!/usr/bin/env ruby
$: << File.dirname(__FILE__)
require 'base64'
require 'OpenNebulaVLAN'
action = ARGV[0]
template = ARGV[1]
# Uncomment to act only on the listed bridges.
#FILTERED_BRIDGES = ['br0']
vm_xml = Base64::decode64(template)
onevlan = EbtablesVLAN.new(vm_xml)
case action
when "on"
onevlan.filter(:bridge => FILTERED_BRIDGES) if defined? FILTERED_BRIDGES
onevlan.activate
when "off"
onevlan.deactivate
end