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