disable setting route until we have consistent way to determine external ip address
[plstackapi.git] / plstackapi / core / api / subnets.py
index a2417bc..b62a7ef 100644 (file)
@@ -41,8 +41,10 @@ def add_subnet(auth, fields):
     #driver.update_subnet(subnet.id, {'dns_nameservers': ['8.8.8.8', '8.8.4.4']})
 
     # add subnet as interface to slice's router
-    driver.add_router_interface(subnet.slice.router_id, subnet.subnet_id)     
-    
+    try: driver.add_router_interface(subnet.slice.router_id, subnet.subnet_id)
+    except: pass         
+    #add_route = 'route add -net %s dev br-ex gw 10.100.0.5' % self.cidr
+    commands.getstatusoutput(add_route)    
     subnet.save()
     return subnet
 
@@ -56,6 +58,8 @@ def delete_subnet(auth, filter={}):
         driver.delete_router_interface(subnet.slice.router_id, subnet.subnet_id)
         driver.delete_subnet(subnet.subnet_id) 
         subnet.delete()
+        #del_route = 'route del -net %s' % subnet.cidr
+    commands.getstatusoutput(del_route)
     return 1
 
 def get_subnets(auth, filter={}):