Multi-nic


 * Launchpad Entry: NovaSpec:multi-nic
 * Created: Trey Morris
 * Contributors: Trey Morris

Summary
Support for more than one NIC per instance. Rackspace requires two nic's minimum (1 public, 1 private), but this should be abstracted to support N NIC's. Currently Nova assumes 1 NIC. Changes will need to propagate to guest.

Release Note
Multi-nic allows users to have instances which are sitting on multiple networks. Using Rackspace as an example: public and service nets.

Rationale
Hosting providers (and other people surely as well) will have instances sitting on multiple networks. Instances will require multiple nics to play with the different networks.

Design
One vif per network. Get a list of networks associate with the current project, for each network, create a vif. I'll also be chopping up the mac address a bit to add networks to it. I plan to have the 24 bits after the initial "40:40" generated from the instance id (or just a straight counter), and the remaining 8 bits will generated from the network id. This means we'd have 16,777,216 possible instance mac addresses (counting zero) and each instance mac address can be further divided into a total of 256 networks (again counting zero). This gives us guaranteed unique mac addresses until we reach the number of instances above. Duplicate macs are fine as long as they don't end up in the same "huddle" zone. How to prevent that from occurring is, I believe, out of the scope of this blueprint.

UI Changes
The IPs for each vif will have to be displayed in the UI.

Code Changes
The spawn funciton in xenapi.vmops will be modified to set up multiple vifs. More networking info will have to be injected as well. The db schema will have to be changed per migrations below.

Migration
The mac_address field will be removed from the instances table. The fixed IPs table will have to allow a vm to be associated with multiple IPs (not sure if it is unique constrained at the moment), also it will have to store the label of the network associated with the IP <-> vm relationship so the IPs can be correctly defined. The project_id in the networks table will have to have its unique constraint removed.

Test/Demo Plan
Initially, create instances and see if they get multiple vifs. After xs-inject-networking, I'll check to make sure the networking is setup correctly.

Unresolved issues
There are multiple ways to do this. multiple vifs could be created on the same network, some networks may not have vifs associated with them. I'm not sure how to make these options. Initially I am coding this to create one vif per network for each instance.