CS-16209. Correct the updateAutoScaleVmProfileCmd. The counterParams is

corrected.
Reviewed-By:Devdeep
This commit is contained in:
Vijay 2012-08-31 21:17:31 +05:30
parent c800454cb8
commit 2f1dbb17ce
2 changed files with 14 additions and 5 deletions

View File

@ -278,6 +278,7 @@ public class AutoScaleManagerImpl<Type> implements AutoScaleManager, AutoScaleSe
return policies;
}
@DB
protected AutoScaleVmProfileVO checkValidityAndPersist(AutoScaleVmProfileVO vmProfile) {
long templateId = vmProfile.getTemplateId();
long autoscaleUserId = vmProfile.getAutoScaleUserId();
@ -388,7 +389,7 @@ public class AutoScaleManagerImpl<Type> implements AutoScaleManager, AutoScaleSe
}
if (counterParamList != null) {
vmProfile.setCounterParams(counterParamList);
vmProfile.setCounterParamsForUpdate(counterParamList);
}
if (destroyVmGraceperiod != null) {
@ -1168,6 +1169,7 @@ public class AutoScaleManagerImpl<Type> implements AutoScaleManager, AutoScaleSe
return success;
}
@Override
public void cleanUpAutoScaleResources(Long accountId) {
// cleans Autoscale VmProfiles, AutoScale Policies and Conditions belonging to an account
int count = 0;

View File

@ -96,8 +96,7 @@ public class AutoScaleVmProfileVO implements AutoScaleVmProfile, Identity {
if (destroyVmGraceperiod != null) {
this.destroyVmGraceperiod = destroyVmGraceperiod;
}
setCounterParams(counterParamList);
setCounterParamsForUpdate(counterParamList);
}
@Override
@ -141,8 +140,11 @@ public class AutoScaleVmProfileVO implements AutoScaleVmProfile, Identity {
return paramsList;
}
public void setCounterParams(String counterParam) {
this.counterParams = counterParam;
}
public void setCounterParams(Map counterParamList) {
public void setCounterParamsForUpdate(Map counterParamList) {
StringBuilder sb = new StringBuilder("");
boolean isFirstParam = true;
if (counterParamList != null) {
@ -158,7 +160,12 @@ public class AutoScaleVmProfileVO implements AutoScaleVmProfile, Identity {
isFirstParam = false;
}
}
counterParams = sb.toString();
/*
* setCounterParams(String counterParam)'s String param is caught by UpdateBuilder and stored in an internal list.
* Which is used later to update the db. The variables in a VO object is not used to update the db.
* Hence calling the function which is intercepted.
* */
setCounterParams(sb.toString());
}
@Override