CLOUDSTACK-6236:Negative ref_cnt of template(snapshot/volume)_store_ref results in out-of-range error in Mysql

(cherry picked from commit cd8af6a3e2)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>

Conflicts:
	engine/schema/src/org/apache/cloudstack/storage/datastore/db/TemplateDataStoreVO.java
This commit is contained in:
Min Chen 2014-03-12 15:44:18 -07:00 committed by Rohit Yadav
parent e9d079ace1
commit 38bc20e67f
1 changed files with 6 additions and 1 deletions

View File

@ -350,7 +350,12 @@ public class VolumeDataStoreVO implements StateObject<ObjectInDataStoreStateMach
}
public void setRefCnt(Long refCnt) {
this.refCnt = refCnt;
if (refCnt > 0) {
refCnt--;
}
else {
s_logger.warn("We should not try to decrement a zero reference count even though our code has guarded");
}
}
public void incrRefCnt() {