]> git.proxmox.com Git - mirror_ovs.git/blob - ovn/ovn-architecture.7.xml
ovn-architecture: Fix description of powering off VMs
[mirror_ovs.git] / ovn / ovn-architecture.7.xml
1 <?xml version="1.0" encoding="utf-8"?>
2 <manpage program="ovn-architecture" section="7" title="OVN Architecture">
3 <h1>Name</h1>
4 <p>ovn-architecture -- Open Virtual Network architecture</p>
5
6 <h1>Description</h1>
7
8 <p>
9 OVN, the Open Virtual Network, is a system to support virtual network
10 abstraction. OVN complements the existing capabilities of OVS to add
11 native support for virtual network abstractions, such as virtual L2 and L3
12 overlays and security groups. Services such as DHCP are also desirable
13 features. Just like OVS, OVN's design goal is to have a production-quality
14 implementation that can operate at significant scale.
15 </p>
16
17 <p>
18 An OVN deployment consists of several components:
19 </p>
20
21 <ul>
22 <li>
23 <p>
24 A <dfn>Cloud Management System</dfn> (<dfn>CMS</dfn>), which is
25 OVN's ultimate client (via its users and administrators). OVN
26 integration requires installing a CMS-specific plugin and
27 related software (see below). OVN initially targets OpenStack
28 as CMS.
29 </p>
30
31 <p>
32 We generally speak of ``the'' CMS, but one can imagine scenarios in
33 which multiple CMSes manage different parts of an OVN deployment.
34 </p>
35 </li>
36
37 <li>
38 An OVN Database physical or virtual node (or, eventually, cluster)
39 installed in a central location.
40 </li>
41
42 <li>
43 One or more (usually many) <dfn>hypervisors</dfn>. Hypervisors must run
44 Open vSwitch and implement the interface described in
45 <code>IntegrationGuide.md</code> in the OVS source tree. Any hypervisor
46 platform supported by Open vSwitch is acceptable.
47 </li>
48
49 <li>
50 <p>
51 Zero or more <dfn>gateways</dfn>. A gateway extends a tunnel-based
52 logical network into a physical network by bidirectionally forwarding
53 packets between tunnels and a physical Ethernet port. This allows
54 non-virtualized machines to participate in logical networks. A gateway
55 may be a physical host, a virtual machine, or an ASIC-based hardware
56 switch that supports the <code>vtep</code>(5) schema. (Support for the
57 latter will come later in OVN implementation.)
58 </p>
59
60 <p>
61 Hypervisors and gateways are together called <dfn>transport node</dfn>
62 or <dfn>chassis</dfn>.
63 </p>
64 </li>
65 </ul>
66
67 <p>
68 The diagram below shows how the major components of OVN and related
69 software interact. Starting at the top of the diagram, we have:
70 </p>
71
72 <ul>
73 <li>
74 The Cloud Management System, as defined above.
75 </li>
76
77 <li>
78 <p>
79 The <dfn>OVN/CMS Plugin</dfn> is the component of the CMS that
80 interfaces to OVN. In OpenStack, this is a Neutron plugin.
81 The plugin's main purpose is to translate the CMS's notion of logical
82 network configuration, stored in the CMS's configuration database in a
83 CMS-specific format, into an intermediate representation understood by
84 OVN.
85 </p>
86
87 <p>
88 This component is necessarily CMS-specific, so a new plugin needs to be
89 developed for each CMS that is integrated with OVN. All of the
90 components below this one in the diagram are CMS-independent.
91 </p>
92 </li>
93
94 <li>
95 <p>
96 The <dfn>OVN Northbound Database</dfn> receives the intermediate
97 representation of logical network configuration passed down by the
98 OVN/CMS Plugin. The database schema is meant to be ``impedance
99 matched'' with the concepts used in a CMS, so that it directly supports
100 notions of logical switches, routers, ACLs, and so on. See
101 <code>ovs-nb</code>(5) for details.
102 </p>
103
104 <p>
105 The OVN Northbound Database has only two clients: the OVN/CMS Plugin
106 above it and <code>ovn-nbd</code> below it.
107 </p>
108 </li>
109
110 <li>
111 <code>ovn-nbd</code>(8) connects to the OVN Northbound Database above it
112 and the OVN Southbound Database below it. It translates the
113 logical network configuration in terms of conventional network
114 concepts, taken from the OVN Northbound Database, into logical
115 datapath flows in the OVN Southbound Database below it.
116 </li>
117
118 <li>
119 <p>
120 The <dfn>OVN Southbound Database</dfn> is the center of the system.
121 Its clients are <code>ovn-nbd</code>(8) above it and
122 <code>ovn-controller</code>(8) on every transport node below it.
123 </p>
124
125 <p>
126 The OVN Southbound Database contains three kinds of data: <dfn>Physical
127 Network</dfn> (PN) tables that specify how to reach hypervisor and
128 other nodes, <dfn>Logical Network</dfn> (LN) tables that describe the
129 logical network in terms of ``logical datapath flows,'' and
130 <dfn>Binding</dfn> tables that link logical network components'
131 locations to the physical network. The hypervisors populate the PN and
132 Binding tables, whereas <code>ovn-nbd</code>(8) populates the LN
133 tables.
134 </p>
135
136 <p>
137 OVN Southbound Database performance must scale with the number of
138 transport nodes. This will likely require some work on
139 <code>ovsdb-server</code>(1) as we encounter bottlenecks.
140 Clustering for availability may be needed.
141 </p>
142 </li>
143 </ul>
144
145 <p>
146 The remaining components are replicated onto each hypervisor:
147 </p>
148
149 <ul>
150 <li>
151 <code>ovn-controller</code>(8) is OVN's agent on each hypervisor and
152 software gateway. Northbound, it connects to the OVN Southbound
153 Database to learn about OVN configuration and status and to
154 populate the PN table and the <code>Chassis</code> column in
155 <code>Bindings</code> table with the hypervisor's status.
156 Southbound, it connects to <code>ovs-vswitchd</code>(8) as an
157 OpenFlow controller, for control over network traffic, and to the
158 local <code>ovsdb-server</code>(1) to allow it to monitor and
159 control Open vSwitch configuration.
160 </li>
161
162 <li>
163 <code>ovs-vswitchd</code>(8) and <code>ovsdb-server</code>(1) are
164 conventional components of Open vSwitch.
165 </li>
166 </ul>
167
168 <pre fixed="yes">
169 CMS
170 |
171 |
172 +-----------|-----------+
173 | | |
174 | OVN/CMS Plugin |
175 | | |
176 | | |
177 | OVN Northbound DB |
178 | | |
179 | | |
180 | ovn-nbd |
181 | | |
182 +-----------|-----------+
183 |
184 |
185 +-------------------+
186 | OVN Southbound DB |
187 +-------------------+
188 |
189 |
190 +------------------+------------------+
191 | | |
192 HV 1 | | HV n |
193 +---------------|---------------+ . +---------------|---------------+
194 | | | . | | |
195 | ovn-controller | . | ovn-controller |
196 | | | | . | | | |
197 | | | | | | | |
198 | ovs-vswitchd ovsdb-server | | ovs-vswitchd ovsdb-server |
199 | | | |
200 +-------------------------------+ +-------------------------------+
201 </pre>
202
203 <h2>Chassis Setup</h2>
204
205 <p>
206 Each chassis in an OVN deployment must be configured with an Open vSwitch
207 bridge dedicated for OVN's use, called the <dfn>integration bridge</dfn>.
208 System startup scripts create this bridge prior to starting
209 <code>ovn-controller</code>. The ports on the integration bridge include:
210 </p>
211
212 <ul>
213 <li>
214 On any chassis, tunnel ports that OVN uses to maintain logical network
215 connectivity. <code>ovn-controller</code> adds, updates, and removes
216 these tunnel ports.
217 </li>
218
219 <li>
220 On a hypervisor, any VIFs that are to be attached to logical networks.
221 The hypervisor itself, or the integration between Open vSwitch and the
222 hypervisor (described in <code>IntegrationGuide.md</code>) takes care of
223 this. (This is not part of OVN or new to OVN; this is pre-existing
224 integration work that has already been done on hypervisors that support
225 OVS.)
226 </li>
227
228 <li>
229 On a gateway, the physical port used for logical network connectivity.
230 System startup scripts add this port to the bridge prior to starting
231 <code>ovn-controller</code>. This can be a patch port to another bridge,
232 instead of a physical port, in more sophisticated setups.
233 </li>
234 </ul>
235
236 <p>
237 Other ports should not be attached to the integration bridge. In
238 particular, physical ports attached to the underlay network (as opposed to
239 gateway ports, which are physical ports attached to logical networks) must
240 not be attached to the integration bridge. Underlay physical ports should
241 instead be attached to a separate Open vSwitch bridge (they need not be
242 attached to any bridge at all, in fact).
243 </p>
244
245 <p>
246 The integration bridge must be configured with failure mode ``secure'' to
247 avoid switching packets between isolated logical networks before
248 <code>ovn-controller</code> starts up. See <code>Controller Failure
249 Settings</code> in <code>ovs-vsctl</code>(8) for more information.
250 </p>
251
252 <p>
253 The customary name for the integration bridge is <code>br-int</code>, but
254 another name may be used.
255 </p>
256
257 <h2>Life Cycle of a VIF</h2>
258
259 <p>
260 Tables and their schemas presented in isolation are difficult to
261 understand. Here's an example.
262 </p>
263
264 <p>
265 A VIF on a hypervisor is a virtual network interface attached either
266 to a VM or a container running directly on that hypervisor (This is
267 different from the interface of a container running inside a VM).
268 </p>
269
270 <p>
271 The steps in this example refer often to details of the OVN and OVN
272 Northbound database schemas. Please see <code>ovn-sb</code>(5) and
273 <code>ovn-nb</code>(5), respectively, for the full story on these
274 databases.
275 </p>
276
277 <ol>
278 <li>
279 A VIF's life cycle begins when a CMS administrator creates a new VIF
280 using the CMS user interface or API and adds it to a switch (one
281 implemented by OVN as a logical switch). The CMS updates its own
282 configuration. This includes associating unique, persistent identifier
283 <var>vif-id</var> and Ethernet address <var>mac</var> with the VIF.
284 </li>
285
286 <li>
287 The CMS plugin updates the OVN Northbound database to include the new
288 VIF, by adding a row to the <code>Logical_Port</code> table. In the new
289 row, <code>name</code> is <var>vif-id</var>, <code>mac</code> is
290 <var>mac</var>, <code>switch</code> points to the OVN logical switch's
291 Logical_Switch record, and other columns are initialized appropriately.
292 </li>
293
294 <li>
295 <code>ovn-nbd</code> receives the OVN Northbound database update.
296 In turn, it makes the corresponding updates to the OVN Southbound
297 database, by adding rows to the OVN Southbound database
298 <code>Pipeline</code> table to reflect the new port, e.g. add a
299 flow to recognize that packets destined to the new port's MAC
300 address should be delivered to it, and update the flow that
301 delivers broadcast and multicast packets to include the new port.
302 It also creates a record in the <code>Bindings</code> table and
303 populates all its columns except the column that identifies the
304 <code>chassis</code>.
305 </li>
306
307 <li>
308 On every hypervisor, <code>ovn-controller</code> receives the
309 <code>Pipeline</code> table updates that <code>ovn-nbd</code> made in the
310 previous step. As long as the VM that owns the VIF is powered off,
311 <code>ovn-controller</code> cannot do much; it cannot, for example,
312 arrange to send packets to or receive packets from the VIF, because the
313 VIF does not actually exist anywhere.
314 </li>
315
316 <li>
317 Eventually, a user powers on the VM that owns the VIF. On the hypervisor
318 where the VM is powered on, the integration between the hypervisor and
319 Open vSwitch (described in <code>IntegrationGuide.md</code>) adds the VIF
320 to the OVN integration bridge and stores <var>vif-id</var> in
321 <code>external-ids</code>:<code>iface-id</code> to indicate that the
322 interface is an instantiation of the new VIF. (None of this code is new
323 in OVN; this is pre-existing integration work that has already been done
324 on hypervisors that support OVS.)
325 </li>
326
327 <li>
328 On the hypervisor where the VM is powered on, <code>ovn-controller</code>
329 notices <code>external-ids</code>:<code>iface-id</code> in the new
330 Interface. In response, it updates the local hypervisor's OpenFlow
331 tables so that packets to and from the VIF are properly handled.
332 Afterward, in the OVN Southbound DB, it updates the
333 <code>Bindings</code> table's <code>chassis</code> column for the
334 row that links the logical port from
335 <code>external-ids</code>:<code>iface-id</code> to the hypervisor.
336 </li>
337
338 <li>
339 Some CMS systems, including OpenStack, fully start a VM only when its
340 networking is ready. To support this, <code>ovn-nbd</code> notices the
341 <code>chassis</code> column updated for the row in <code>Bindings</code>
342 table and pushes this upward by updating the <ref column="up"
343 table="Logical_Port" db="OVN_NB"/> column in the OVN Northbound
344 database's <ref table="Logical_Port" db="OVN_NB"/> table to indicate
345 that the VIF is now up. The CMS, if it uses this feature, can then
346 react by allowing the VM's execution to proceed.
347 </li>
348
349 <li>
350 On every hypervisor but the one where the VIF resides,
351 <code>ovn-controller</code> notices the completely populated row in the
352 <code>Bindings</code> table. This provides <code>ovn-controller</code>
353 the physical location of the logical port, so each instance updates the
354 OpenFlow tables of its switch (based on logical datapath flows in the OVN
355 DB <code>Pipeline</code> table) so that packets to and from the VIF can
356 be properly handled via tunnels.
357 </li>
358
359 <li>
360 Eventually, a user powers off the VM that owns the VIF. On the
361 hypervisor where the VM was powered off, the VIF is deleted from the OVN
362 integration bridge.
363 </li>
364
365 <li>
366 On the hypervisor where the VM was powered off,
367 <code>ovn-controller</code> notices that the VIF was deleted. In
368 response, it removes the <code>Chassis</code> column content in the
369 <code>Bindings</code> table for the logical port.
370 </li>
371
372 <li>
373 On every hypervisor, <code>ovn-controller</code> notices the empty
374 <code>Chassis</code> column in the <code>Bindings</code> table's row
375 for the logical port. This means that <code>ovn-controller</code> no
376 longer knows the physical location of the logical port, so each instance
377 updates its OpenFlow table to reflect that.
378 </li>
379
380 <li>
381 Eventually, when the VIF (or its entire VM) is no longer needed by
382 anyone, an administrator deletes the VIF using the CMS user interface or
383 API. The CMS updates its own configuration.
384 </li>
385
386 <li>
387 The CMS plugin removes the VIF from the OVN Northbound database,
388 by deleting its row in the <code>Logical_Port</code> table.
389 </li>
390
391 <li>
392 <code>ovn-nbd</code> receives the OVN Northbound update and in turn
393 updates the OVN Southbound database accordingly, by removing or
394 updating the rows from the OVN Southbound database
395 <code>Pipeline</code> table and <code>Bindings</code> table that
396 were related to the now-destroyed VIF.
397 </li>
398
399 <li>
400 On every hypervisor, <code>ovn-controller</code> receives the
401 <code>Pipeline</code> table updates that <code>ovn-nbd</code> made in the
402 previous step. <code>ovn-controller</code> updates OpenFlow tables to
403 reflect the update, although there may not be much to do, since the VIF
404 had already become unreachable when it was removed from the
405 <code>Bindings</code> table in a previous step.
406 </li>
407 </ol>
408
409 <h2>Life Cycle of a container interface inside a VM</h2>
410
411 <p>
412 OVN provides virtual network abstractions by converting information
413 written in OVN_NB database to OpenFlow flows in each hypervisor. Secure
414 virtual networking for multi-tenants can only be provided if OVN controller
415 is the only entity that can modify flows in Open vSwitch. When the
416 Open vSwitch integration bridge resides in the hypervisor, it is a
417 fair assumption to make that tenant workloads running inside VMs cannot
418 make any changes to Open vSwitch flows.
419 </p>
420
421 <p>
422 If the infrastructure provider trusts the applications inside the
423 containers not to break out and modify the Open vSwitch flows, then
424 containers can be run in hypervisors. This is also the case when
425 containers are run inside the VMs and Open vSwitch integration bridge
426 with flows added by OVN controller resides in the same VM. For both
427 the above cases, the workflow is the same as explained with an example
428 in the previous section ("Life Cycle of a VIF").
429 </p>
430
431 <p>
432 This section talks about the life cycle of a container interface (CIF)
433 when containers are created in the VMs and the Open vSwitch integration
434 bridge resides inside the hypervisor. In this case, even if a container
435 application breaks out, other tenants are not affected because the
436 containers running inside the VMs cannot modify the flows in the
437 Open vSwitch integration bridge.
438 </p>
439
440 <p>
441 When multiple containers are created inside a VM, there are multiple
442 CIFs associated with them. The network traffic associated with these
443 CIFs need to reach the Open vSwitch integration bridge running in the
444 hypervisor for OVN to support virtual network abstractions. OVN should
445 also be able to distinguish network traffic coming from different CIFs.
446 There are two ways to distinguish network traffic of CIFs.
447 </p>
448
449 <p>
450 One way is to provide one VIF for every CIF (1:1 model). This means that
451 there could be a lot of network devices in the hypervisor. This would slow
452 down OVS because of all the additional CPU cycles needed for the management
453 of all the VIFs. It would also mean that the entity creating the
454 containers in a VM should also be able to create the corresponding VIFs in
455 the hypervisor.
456 </p>
457
458 <p>
459 The second way is to provide a single VIF for all the CIFs (1:many model).
460 OVN could then distinguish network traffic coming from different CIFs via
461 a tag written in every packet. OVN uses this mechanism and uses VLAN as
462 the tagging mechanism.
463 </p>
464
465 <ol>
466 <li>
467 A CIF's life cycle begins when a container is spawned inside a VM by
468 the either the same CMS that created the VM or a tenant that owns that VM
469 or even a container Orchestration System that is different than the CMS
470 that initially created the VM. Whoever the entity is, it will need to
471 know the <var>vif-id</var> that is associated with the network interface
472 of the VM through which the container interface's network traffic is
473 expected to go through. The entity that creates the container interface
474 will also need to choose an unused VLAN inside that VM.
475 </li>
476
477 <li>
478 The container spawning entity (either directly or through the CMS that
479 manages the underlying infrastructure) updates the OVN Northbound
480 database to include the new CIF, by adding a row to the
481 <code>Logical_Port</code> table. In the new row, <code>name</code> is
482 any unique identifier, <code>parent_name</code> is the <var>vif-id</var>
483 of the VM through which the CIF's network traffic is expected to go
484 through and the <code>tag</code> is the VLAN tag that identifies the
485 network traffic of that CIF.
486 </li>
487
488 <li>
489 <code>ovn-nbd</code> receives the OVN Northbound database update. In
490 turn, it makes the corresponding updates to the OVN Southbound
491 database, by adding rows to the OVN Southbound database's
492 <code>Pipeline</code> table to reflect the new port and also by
493 creating a new row in the <code>Bindings</code> table and
494 populating all its columns except the column that identifies the
495 <code>chassis</code>.
496 </li>
497
498 <li>
499 On every hypervisor, <code>ovn-controller</code> subscribes to the
500 changes in the <code>Bindings</code> table. When a new row is created
501 by <code>ovn-nbd</code> that includes a value in <code>parent_port</code>
502 column of <code>Bindings</code> table, the <code>ovn-controller</code>
503 in the hypervisor whose OVN integration bridge has that same value in
504 <var>vif-id</var> in <code>external-ids</code>:<code>iface-id</code>
505 updates the local hypervisor's OpenFlow tables so that packets to and
506 from the VIF with the particular VLAN <code>tag</code> are properly
507 handled. Afterward it updates the <code>chassis</code> column of
508 the <code>Bindings</code> to reflect the physical location.
509 </li>
510
511 <li>
512 One can only start the application inside the container after the
513 underlying network is ready. To support this, <code>ovn-nbd</code>
514 notices the updated <code>chassis</code> column in <code>Bindings</code>
515 table and updates the <ref column="up" table="Logical_Port"
516 db="OVN_NB"/> column in the OVN Northbound database's
517 <ref table="Logical_Port" db="OVN_NB"/> table to indicate that the
518 CIF is now up. The entity responsible to start the container application
519 queries this value and starts the application.
520 </li>
521
522 <li>
523 Eventually the entity that created and started the container, stops it.
524 The entity, through the CMS (or directly) deletes its row in the
525 <code>Logical_Port</code> table.
526 </li>
527
528 <li>
529 <code>ovn-nbd</code> receives the OVN Northbound update and in turn
530 updates the OVN Southbound database accordingly, by removing or
531 updating the rows from the OVN Southbound database
532 <code>Pipeline</code> table that were related to the now-destroyed
533 CIF. It also deletes the row in the <code>Bindings</code> table
534 for that CIF.
535 </li>
536
537 <li>
538 On every hypervisor, <code>ovn-controller</code> receives the
539 <code>Pipeline</code> table updates that <code>ovn-nbd</code> made in the
540 previous step. <code>ovn-controller</code> updates OpenFlow tables to
541 reflect the update.
542 </li>
543 </ol>
544 </manpage>