components/openstack/neutron/files/evs/plugin.py
branchs11-update
changeset 3196 4c06db2d9388
parent 3178 77584387a894
child 3322 52d29c34ff57
--- a/components/openstack/neutron/files/evs/plugin.py	Tue Jul 01 14:49:32 2014 -0700
+++ b/components/openstack/neutron/files/evs/plugin.py	Wed Jul 02 13:34:33 2014 -0700
@@ -432,10 +432,8 @@
         if proplist:
             propstr = ",".join(proplist)
 
-        # TODO(gmoodalb): extract the tenant id if an admin is creating for
-        # someone else
         evsname = subnet['subnet']['network_id']
-        tenantname = subnet['subnet']['tenant_id']
+        tenantname = self._get_tenant_id_for_create(context, subnet['subnet'])
         ipnet = self.evs_controller_addIPnet(tenantname, evsname, ipnetname,
                                              propstr)
         retval = self._convert_ipnet_to_subnet(ipnet)
@@ -626,7 +624,8 @@
         if not evsname:
             evsname = None
 
-        tenantname = network['network']['tenant_id']
+        tenantname = self._get_tenant_id_for_create(context,
+                                                    network['network'])
         proplist = []
         network_type = network['network'][providernet.NETWORK_TYPE]
         if attributes.is_attr_set(network_type):
@@ -817,10 +816,10 @@
             propstr = ",".join(proplist)
 
         evsname = port['port']['network_id']
-        tenantname = port['port']['tenant_id']
-        # TODO(gmoodalb): -- pull it from the network_id!!
+        tenantname = self._get_tenant_id_for_create(context, port['port'])
         if not tenantname:
-            tenantname = context.tenant_id
+            network = self.get_network(context, evsname)
+            tenantname = network['tenant_id']
         vport = self.evs_controller_addVPort(tenantname, evsname, vportname,
                                              propstr)
         retval = self._convert_vport_to_port(context, vport)
@@ -952,9 +951,10 @@
         a notification to L3 agent to release the port before we can
         delete the port"""
 
-        if port['device_owner'] not in [l3_constants.DEVICE_OWNER_ROUTER_INTF,
-                                        l3_constants.DEVICE_OWNER_ROUTER_GW,
-                                        l3_constants.DEVICE_OWNER_FLOATINGIP]:
+        device_owner = port['device_owner']
+        if device_owner not in [l3_constants.DEVICE_OWNER_ROUTER_INTF,
+                                l3_constants.DEVICE_OWNER_ROUTER_GW,
+                                l3_constants.DEVICE_OWNER_FLOATINGIP]:
             return
         router_id = port['device_id']
         port_update = {
@@ -964,10 +964,12 @@
             }
         }
         self.update_port(context, port['id'], port_update)
-        msg = l3_rpc_agent_api.L3AgentNotify.make_msg("routers_updated",
-                                                      routers=[router_id])
-        l3_rpc_agent_api.L3AgentNotify.call(context, msg,
-                                            topic=topics.L3_AGENT)
+        if device_owner in [l3_constants.DEVICE_OWNER_ROUTER_INTF,
+                            l3_constants.DEVICE_OWNER_ROUTER_GW]:
+            msg = l3_rpc_agent_api.L3AgentNotify.make_msg("routers_updated",
+                                                          routers=[router_id])
+            l3_rpc_agent_api.L3AgentNotify.call(context, msg,
+                                                topic=topics.L3_AGENT)
 
     @lockutils.synchronized('evs-plugin', 'neutron-')
     def evs_controller_removeVPort(self, tenantname, evsname, vportuuid):