Revision a6620629

View differences:

share/etc/oned.conf
841 841
VNET_RESTRICTED_ATTR = "VLAN_ID"
842 842
VNET_RESTRICTED_ATTR = "BRIDGE"
843 843
VNET_RESTRICTED_ATTR = "CONF"
844
VNET_RESTRICTED_ATTR = "BRIDGE_CONF"
844 845

  
845 846
VNET_RESTRICTED_ATTR = "AR/VN_MAD"
846 847
VNET_RESTRICTED_ATTR = "AR/PHYDEV"
......
903 904
INHERIT_VNET_ATTR       = "OUTBOUND_PEAK_BW"
904 905
INHERIT_VNET_ATTR       = "OUTBOUND_PEAK_KB"
905 906
INHERIT_VNET_ATTR       = "CONF"
907
INHERIT_VNET_ATTR       = "BRIDGE_CONF"
906 908

  
907 909
#*******************************************************************************
908 910
# Transfer Manager Driver Behavior Configuration
src/vnm_mad/remotes/lib/vlan.rb
127 127

  
128 128
            OpenNebula.exec_and_log("#{command(:brctl)} addbr #{@nic[:bridge]}")
129 129

  
130
            set_bridge_options
131

  
130 132
            @bridges[@nic[:bridge]] = Array.new
131 133

  
132 134
            OpenNebula.exec_and_log("#{command(:ip)} link set #{@nic[:bridge]} up")
133 135
        end
134 136

  
137
        # Calls brctl to set options stored in bridge_conf
138
        def set_bridge_options
139
            @nic[:bridge_conf].each do |option, value|
140
                case value
141
                when true
142
                    value = "on"
143
                when false
144
                    value = "off"
145
                end
146

  
147
                cmd = "#{command(:brctl)} #{option} " <<
148
                        "#{@nic[:bridge]} #{value}"
149

  
150
                OpenNebula.exec_and_log(cmd)
151
            end
152
        end
153

  
135 154
        # Get hypervisor bridges
136 155
        #   @return [Hash<String>] with the bridge names
137 156
        def get_bridges
src/vnm_mad/remotes/lib/vnm_driver.rb
72 72
        def process(&block)
73 73
            blk = lambda do |nic|
74 74
                add_nic_conf(nic)
75
                add_bridge_conf(nic)
75 76

  
76 77
                block.call(nic)
77 78
            end
......
100 101
            nic[:conf] = default_conf.merge(nic_conf)
101 102
        end
102 103

  
104
        def add_bridge_conf(nic)
105
            add_command_conf(nic, :bridge_conf)
106
        end
107

  
108
        def add_command_conf(nic, conf_name)
109
            default_conf = CONF[conf_name] || {}
110
            nic_conf = {}
111

  
112
            # sanitize
113
            default_conf.each do |key, value|
114
                option  = Shellwords.escape(key.to_s.strip.downcase)
115
                if value.class == String
116
                    value   = Shellwords.escape(value.strip)
117
                end
118

  
119
                nic_conf[option] = value
120
            end
121

  
122
            if nic[conf_name]
123
                parse_options(nic[conf_name]).each do |option, value|
124
                    if value == '__delete__'
125
                        nic_conf.delete(option.strip.downcase)
126
                    else
127
                        option  = Shellwords.escape(option.strip.downcase)
128
                        value   = Shellwords.escape(value)
129

  
130
                        nic_conf[option] = value
131
                    end
132
                end
133
            end
134

  
135
            nic[conf_name] = nic_conf
136
        end
137

  
103 138
        # Returns a filter object based on the contents of the template
104 139
        #
105 140
        # @return SGDriver object

Also available in: Unified diff