From 686f9ae64fbf628cf96696c119d4170ea263def4 Mon Sep 17 00:00:00 2001 From: Prachi Damle Date: Tue, 16 Jul 2013 13:17:43 -0700 Subject: [PATCH] CLOUDSTACK-2155 Anti-Affinity -When Vm deployment is done in parallel , anti-affinity rule is not honored. - Changes to the API Cmd needed to use CallContext instead of UserContext --- .../api/command/admin/resource/CleanVMReservationsCmd.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/src/org/apache/cloudstack/api/command/admin/resource/CleanVMReservationsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/resource/CleanVMReservationsCmd.java index b0be7b2ee9f..2000edbf7a1 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/resource/CleanVMReservationsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/resource/CleanVMReservationsCmd.java @@ -22,10 +22,10 @@ import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.SuccessResponse; import org.apache.log4j.Logger; - +import org.apache.cloudstack.context.CallContext; import com.cloud.event.EventTypes; import com.cloud.user.Account; -import com.cloud.user.UserContext; + @APICommand(name = "cleanVMReservations", description = "Cleanups VM reservations in the database.", responseObject = SuccessResponse.class) public class CleanVMReservationsCmd extends BaseAsyncCmd { @@ -49,7 +49,7 @@ public class CleanVMReservationsCmd extends BaseAsyncCmd { @Override public long getEntityOwnerId() { - Account account = UserContext.current().getCaller(); + Account account = CallContext.current().getCallingAccount(); if (account != null) { return account.getId(); }