@@ -214,7 +214,8 @@ def allocate_floating_ip(self, context, project_id, auto_assigned=False,
214214 # called into from other places
215215 try :
216216 if use_quota :
217- reservations = QUOTAS .reserve (context , floating_ips = 1 )
217+ reservations = QUOTAS .reserve (context , floating_ips = 1 ,
218+ project_id = project_id )
218219 except exception .OverQuota :
219220 LOG .warn (_ ("Quota exceeded for %s, tried to allocate "
220221 "floating IP" ), context .project_id )
@@ -229,11 +230,12 @@ def allocate_floating_ip(self, context, project_id, auto_assigned=False,
229230
230231 # Commit the reservations
231232 if use_quota :
232- QUOTAS .commit (context , reservations )
233+ QUOTAS .commit (context , reservations , project_id = project_id )
233234 except Exception :
234235 with excutils .save_and_reraise_exception ():
235236 if use_quota :
236- QUOTAS .rollback (context , reservations )
237+ QUOTAS .rollback (context , reservations ,
238+ project_id = project_id )
237239
238240 return floating_ip
239241
@@ -263,10 +265,13 @@ def deallocate_floating_ip(self, context, address,
263265 floating_ip = floating_ip ['address' ])
264266 self .notifier .info (context , 'network.floating_ip.deallocate' , payload )
265267
268+ project_id = floating_ip ['project_id' ]
266269 # Get reservations...
267270 try :
268271 if use_quota :
269- reservations = QUOTAS .reserve (context , floating_ips = - 1 )
272+ reservations = QUOTAS .reserve (context ,
273+ project_id = project_id ,
274+ floating_ips = - 1 )
270275 else :
271276 reservations = None
272277 except Exception :
@@ -278,7 +283,7 @@ def deallocate_floating_ip(self, context, address,
278283
279284 # Commit the reservations
280285 if reservations :
281- QUOTAS .commit (context , reservations )
286+ QUOTAS .commit (context , reservations , project_id = project_id )
282287
283288 @rpc_common .client_exceptions (exception .FloatingIpNotFoundForAddress )
284289 def associate_floating_ip (self , context , floating_address , fixed_address ,
0 commit comments