From 026cca46c65ee50505dd7f839542315eac55373c Mon Sep 17 00:00:00 2001 From: Alena Prokharchyk Date: Tue, 30 Jul 2013 14:11:29 -0700 Subject: [PATCH] CLOUDSTACK-3948: fixed createAutoscaleVmProfile - for situation when no autoscaleUserId is passed in, take it from caller user id, not caller account id --- .../command/user/autoscale/CreateAutoScaleVmProfileCmd.java | 4 ++-- server/src/com/cloud/network/as/AutoScaleManagerImpl.java | 6 +----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmProfileCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmProfileCmd.java index 87d4466e79a..05c985170e7 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmProfileCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmProfileCmd.java @@ -115,11 +115,11 @@ public class CreateAutoScaleVmProfileCmd extends BaseAsyncCreateCmd { return otherDeployParams; } - public Long getAutoscaleUserId() { + public long getAutoscaleUserId() { if (autoscaleUserId != null) { return autoscaleUserId; } else { - return UserContext.current().getCaller().getId(); + return UserContext.current().getCallerUserId(); } } diff --git a/server/src/com/cloud/network/as/AutoScaleManagerImpl.java b/server/src/com/cloud/network/as/AutoScaleManagerImpl.java index 247441e19cc..96f6adaadcd 100644 --- a/server/src/com/cloud/network/as/AutoScaleManagerImpl.java +++ b/server/src/com/cloud/network/as/AutoScaleManagerImpl.java @@ -311,7 +311,7 @@ public class AutoScaleManagerImpl extends ManagerBase implements AutoScale long zoneId = cmd.getZoneId(); long serviceOfferingId = cmd.getServiceOfferingId(); - Long autoscaleUserId = cmd.getAutoscaleUserId(); + long autoscaleUserId = cmd.getAutoscaleUserId(); DataCenter zone = _configMgr.getZone(zoneId); @@ -336,10 +336,6 @@ public class AutoScaleManagerImpl extends ManagerBase implements AutoScale */ ApiDispatcher.processParameters(new DeployVMCmd(), deployParams); - if (autoscaleUserId == null) { - autoscaleUserId = UserContext.current().getCallerUserId(); - } - AutoScaleVmProfileVO profileVO = new AutoScaleVmProfileVO(cmd.getZoneId(), cmd.getDomainId(), cmd.getAccountId(), cmd.getServiceOfferingId(), cmd.getTemplateId(), cmd.getOtherDeployParams(), cmd.getCounterParamList(), cmd.getDestroyVmGraceperiod(), autoscaleUserId); profileVO = checkValidityAndPersist(profileVO);