Summary

In the current Nova implementation, there are three types of network services: VLAN, flat, and flat DHCP. For each deployment of Nova, only one of these services can be configured to be used at a time. While the current network architecture in Nova works fine with this design, we would like to propose a more flexible design in which these network services are implemented more modularly, allowing them to be 'plugged-in' to Nova. With this design, it would allow third-party network services to be easily integrated into Nova.

In this POC implementation, we will try to solve the following issues in the current networking implementation:

  1. Strong coupling of compute and network services: In the current implementation, there are fairly large amount of network-related code that exist inside the compute code. This coupling makes it difficult swap the existing services with custom ones.

  2. Association of networking service at the deployment/application level: Networking services should be associated at the level of smallergranularity so that within one deployment of Nova, it would be possible to have multiple types of networks.

  3. Lack of L2 support: Because the currently available networking services are all L3-based networking, there is no option to create an L2-based network. By making network services pluggable, it would make it easier to implement and use an L2(or any type of) network.

Finally, it should be noted that despite these changes, all the currently available features should work the same way as they do now.

Rationale

Network services should be implemented in a pluggable manner so that various types of network service can be used with Nova.

Assumptions

Design

Network Service POC Overview

openstack-network-service-apis-generic-vs-specific.png

A pluggable network service is typically broken up into the following three parts:

  1. net-api: REST APIs for network management. Each plugin is responsible for providing a management tool(just like nova-manage) to manage its networks.

  2. net-agent: Pluggable module that defines generic interfaces called by the compute service. These APIs are meant to be run on the compute node.

  3. net-service: Pluggable service can optionally implement a network service, which is equivalent to nova-network service in the current Nova implementation, that handles various network tasks like DHCP, NAT, and IP allocation.

Management of the networks, such as creating networks, allocating IPs and virtual NICs are all accomplished through net-api. All the network-related code that currently exist in the compute code are moved to net-agent, thereby decoupling compute from the network services. Since net-service is optional, Nova does not have any knowledge of its existence. Only net-api and net-agent may access net-service. For example, for nova-compute to request a service from net-service, it must go through net-agent.

Nova Network Service Plugins

Nova currently comes with three types of network managers: VlanManager, FlatManager andFlatDHCPManager. These are converted into separate plugins in the new model. These plugins are defined in 'nova/networks' directory as distinct modules. The actual paths of these plugin modules are:

OpenStack Networking Concept

The networking in OpenStack consists of the following main concepts:

It is assumed that a VM instance is allowed to have multiple VNICs associated with it, with each one connecting to a port that belongs to different networks.

Project-Network Service Association

A project is associated with a network service. A project cannot be associated with more than one network service. By default, every project is associated with a network service defined by the flag, --default_network_service, where the value is the path to the plugin module. If this flag is not set, it defaults to VLAN(nova.network.vlan). New nova-manage commands are provided to help manage the association.

Network Service Configuration File

A list of available network services are listed in a network service configuration file. The location of this file is defined in the flag, --network_service_conf. If this flag is not defined, the default is /etc/nova/nova-network.conf. The format of this file is simply a list of Python module paths of the network services. Any blank line and or one that starts with '#' is ignored.

Example:

# Example network services
nova.network.flat
nova.network.flat_dhcp
nova.network.vlan

Network Management REST API

All the network management is done through the REST API implemented by each plugin. In this proposal, only the OpenStack API is applicable. The EC2 API still works the same way as before, but it does not support multiple NICs for an instance.

Each plugin has its own REST API URL that contains its name in the path. The format of the URL is: http://server:port/version/plugin_name/...

Flat, FlatDHCP and VLAN define the same APIs. They are:

The request and response formats are up to the plugins. They should, however, support both JSON and XML.

The routes for these APIs are set by the plugins themselves. The way this is accomplished is explained in the implementation section below.

Note: There is work being done for the new OpenStack Compute API(version 1.1). It is important to keep the network APIs in sync with the new design. (At the time of this writing, it is NOT in sync).

Data Store

Nova's database keeps the following data:

The actual data for virtual NICs, networks and ports are all plugin-specific, and therefore they belong in the data storage. If the plugin uses SQL as its data store, then it is the plugin's responsibility to define the migration scripts, data models and DB APIs.

For VLAN, Flat and FlatDHCP, a virtual NIC is an ethernet card, a port is a fixed IP, and a network is the same as that of the current Nova implementation.

Implementation

Nova-manage script changes

nova_manage script has new Project commands for network service management:

network commands in nova-manage are obsolete as all the network management commands are moved to the plugin-specific management tool scripts.

Network Service Classes

Database Changes

In the Nova DB, the following new tables are added:

ProjectNetworkServiceAssociation

+ id (PK)
+ project_id
+ network_service
+ deleted, created_at, deleted_at, ...

InstanceVirtualNicAssociation

+ id (PK)
+ instance_id(FK - instances.id)
+ virtual_nic_id
+ deleted, created_at, deleted_at, ...

In the VLAN, FlatDHCP and Flat plugins have EthernetCards table which represents the VNIC:

EthernetCards

+ id (PK)
+ mac_address
+ deleted, created_at, deleted_at, ...

Also, for all the built-in plugins, networks table is ported over from Nova DB. For VLAN and FlatDHCP, fixed_ips and floating_ips tables are copied over. For Flat, fixed_ips table is ported over and renamed to ip_addresses.

Plug-in Generic API

As mentioned earlier, each plugin consists of several components, and some of these components are required by Nova. The actual implementation of these components are up to the plugins, but the plugins must define generic APIs to return these modules/classes to Nova.

These generic APIs are:

Net Agent Generic API

All the net agent APIs are generic.

Test/Demo Plan

Unresolved issues


CategorySpec

Wiki: NetworkServicePOC (last edited 2011-03-31 06:23:24 by Hisaharu Ishii)