diff --git a/api/src/com/cloud/api/commands/DeleteAutoScalePolicyCmd.java b/api/src/com/cloud/api/commands/DeleteAutoScalePolicyCmd.java index ec6e151347b..852fccd88fb 100644 --- a/api/src/com/cloud/api/commands/DeleteAutoScalePolicyCmd.java +++ b/api/src/com/cloud/api/commands/DeleteAutoScalePolicyCmd.java @@ -28,30 +28,29 @@ import com.cloud.network.as.AutoScalePolicy; import com.cloud.user.Account; import com.cloud.user.UserContext; -@Implementation(description="Deletes a autoscale policy.", responseObject=SuccessResponse.class) +@Implementation(description = "Deletes a autoscale policy.", responseObject = SuccessResponse.class) public class DeleteAutoScalePolicyCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DeleteAutoScalePolicyCmd.class.getName()); private static final String s_name = "deleteautoscalepolicyresponse"; - ///////////////////////////////////////////////////// - //////////////// API parameters ///////////////////// - ///////////////////////////////////////////////////// + // /////////////////////////////////////////////////// + // ////////////// API parameters ///////////////////// + // /////////////////////////////////////////////////// - @IdentityMapper(entityTableName="autoscale_policies") - @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the autoscale policy") + @IdentityMapper(entityTableName = "autoscale_policies") + @Parameter(name = ApiConstants.ID, type = CommandType.LONG, required = true, description = "the ID of the autoscale policy") private Long id; - - ///////////////////////////////////////////////////// - /////////////////// Accessors /////////////////////// - ///////////////////////////////////////////////////// + // /////////////////////////////////////////////////// + // ///////////////// Accessors /////////////////////// + // /////////////////////////////////////////////////// public Long getId() { return id; } - ///////////////////////////////////////////////////// - /////////////// API Implementation/////////////////// - ///////////////////////////////////////////////////// + // /////////////////////////////////////////////////// + // ///////////// API Implementation/////////////////// + // /////////////////////////////////////////////////// @Override public String getCommandName() { @@ -65,7 +64,8 @@ public class DeleteAutoScalePolicyCmd extends BaseAsyncCmd { return autoScalePolicy.getAccountId(); } - return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked + return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are +// tracked } @Override @@ -75,17 +75,16 @@ public class DeleteAutoScalePolicyCmd extends BaseAsyncCmd { @Override public String getEventDescription() { - return "deleting AutoScale Policy: " + getId(); + return "deleting AutoScale Policy: " + getId(); } @Override - public void execute(){ - UserContext.current().setEventDetails("AutoScale Policy Id: "+getId()); + public void execute() { + UserContext.current().setEventDetails("AutoScale Policy Id: " + getId()); boolean result = _autoScaleService.deleteAutoScalePolicy(id); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); - s_logger.info("Successfully deleted autoscale policy id : " + getId()); this.setResponseObject(response); } else { s_logger.warn("Failed to delete autoscale policy " + getId()); diff --git a/api/src/com/cloud/api/commands/DeleteAutoScaleVmProfileCmd.java b/api/src/com/cloud/api/commands/DeleteAutoScaleVmProfileCmd.java index bb0c6d82aa9..6a19c24e01b 100644 --- a/api/src/com/cloud/api/commands/DeleteAutoScaleVmProfileCmd.java +++ b/api/src/com/cloud/api/commands/DeleteAutoScaleVmProfileCmd.java @@ -28,30 +28,29 @@ import com.cloud.network.as.AutoScaleVmProfile; import com.cloud.user.Account; import com.cloud.user.UserContext; -@Implementation(description="Deletes a autoscale vm profile.", responseObject=SuccessResponse.class) +@Implementation(description = "Deletes a autoscale vm profile.", responseObject = SuccessResponse.class) public class DeleteAutoScaleVmProfileCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DeleteAutoScaleVmProfileCmd.class.getName()); private static final String s_name = "deleteautoscalevmprofileresponse"; - ///////////////////////////////////////////////////// - //////////////// API parameters ///////////////////// - ///////////////////////////////////////////////////// + // /////////////////////////////////////////////////// + // ////////////// API parameters ///////////////////// + // /////////////////////////////////////////////////// - @IdentityMapper(entityTableName="autoscale_vmprofiles") - @Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the autoscale profile") + @IdentityMapper(entityTableName = "autoscale_vmprofiles") + @Parameter(name = ApiConstants.ID, type = CommandType.LONG, required = true, description = "the ID of the autoscale profile") private Long id; - - ///////////////////////////////////////////////////// - /////////////////// Accessors /////////////////////// - ///////////////////////////////////////////////////// + // /////////////////////////////////////////////////// + // ///////////////// Accessors /////////////////////// + // /////////////////////////////////////////////////// public Long getId() { return id; } - ///////////////////////////////////////////////////// - /////////////// API Implementation/////////////////// - ///////////////////////////////////////////////////// + // /////////////////////////////////////////////////// + // ///////////// API Implementation/////////////////// + // /////////////////////////////////////////////////// @Override public String getCommandName() { @@ -65,7 +64,8 @@ public class DeleteAutoScaleVmProfileCmd extends BaseAsyncCmd { return autoScaleVmProfile.getAccountId(); } - return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked + return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are +// tracked } @Override @@ -75,16 +75,15 @@ public class DeleteAutoScaleVmProfileCmd extends BaseAsyncCmd { @Override public String getEventDescription() { - return "deleting autoscale vm profile: " + getId(); + return "deleting autoscale vm profile: " + getId(); } @Override - public void execute(){ - UserContext.current().setEventDetails("AutoScale VM Profile Id: "+getId()); + public void execute() { + UserContext.current().setEventDetails("AutoScale VM Profile Id: " + getId()); boolean result = _autoScaleService.deleteAutoScaleVmProfile(id); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); - s_logger.info("Successfully deleted autoscale vm profile id : " + getId()); this.setResponseObject(response); } else { s_logger.warn("Failed to delete autoscale vm profile " + getId()); diff --git a/api/src/com/cloud/api/commands/DeleteConditionCmd.java b/api/src/com/cloud/api/commands/DeleteConditionCmd.java index da0c7defe0b..8d52ed89741 100644 --- a/api/src/com/cloud/api/commands/DeleteConditionCmd.java +++ b/api/src/com/cloud/api/commands/DeleteConditionCmd.java @@ -61,7 +61,6 @@ public class DeleteConditionCmd extends BaseAsyncCmd { } if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); - s_logger.info("Successfully deleted condition id : " + getId()); this.setResponseObject(response); } else { s_logger.warn("Failed to delete condition " + getId()); diff --git a/api/src/com/cloud/api/commands/DeleteCounterCmd.java b/api/src/com/cloud/api/commands/DeleteCounterCmd.java index d2e95dcb252..72d98bd72c2 100644 --- a/api/src/com/cloud/api/commands/DeleteCounterCmd.java +++ b/api/src/com/cloud/api/commands/DeleteCounterCmd.java @@ -61,10 +61,9 @@ public class DeleteCounterCmd extends BaseAsyncCmd { if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); - s_logger.info("Successfully deleted counter id : " + getId()); this.setResponseObject(response); } else { - s_logger.warn("Failed to delete counter"); + s_logger.warn("Failed to delete counter with Id: " + getId()); throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete counter."); } } diff --git a/server/src/com/cloud/network/as/AutoScaleManagerImpl.java b/server/src/com/cloud/network/as/AutoScaleManagerImpl.java index f7e821901fb..2d27ad1de1e 100644 --- a/server/src/com/cloud/network/as/AutoScaleManagerImpl.java +++ b/server/src/com/cloud/network/as/AutoScaleManagerImpl.java @@ -321,6 +321,7 @@ public class AutoScaleManagerImpl implements AutoScaleService, Manager { AutoScaleVmProfileVO profileVO = new AutoScaleVmProfileVO(cmd.getZoneId(), cmd.getDomainId(), cmd.getAccountId(), cmd.getServiceOfferingId(), cmd.getTemplateId(), cmd.getOtherDeployParams(), cmd.getSnmpCommunity(), cmd.getSnmpPort(), cmd.getDestroyVmGraceperiod(), autoscaleUserId, csUrl); profileVO = checkValidityAndPersist(profileVO); + s_logger.info("Successfully create AutoScale Vm Profile with Id: " + profileVO.getId()); return profileVO; } @@ -366,7 +367,7 @@ public class AutoScaleManagerImpl implements AutoScaleService, Manager { } vmProfile = checkValidityAndPersist(vmProfile); - s_logger.debug("Updated Auto Scale Vm Profile id:" + vmProfile.getId()); + s_logger.info("Updated Auto Scale Vm Profile id:" + vmProfile.getId()); return vmProfile; } @@ -380,7 +381,9 @@ public class AutoScaleManagerImpl implements AutoScaleService, Manager { if (_autoScaleVmGroupDao.isProfileInUse(id)) { throw new InvalidParameterValueException("Cannot delete AutoScale Vm Profile when it is in use by one more vm groups"); } - return _autoScaleVmProfileDao.remove(id); + boolean success = _autoScaleVmProfileDao.remove(id); + s_logger.info("Successfully deleted AutoScale Vm Profile with Id: " + id); + return success; } @Override @@ -486,7 +489,7 @@ public class AutoScaleManagerImpl implements AutoScaleService, Manager { AutoScalePolicyVO policyVO = new AutoScalePolicyVO(cmd.getDomainId(), cmd.getAccountId(), duration, quietTime, action); policyVO = checkValidityAndPersist(policyVO, cmd.getConditionIds()); - + s_logger.info("Successfully created AutoScale Policy with Id: " + policyVO.getId()); return policyVO; } @@ -516,6 +519,7 @@ public class AutoScaleManagerImpl implements AutoScaleService, Manager { return false; } txn.commit(); + s_logger.info("Successfully deleted autoscale policy id : " + id); return success; // successful } @@ -638,8 +642,7 @@ public class AutoScaleManagerImpl implements AutoScaleService, Manager { } policy = checkValidityAndPersist(policy, conditionIds); - - s_logger.debug("Updated Auto Scale Policy id:" + policyId); + s_logger.info("Successfully updated Auto Scale Policy id:" + policyId); return policy; } @@ -1003,8 +1006,8 @@ public class AutoScaleManagerImpl implements AutoScaleService, Manager { } ConditionVO condition = null; - s_logger.debug("Adding Condition "); condition = _conditionDao.persist(new ConditionVO(cid, threshold, cmd.getEntityOwnerId(), cmd.getDomainId(), op)); + s_logger.info("Successfully created condition with Id: " + condition.getId()); UserContext.current().setEventDetails(" Id: " + condition.getId()); return condition; @@ -1066,8 +1069,10 @@ public class AutoScaleManagerImpl implements AutoScaleService, Manager { throw new ResourceInUseException("Counter is in use."); } - s_logger.debug("Deleting Counter " + counter.getName()); - return _counterDao.remove(counterId); + boolean success = _counterDao.remove(counterId); + s_logger.info("Successfully deleted counter with Id: " + counterId); + + return success; } @Override @@ -1084,8 +1089,8 @@ public class AutoScaleManagerImpl implements AutoScaleService, Manager { s_logger.info("Cannot delete condition " + conditionId + " as it is being used in a condition."); throw new ResourceInUseException("Cannot delete Condition when it is in use by one or more AutoScale Policies."); } - s_logger.debug("Deleting Condition " + condition.getId()); - return _conditionDao.remove(conditionId); + boolean success = _conditionDao.remove(conditionId); + s_logger.info("Successfully deleted condition " + condition.getId()); } }