1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-11 05:17:41 +03:00

feature #3175b: rename 802.1Q class name to VLANDriver

This commit is contained in:
Ruben S. Montero 2014-12-24 17:00:23 +01:00
parent 0961dc4829
commit ae0bf32400
3 changed files with 26 additions and 6 deletions

View File

@ -947,7 +947,7 @@ NETWORK_FILES="src/vnm_mad/remotes/lib/vnm_driver.rb \
NETWORK_8021Q_FILES="src/vnm_mad/remotes/802.1Q/clean \
src/vnm_mad/remotes/802.1Q/post \
src/vnm_mad/remotes/802.1Q/pre \
src/vnm_mad/remotes/802.1Q/HostManaged.rb"
src/vnm_mad/remotes/802.1Q/vlan_driver.rb"
NETWORK_DUMMY_FILES="src/vnm_mad/remotes/dummy/clean \
src/vnm_mad/remotes/dummy/post \

View File

@ -19,7 +19,7 @@
$: << File.dirname(__FILE__)
$: << File.join(File.dirname(__FILE__), "..")
require 'HostManaged'
require 'vlan_driver'
hm = OpenNebulaHM.from_base64(ARGV[0])
hm = VLANDriver.from_base64(ARGV[0])
exit hm.activate

View File

@ -16,13 +16,24 @@
require 'vnmmad'
class OpenNebulaHM < VNMMAD::VNMDriver
DRIVER = "802.1Q"
################################################################################
# This driver tag VM traffic with a VLAN_ID using 802.1Q protocol. Features:
# - Creates a bridge and bind phisycal device if not present
# - Creates a tagged interface for the VM dev.vlan_id
#
# Once activated the VM will be attached to this bridge
################################################################################
class VLANDriver < VNMMAD::VNMDriver
# DRIVER name and XPATH for relevant NICs
DRIVER = "802.1Q"
XPATH_FILTER = "TEMPLATE/NIC[VLAN='YES']"
############################################################################
# Creatges the driver device operations are not locked
############################################################################
def initialize(vm, deploy_id = nil, hypervisor = nil)
super(vm,XPATH_FILTER,deploy_id,hypervisor)
super(vm, XPATH_FILTER, deploy_id, hypervisor)
@locking = false
lock
@ -30,6 +41,9 @@ class OpenNebulaHM < VNMMAD::VNMDriver
unlock
end
############################################################################
# Activate the driver and creates bridges and tags devices as needed.
############################################################################
def activate
lock
@ -67,6 +81,12 @@ class OpenNebulaHM < VNMMAD::VNMDriver
return 0
end
############################################################################
# Private interface, methods to manage bridges and VLAN tags through the
# brctl and ip commands
############################################################################
private
def bridge_exists?(bridge)
@bridges.keys.include? bridge
end