Browse Source

replace lagopus.dsl when lagopus configuration changed

Now restarting lagopus is available. Note that restarting
lagopus-agent is necessary when lagopus restarted.

Change-Id: I5d93500950bd0016de5c8d65e19de85f0ff257c8
Itsuro Oda 1 year ago
parent
commit
72f4fb97ab

+ 2
- 0
devstack/lagopus_agent View File

@@ -65,6 +65,8 @@ function neutron_plugin_configure_plugin_agent {
65 65
     fi
66 66
     iniset /$Q_PLUGIN_CONF_FILE lagopus max_eth_ports $LAGOPUS_MAX_ETH_PORTS
67 67
     iniset /$Q_PLUGIN_CONF_FILE lagopus max_vlan_networks $LAGOPUS_MAX_VLAN_NETWORKS
68
+    iniset /$Q_PLUGIN_CONF_FILE lagopus replace_dsl $LAGOPUS_REPLACE_DSL
69
+    iniset /$Q_PLUGIN_CONF_FILE lagopus lagopus_conf_path $LAGOPUS_CONF_DIR/$LAGOPUS_CONF
68 70
     iniset /$Q_PLUGIN_CONF_FILE securitygroup firewall_driver neutron.agent.firewall.NoopFirewallDriver
69 71
 }
70 72
 

+ 1
- 0
devstack/settings View File

@@ -31,6 +31,7 @@ LAGOPUS_CORE_BALANCE=${LAGOPUS_CORE_BALANCE:-False}
31 31
 LAGOPUS_MEM_CHANNELS=${LAGOPUS_MEM_CHANNELS:-1}
32 32
 LAGOPUS_MAX_ETH_PORTS=${LAGOPUS_MAX_ETH_PORTS:-32}
33 33
 LAGOPUS_MAX_VLAN_NETWORKS=${LAGOPUS_MAX_VLAN_NETWORKS:-0}
34
+LAGOPUS_REPLACE_DSL=${LAGOPUS_REPLACE_DSL:-False}
34 35
 
35 36
 DPDK_PORT_MAPPINGS=${DPDK_PORT_MAPPINGS:-}
36 37
 DPDK_DIR=${DPDK_DIR:-$LAGOPUS_DIR/src/dpdk}

+ 3
- 1
etc/neutron/rootwrap.d/lagopus.filters View File

@@ -12,4 +12,6 @@
12 12
 ip: IpFilter, ip, root
13 13
 ip_exec: IpNetnsExecFilter, ip, root
14 14
 
15
-ethtool: CommandFilter, ethtool, root
15
+ethtool: CommandFilter, ethtool, root
16
+
17
+mv: CommandFilter, mv, root

+ 5
- 0
networking_lagopus/common/config.py View File

@@ -17,6 +17,7 @@ from networking_lagopus._i18n import _
17 17
 DEFAULT_BRIDGE_MAPPINGS = []
18 18
 DEFAULT_MAX_ETH_PORTS = 32
19 19
 DEFAULT_MAX_VLAN_NETWORKS = 0
20
+DEFAULT_LAGOPUS_CONF_PATH = "/usr/local/etc/lagopus/lagopus.dsl"
20 21
 
21 22
 lagopus_opts = [
22 23
     cfg.BoolOpt('vhost_mode', default=True,
@@ -42,6 +43,10 @@ lagopus_opts = [
42 43
     cfg.IntOpt('max_vlan_networks', default=DEFAULT_MAX_VLAN_NETWORKS,
43 44
                help=_("Max number of vlan networks available at the same "
44 45
                       "time on a host.")),
46
+    cfg.BoolOpt('replace_dsl', default=False,
47
+                help=_("Replace lagopus.dsl when configration changed.")),
48
+    cfg.StrOpt('lagopus_conf_path', default=DEFAULT_LAGOPUS_CONF_PATH,
49
+               help=_("Path name of lagopus config file.")),
45 50
 ]
46 51
 
47 52
 

+ 17
- 7
networking_lagopus/ml2/agent/lagopus_agent.py View File

@@ -24,6 +24,7 @@ from oslo_service import loopingcall
24 24
 from oslo_service import service
25 25
 from osprofiler import profiler
26 26
 
27
+from neutron.agent.common import utils
27 28
 from neutron.agent.linux import ip_lib
28 29
 from neutron.agent import rpc as agent_rpc
29 30
 from neutron.api.rpc.callbacks import resources
@@ -146,9 +147,6 @@ class LagopusManager(object):
146 147
                 sys.exit(1)
147 148
             self.phys_to_bridge[phys_net] = self.bridges[name]
148 149
 
149
-        # make initial dsl
150
-        self._rebuild_dsl()
151
-
152 150
         # vhost and pipe management
153 151
         self.max_pipe_pairs = cfg.CONF.lagopus.max_vlan_networks
154 152
         self.max_vhosts = (cfg.CONF.lagopus.max_eth_ports
@@ -174,6 +172,16 @@ class LagopusManager(object):
174 172
             if pipe_id not in used_pipe_id:
175 173
                 self.free_pipe_pairs.append(pipe_pair)
176 174
 
175
+        # install vlan flow
176
+        for bridge in self.bridges.values():
177
+            if (bridge.type == lg_lib.BRIDGE_TYPE_VLAN and
178
+                    bridge.pipe_id is not None):
179
+                port2 = self.pipe_pairs[bridge.pipe_id][1]
180
+                phys_bridge = port2.bridge
181
+                if phys_bridge:
182
+                    vlan_id = bridge.dpid >> 48
183
+                    phys_bridge.install_vlan(vlan_id, port2)
184
+
177 185
     def _wait_lagopus_initialized(self):
178 186
         for retry in range(MAX_WAIT_LAGOPUS_RETRY):
179 187
             try:
@@ -186,10 +194,8 @@ class LagopusManager(object):
186 194
         sys.exit(1)
187 195
 
188 196
     def _rebuild_dsl(self):
189
-        # TODO(oda): just for backup now. it is able to restart lagopus
190
-        # uging this dsl manually. replace actual dsl in the future.
191
-        path = "/tmp/lagopus-backup.dsl"  # path is temporary
192
-        with open(path, "w") as f:
197
+        tmp_conf = "/tmp/lagopus-backup.dsl"
198
+        with open(tmp_conf, "w") as f:
193 199
             for obj in self.channels.values():
194 200
                 f.write(obj.create_str())
195 201
             for obj in self.controllers.values():
@@ -207,6 +213,10 @@ class LagopusManager(object):
207 213
                 if obj.bridge:
208 214
                     f.write(obj.add_bridge_str())
209 215
 
216
+        if cfg.CONF.lagopus.replace_dsl:
217
+            cmd = ["mv", tmp_conf, cfg.CONF.lagopus.lagopus_conf_path]
218
+            utils.execute(cmd, run_as_root=True)
219
+
210 220
     def _sock_path(self, vhost_id):
211 221
         return "/tmp/sock%d" % vhost_id
212 222
 

Loading…
Cancel
Save