]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
More fixes for multi-nic support.
authorSumit Naiksatam <snaiksat@cisco.com>
Wed, 31 Aug 2011 04:06:34 +0000 (21:06 -0700)
committerSumit Naiksatam <snaiksat@cisco.com>
Wed, 31 Aug 2011 04:06:34 +0000 (21:06 -0700)
quantum/plugins/cisco/README
quantum/plugins/cisco/l2network_plugin.py
quantum/plugins/cisco/tests/unit/test_l2networkApi.py

index 29ebea720a86d9124734fc5eda6bbe6538355108..83512d16f5f99cb52ba8bb6172a9a6af730e5111 100755 (executable)
@@ -40,8 +40,7 @@ If you plan to just leverage the plugin framework, you do not need these.)
 * One or more UCS B200 series blade servers with M81KR VIC (aka \r
   Palo adapters) installed.\r
 * UCSM 2.0 (Capitola) Build 230 or above.\r
-* OpenStack Cactus release installation (additional patch is required,\r
-  details follow in this document)\r
+* OpenStack Diablo D3 or later (should have VIF-driver support)\r
 * RHEL 6.1 (as of this writing, UCS only officially supports RHEL, but\r
   it should be noted that Ubuntu support is planned in coming releases as well)\r
   ** Package: python-configobj-4.6.0-3.el6.noarch (or newer)\r
@@ -116,7 +115,17 @@ provider = quantum.plugins.cisco.l2network_plugin.L2Network
 --quantum_port=9696\r
 --libvirt_vif_driver=quantum.plugins.cisco.nova.vifdirect.Libvirt802dot1QbhDriver\r
 --libvirt_vif_type=802.1Qbh\r
\r
+\r
+    Note: To be able to bring up a VM on a UCS blade, you should first create a\r
+          port for that VM using the Quantum create port API. VM creation will\r
+          fail if an unused port is not available. If you have configured your\r
+          Nova project with more than one network, Nova will attempt to instantiate\r
+          the VM with one network interface (VIF) per configured network. To provide\r
+          plugin points for each of these VIFs, you will need to create multiple\r
+          Quantum ports, one for each of the networks, prior to starting the VM.\r
+          However, in this case you will need to use the Cisco multiport extension\r
+          API instead of the Quantum create port API. More details on using the\r
+          multiport extension follow in the section on mutli NIC support.\r
 \r
 4.  If you want to turn on support for Cisco Nexus switches:\r
     4a.  Uncomment the nexus_plugin property in \r
@@ -152,11 +161,11 @@ name=quantum.plugins.cisco.nexus.cisco_nexus_network_driver.CiscoNEXUSDriver
          this step and remove the old hostkey from ~/.ssh/known_hosts.\r
          \r
 5.  Plugin Persistence framework setup:\r
-       5a.  Create quantum_l2network database in mysql with the following command -\r
+    5a.  Create quantum_l2network database in mysql with the following command -\r
        \r
 mysql -u<mysqlusername> -p<mysqlpassword> -e "create database quantum_l2network"\r
 \r
-       5b.  Enter the quantum_l2network database configuration info in the \r
+    5b.  Enter the quantum_l2network database configuration info in the \r
          quantum/plugins/cisco/conf/db_conn.ini file.\r
          \r
     5c.  If there is a change in the plugin configuration, service would need \r
@@ -175,12 +184,6 @@ mysql -u<mysqlusername> -p<mysqlpassword> -e "create database quantum_l2network"
 username=admin\r
 password=mySecretPasswordForUCSM\r
 \r
-# Provide the Nova DB credentials.\r
-# The IP address should be the same as in nova.ini.\r
-[10.0.0.3]\r
-username=nova\r
-password=mySecretPasswordForNova\r
-\r
 # Provide the Nexus credentials, if you are using Nexus switches.\r
 # If not this will be ignored.\r
 [10.0.0.1]\r
@@ -191,7 +194,7 @@ password=mySecretPasswordForNexus
     quantum/plugins/cisco/conf/ucs_inventory.ini file. You can configure multiple\r
     UCSMs per deployment, multiple chassis per UCSM, and multiple blades per\r
     chassis. Chassis ID and blade ID can be obtained from the UCSM (they will\r
-    typically numbers like 1, 2, 3, etc.\r
+    typically be numbers like 1, 2, 3, etc.)\r
 \r
 [ucsm-1]\r
 ip_address = <put_ucsm_ip_address_here>\r
@@ -224,6 +227,42 @@ host_name = <put_hostname_here>
     Once you've put right what once went wrong, leap on.\r
 \r
 \r
+Using the Command Line Client to work with this Plugin\r
+------------------------------------------------------\r
+A command line client is packaged with this plugin. This module can be used\r
+to invoke the core API as well as the extensions API, so that you don't have\r
+to switch between different CLI modules (it internally invokes the Quantum\r
+CLI module for the core APIs to ensure consistency when using either). This\r
+command line client can be invoked as follows:\r
+\r
+PYTHONPATH=. python quantum/plugins/cisco/client/cli.py \r
+\r
+\r
+Multi NIC support for VMs\r
+-------------------------\r
+As indicated earlier, if your Nova setup has a project with more than one network,\r
+Nova will try to create a network interface (VIF) on the VM for each of those\r
+networks. That in turn implies that you should have created Quantum ports for each\r
+of those VIFs. These ports need to be using the following rest call:\r
+\r
+POST /v1.0/extensions/csco/tenants/{tenant_id}/multiport/\r
+\r
+with request body:\r
+\r
+{'multiport': \r
+ {'status': 'ACTIVE',\r
+  'net_id_list': net_id_list,\r
+  'ports_desc': {'key': 'value'}}}\r
+\r
+where,\r
+\r
+net_id_list is a list of network IDs: [netid1, netid2, ...]\r
+\r
+The corresponding CLI for this operation is as follows:\r
+\r
+PYTHONPATH=. python quantum/plugins/cisco/client/cli.py create_multiport <tenant_id> <net_id1,net_id2,...>\r
+\r
+\r
 How to test the installation\r
 ----------------------------\r
 The unit tests are located at quantum/plugins/cisco/tests/unit. They can be\r
index 218d369ffaf7ffc8e0f0d6cee83b610fd6af52eb..dfd05b39c891407e4ee1ba3af75feeba6d3e42dc 100644 (file)
@@ -251,9 +251,16 @@ class L2Network(QuantumPluginBase):
         """
         LOG.debug("plug_interface() called\n")
         network = db.network_get(net_id)
-        self._invoke_device_plugins(self._func_name(), [tenant_id, net_id,
-                                                     port_id,
-                                                     remote_interface_id])
+        port = db.port_get(net_id, port_id)
+        attachment_id = port[const.INTERFACEID]
+        if attachment_id and remote_interface_id != attachment_id:
+            raise exc.PortInUse(port_id=port_id, net_id=net_id,
+                                att_id=attachment_id)
+        self._invoke_device_plugins(self._func_name(), [tenant_id,
+                                                        net_id, port_id,
+                                                        remote_interface_id])
+        if attachment_id == None:
+            db.port_set_attachment(net_id, port_id, remote_interface_id)
         #Note: The remote_interface_id gets associated with the port
         # when the VM is instantiated. The plug interface call results
         # in putting the port on the VLAN associated with this network
index 901da1b8aeab36b652cf7d68dcaa6aeafb7c2e33..7b4bfac737edebaced5df69858876c2b2552b46c 100644 (file)
@@ -506,13 +506,14 @@ class CoreAPITestFunc(unittest.TestCase):
         """
 
         LOG.debug("test_plug_interface_portInUse - START")
+        current_interface = "current_interface"
         new_net_dict = self._l2network_plugin.create_network(
                                 tenant_id, self.network_name)
         port_dict = self._l2network_plugin.create_port(
                         tenant_id, new_net_dict[const.NET_ID], self.port_state)
         self._l2network_plugin.plug_interface(
                         tenant_id, new_net_dict[const.NET_ID],
-                        port_dict[const.PORT_ID], remote_interface)
+                        port_dict[const.PORT_ID], current_interface)
         self.assertRaises(exc.PortInUse,
                               self._l2network_plugin.plug_interface, tenant_id,
                               new_net_dict[const.NET_ID],