mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-10-26 08:42:29 +01:00 
			
		
		
		
	Merge remote-tracking branch 'origin/txn-refactor'
Conflicts: engine/orchestration/src/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java server/src/com/cloud/configuration/ConfigurationManagerImpl.java server/src/com/cloud/metadata/ResourceMetaDataManagerImpl.java server/src/com/cloud/vm/UserVmManagerImpl.java
This commit is contained in:
		
						commit
						205a77a5bb
					
				| @ -17,8 +17,9 @@ | ||||
| package com.cloud.exception; | ||||
| 
 | ||||
| import com.cloud.utils.SerialVersionUID; | ||||
| import com.cloud.utils.exception.CloudRuntimeException; | ||||
| 
 | ||||
| public class ConcurrentOperationException extends CloudException { | ||||
| public class ConcurrentOperationException extends CloudRuntimeException { | ||||
| 
 | ||||
|     private static final long serialVersionUID = SerialVersionUID.ConcurrentOperationException; | ||||
| 
 | ||||
|  | ||||
| @ -26,7 +26,7 @@ import com.cloud.bridge.model.BucketPolicyVO; | ||||
| import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| 
 | ||||
| @Component | ||||
| @Local(value={BucketPolicyDao.class}) | ||||
| @ -42,7 +42,7 @@ public class BucketPolicyDaoImpl extends GenericDaoBase<BucketPolicyVO, Long> im | ||||
|     public BucketPolicyVO getByName( String bucketName ) { | ||||
|         SearchBuilder <BucketPolicyVO> searchByBucket = createSearchBuilder(); | ||||
|         searchByBucket.and("BucketName", searchByBucket.entity().getBucketName(), SearchCriteria.Op.EQ); | ||||
|         Transaction txn = Transaction.open(Transaction.AWSAPI_DB); | ||||
|         TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.AWSAPI_DB); | ||||
|         try { | ||||
|             txn.start(); | ||||
|             SearchCriteria<BucketPolicyVO> sc = searchByBucket.create(); | ||||
| @ -59,7 +59,7 @@ public class BucketPolicyDaoImpl extends GenericDaoBase<BucketPolicyVO, Long> im | ||||
|     public void deletePolicy( String bucketName ) { | ||||
|         SearchBuilder <BucketPolicyVO> deleteByBucket = createSearchBuilder(); | ||||
|         deleteByBucket.and("BucketName", deleteByBucket.entity().getBucketName(), SearchCriteria.Op.EQ); | ||||
|         Transaction txn = Transaction.open(Transaction.AWSAPI_DB); | ||||
|         TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.AWSAPI_DB); | ||||
|         try { | ||||
|             txn.start(); | ||||
|             SearchCriteria<BucketPolicyVO> sc = deleteByBucket.create(); | ||||
|  | ||||
| @ -25,6 +25,7 @@ import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| 
 | ||||
| @Component | ||||
| @Local(value={CloudStackAccountDao.class}) | ||||
| @ -34,7 +35,7 @@ public class CloudStackAccountDaoImpl extends GenericDaoBase<CloudStackAccountVO | ||||
|     public String getDefaultZoneId(String accountId) { | ||||
|          | ||||
|         SearchBuilder<CloudStackAccountVO> SearchByUUID = createSearchBuilder(); | ||||
|         Transaction txn = Transaction.open(Transaction.CLOUD_DB); | ||||
|         TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.CLOUD_DB); | ||||
|         try { | ||||
|             txn.start(); | ||||
|             SearchByUUID.and("uuid", SearchByUUID.entity().getUuid(), | ||||
|  | ||||
| @ -27,6 +27,7 @@ import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| 
 | ||||
| @Component | ||||
| @Local(value={CloudStackConfigurationDao.class}) | ||||
| @ -42,7 +43,7 @@ public class CloudStackConfigurationDaoImpl extends GenericDaoBase<CloudStackCon | ||||
|     @DB | ||||
|     public String getConfigValue(String name) { | ||||
|         NameSearch.and("name", NameSearch.entity().getName(), SearchCriteria.Op.EQ); | ||||
|         Transaction txn = Transaction.open("cloud", Transaction.CLOUD_DB, true); | ||||
|         TransactionLegacy txn = TransactionLegacy.open("cloud", TransactionLegacy.CLOUD_DB, true); | ||||
|         try { | ||||
|             txn.start(); | ||||
|             SearchCriteria<CloudStackConfigurationVO> sc = NameSearch.create(); | ||||
|  | ||||
| @ -29,6 +29,7 @@ import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| 
 | ||||
| @Component | ||||
| @Local(value={CloudStackSvcOfferingDao.class}) | ||||
| @ -42,7 +43,7 @@ public class CloudStackSvcOfferingDaoImpl extends GenericDaoBase<CloudStackServi | ||||
|         SearchBuilder <CloudStackServiceOfferingVO> searchByName = createSearchBuilder(); | ||||
|         searchByName.and("name", searchByName.entity().getName(), SearchCriteria.Op.EQ); | ||||
|         searchByName.done(); | ||||
|         Transaction txn = Transaction.open(Transaction.CLOUD_DB); | ||||
|         TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.CLOUD_DB); | ||||
|         try { | ||||
|             txn.start(); | ||||
|             SearchCriteria<CloudStackServiceOfferingVO> sc = searchByName.create(); | ||||
| @ -61,7 +62,7 @@ public class CloudStackSvcOfferingDaoImpl extends GenericDaoBase<CloudStackServi | ||||
|         SearchBuilder <CloudStackServiceOfferingVO> searchByID = createSearchBuilder(); | ||||
|         searchByID.and("uuid", searchByID.entity().getUuid(), SearchCriteria.Op.EQ); | ||||
|         searchByID.done(); | ||||
|         Transaction txn = Transaction.open(Transaction.CLOUD_DB); | ||||
|         TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.CLOUD_DB); | ||||
|         try { | ||||
|             txn.start(); | ||||
|             SearchCriteria<CloudStackServiceOfferingVO> sc = searchByID.create(); | ||||
|  | ||||
| @ -26,6 +26,7 @@ import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| import com.cloud.utils.crypt.DBEncryptionUtil; | ||||
| 
 | ||||
| @Component | ||||
| @ -43,7 +44,7 @@ public class CloudStackUserDaoImpl extends GenericDaoBase<CloudStackUserVO, Stri | ||||
|         SearchBuilder <CloudStackUserVO> searchByAccessKey = createSearchBuilder(); | ||||
|         searchByAccessKey.and("apiKey", searchByAccessKey.entity().getApiKey(), SearchCriteria.Op.EQ); | ||||
|         searchByAccessKey.done(); | ||||
|         Transaction txn = Transaction.open(Transaction.CLOUD_DB); | ||||
|         TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.CLOUD_DB); | ||||
|         try { | ||||
|             txn.start(); | ||||
|             SearchCriteria<CloudStackUserVO> sc = searchByAccessKey.create(); | ||||
|  | ||||
| @ -25,6 +25,7 @@ import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| 
 | ||||
| @Component | ||||
| @Local(value={MHostDao.class}) | ||||
| @ -38,7 +39,7 @@ public class MHostDaoImpl extends GenericDaoBase<MHostVO, Long> implements MHost | ||||
| 	@Override | ||||
| 	public MHostVO getByHostKey(String hostKey) { | ||||
| 	    NameSearch.and("MHostKey", NameSearch.entity().getHostKey(), SearchCriteria.Op.EQ); | ||||
| 	    Transaction txn = Transaction.open("cloudbridge", Transaction.AWSAPI_DB, true); | ||||
| 	    TransactionLegacy txn = TransactionLegacy.open("cloudbridge", TransactionLegacy.AWSAPI_DB, true); | ||||
| 	    try { | ||||
| 		txn.start(); | ||||
| 		SearchCriteria<MHostVO> sc = NameSearch.create(); | ||||
| @ -52,7 +53,7 @@ public class MHostDaoImpl extends GenericDaoBase<MHostVO, Long> implements MHost | ||||
| 
 | ||||
|     @Override | ||||
|     public void updateHeartBeat(MHostVO mhost) { | ||||
|         Transaction txn = Transaction.open("cloudbridge", Transaction.AWSAPI_DB, true); | ||||
|         TransactionLegacy txn = TransactionLegacy.open("cloudbridge", TransactionLegacy.AWSAPI_DB, true); | ||||
|         try { | ||||
|             txn.start(); | ||||
|             update(mhost.getId(), mhost); | ||||
|  | ||||
| @ -25,6 +25,7 @@ import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| 
 | ||||
| @Component | ||||
| @Local(value={MHostMountDao.class}) | ||||
| @ -37,7 +38,7 @@ public class MHostMountDaoImpl extends GenericDaoBase<MHostMountVO, Long> implem | ||||
| 	public MHostMountVO getHostMount(long mHostId, long sHostId) {  | ||||
| 	    SearchByMHostID.and("MHostID", SearchByMHostID.entity().getmHostID(), SearchCriteria.Op.EQ); | ||||
| 	    SearchByMHostID.and("SHostID", SearchByMHostID.entity().getsHostID(), SearchCriteria.Op.EQ); | ||||
| 	    Transaction txn = Transaction.open(Transaction.AWSAPI_DB); | ||||
| 	    TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.AWSAPI_DB); | ||||
| 	    try { | ||||
| 		txn.start(); | ||||
| 		SearchCriteria<MHostMountVO> sc = SearchByMHostID.create(); | ||||
|  | ||||
| @ -28,6 +28,7 @@ import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| 
 | ||||
| @Component | ||||
| @Local(value={MultiPartPartsDao.class}) | ||||
| @ -42,7 +43,7 @@ public class MultiPartPartsDaoImpl extends GenericDaoBase<MultiPartPartsVO, Long | ||||
|         ByUploadID.and("partNumber", ByUploadID.entity().getPartNumber(), SearchCriteria.Op.LT); | ||||
|         Filter filter = new Filter(MultiPartPartsVO.class, "partNumber", Boolean.TRUE, null, null); | ||||
|          | ||||
|         Transaction txn = Transaction.currentTxn();  // Transaction.open("cloudbridge", Transaction.AWSAPI_DB, true); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn();  // Transaction.open("cloudbridge", Transaction.AWSAPI_DB, true); | ||||
|         try { | ||||
|             txn.start(); | ||||
|             SearchCriteria<MultiPartPartsVO> sc = ByUploadID.create(); | ||||
| @ -61,7 +62,7 @@ public class MultiPartPartsDaoImpl extends GenericDaoBase<MultiPartPartsVO, Long | ||||
|         SearchBuilder<MultiPartPartsVO> byUploadID = createSearchBuilder(); | ||||
|         byUploadID.and("UploadID", byUploadID.entity().getUploadid(), SearchCriteria.Op.EQ); | ||||
|         byUploadID.and("partNumber", byUploadID.entity().getPartNumber(), SearchCriteria.Op.GT); | ||||
|         Transaction txn = Transaction.currentTxn();  // Transaction.open("cloudbridge", Transaction.AWSAPI_DB, true); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn();  // Transaction.open("cloudbridge", Transaction.AWSAPI_DB, true); | ||||
|         try { | ||||
|             txn.start(); | ||||
|             SearchCriteria<MultiPartPartsVO> sc = byUploadID.create(); | ||||
| @ -82,7 +83,7 @@ public class MultiPartPartsDaoImpl extends GenericDaoBase<MultiPartPartsVO, Long | ||||
|         SearchBuilder<MultiPartPartsVO> byUploadID = createSearchBuilder(); | ||||
|         byUploadID.and("UploadID", byUploadID.entity().getUploadid(), SearchCriteria.Op.EQ); | ||||
|         byUploadID.and("partNumber", byUploadID.entity().getPartNumber(), SearchCriteria.Op.EQ); | ||||
|         Transaction txn = Transaction.currentTxn();  // Transaction.open("cloudbridge", Transaction.AWSAPI_DB, true); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn();  // Transaction.open("cloudbridge", Transaction.AWSAPI_DB, true); | ||||
|         try { | ||||
|             txn.start(); | ||||
|             SearchCriteria<MultiPartPartsVO> sc = byUploadID.create(); | ||||
| @ -102,7 +103,7 @@ public class MultiPartPartsDaoImpl extends GenericDaoBase<MultiPartPartsVO, Long | ||||
|         SearchBuilder<MultiPartPartsVO> byUploadID = createSearchBuilder(); | ||||
|         byUploadID.and("UploadID", byUploadID.entity().getUploadid(), SearchCriteria.Op.EQ); | ||||
|         byUploadID.and("partNumber", byUploadID.entity().getPartNumber(), SearchCriteria.Op.EQ); | ||||
|         Transaction txn = Transaction.currentTxn();  // Transaction.open("cloudbridge", Transaction.AWSAPI_DB, true); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn();  // Transaction.open("cloudbridge", Transaction.AWSAPI_DB, true); | ||||
|         try { | ||||
|             txn.start(); | ||||
|             SearchCriteria<MultiPartPartsVO> sc = byUploadID.create(); | ||||
|  | ||||
| @ -33,6 +33,7 @@ import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| 
 | ||||
| @Component | ||||
| @Local(value={MultiPartUploadsDao.class}) | ||||
| @ -42,9 +43,9 @@ public class MultiPartUploadsDaoImpl extends GenericDaoBase<MultiPartUploadsVO, | ||||
|     public OrderedPair<String,String> multipartExits( int uploadId ) { | ||||
|         MultiPartUploadsVO uploadvo = null; | ||||
|          | ||||
|         Transaction txn = null;  | ||||
|         TransactionLegacy txn = null;  | ||||
|         try { | ||||
|             txn = Transaction.open(Transaction.AWSAPI_DB); | ||||
|             txn = TransactionLegacy.open(TransactionLegacy.AWSAPI_DB); | ||||
|             uploadvo = findById(new Long(uploadId)); | ||||
|             if (null != uploadvo) | ||||
|                 return new OrderedPair<String,String>(uploadvo.getAccessKey(), uploadvo.getNameKey()); | ||||
| @ -58,9 +59,9 @@ public class MultiPartUploadsDaoImpl extends GenericDaoBase<MultiPartUploadsVO, | ||||
|     @Override | ||||
|     public void deleteUpload(int uploadId) { | ||||
|          | ||||
|         Transaction txn = null;  | ||||
|         TransactionLegacy txn = null;  | ||||
|         try { | ||||
|             txn = Transaction.open(Transaction.AWSAPI_DB); | ||||
|             txn = TransactionLegacy.open(TransactionLegacy.AWSAPI_DB); | ||||
|             remove(new Long(uploadId)); | ||||
|             txn.commit(); | ||||
|         }finally { | ||||
| @ -70,10 +71,10 @@ public class MultiPartUploadsDaoImpl extends GenericDaoBase<MultiPartUploadsVO, | ||||
|      | ||||
|     @Override | ||||
|     public String getAtrributeValue(String attribute, int uploadid) { | ||||
|         Transaction txn = null; | ||||
|         TransactionLegacy txn = null; | ||||
|         MultiPartUploadsVO uploadvo = null; | ||||
|         try { | ||||
|             txn = Transaction.open(Transaction.AWSAPI_DB); | ||||
|             txn = TransactionLegacy.open(TransactionLegacy.AWSAPI_DB); | ||||
|             uploadvo = findById(new Long(uploadid)); | ||||
|             if (null != uploadvo) { | ||||
|                 if ( attribute.equalsIgnoreCase("AccessKey") ) | ||||
| @ -105,7 +106,7 @@ public class MultiPartUploadsDaoImpl extends GenericDaoBase<MultiPartUploadsVO, | ||||
|        Filter filter = new Filter(MultiPartUploadsVO.class, "nameKey", Boolean.TRUE, null, null); | ||||
|        filter.addOrderBy(MultiPartUploadsVO.class, "createTime", Boolean.TRUE); | ||||
|         | ||||
|        Transaction txn = Transaction.open("cloudbridge", Transaction.AWSAPI_DB, true); | ||||
|        TransactionLegacy txn = TransactionLegacy.open("cloudbridge", TransactionLegacy.AWSAPI_DB, true); | ||||
|        try { | ||||
|            txn.start(); | ||||
|            SearchCriteria<MultiPartUploadsVO> sc = byBucket.create(); | ||||
|  | ||||
| @ -34,6 +34,7 @@ import com.cloud.bridge.service.core.s3.S3MultipartPart; | ||||
| import com.cloud.bridge.service.core.s3.S3MultipartUpload; | ||||
| import com.cloud.bridge.util.OrderedPair; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| 
 | ||||
| public class MultipartLoadDao { | ||||
|     public static final Logger logger = Logger.getLogger(MultipartLoadDao.class); | ||||
| @ -94,9 +95,9 @@ public class MultipartLoadDao { | ||||
|      */ | ||||
|     public int initiateUpload( String accessKey, String bucketName, String key, String cannedAccess, S3MetaDataEntry[] meta ) { | ||||
|         int uploadId = -1; | ||||
|         Transaction txn = null; | ||||
|         TransactionLegacy txn = null; | ||||
|         try { | ||||
|             txn = Transaction.open(Transaction.AWSAPI_DB); | ||||
|             txn = TransactionLegacy.open(TransactionLegacy.AWSAPI_DB); | ||||
|             Date tod = new Date(); | ||||
|             MultiPartUploadsVO uploadVO = new MultiPartUploadsVO(accessKey, | ||||
|                     bucketName, key, cannedAccess, tod); | ||||
| @ -315,9 +316,9 @@ public class MultipartLoadDao { | ||||
|     private void saveMultipartMeta( int uploadId, S3MetaDataEntry[] meta ) { | ||||
|         if (null == meta) return; | ||||
| 
 | ||||
|         Transaction txn = null; | ||||
|         TransactionLegacy txn = null; | ||||
|         try { | ||||
|             txn = Transaction.open(Transaction.AWSAPI_DB); | ||||
|             txn = TransactionLegacy.open(TransactionLegacy.AWSAPI_DB); | ||||
|             for( int i=0; i < meta.length; i++ )  | ||||
|             { | ||||
|                 S3MetaDataEntry entry = meta[i]; | ||||
|  | ||||
| @ -27,6 +27,7 @@ import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| 
 | ||||
| @Component | ||||
| @Local(value={MultipartMetaDao.class}) | ||||
| @ -37,7 +38,7 @@ public class MultipartMetaDaoImpl extends GenericDaoBase<MultipartMetaVO, Long> | ||||
|         SearchBuilder <MultipartMetaVO> searchByUID = createSearchBuilder(); | ||||
|         searchByUID.and("UploadID", searchByUID.entity().getUploadID(), SearchCriteria.Op.EQ); | ||||
|         searchByUID.done(); | ||||
|         Transaction txn = Transaction.open(Transaction.AWSAPI_DB); | ||||
|         TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.AWSAPI_DB); | ||||
|         try { | ||||
|             txn.start(); | ||||
|             SearchCriteria<MultipartMetaVO> sc = searchByUID.create(); | ||||
|  | ||||
| @ -29,6 +29,7 @@ import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| 
 | ||||
| @Component | ||||
| @Local(value={OfferingDao.class}) | ||||
| @ -39,7 +40,7 @@ public class OfferingDaoImpl extends GenericDaoBase<OfferingBundleVO, Long> impl | ||||
| 	 | ||||
| 	@Override | ||||
| 	public int getOfferingCount() { | ||||
|        Transaction txn = Transaction.open(Transaction.AWSAPI_DB); | ||||
| 	    TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.AWSAPI_DB); | ||||
|         try { | ||||
|             txn.start(); | ||||
|             return listAll().size(); | ||||
| @ -56,7 +57,7 @@ public class OfferingDaoImpl extends GenericDaoBase<OfferingBundleVO, Long> impl | ||||
|        SearchBuilder <OfferingBundleVO> searchByAmazon = createSearchBuilder(); | ||||
|        searchByAmazon.and("AmazonEC2Offering", searchByAmazon.entity().getAmazonOffering() , SearchCriteria.Op.EQ); | ||||
|        searchByAmazon.done(); | ||||
|        Transaction txn = Transaction.open(Transaction.AWSAPI_DB); | ||||
|        TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.AWSAPI_DB); | ||||
|        try { | ||||
|            txn.start(); | ||||
|            SearchCriteria<OfferingBundleVO> sc = searchByAmazon.create(); | ||||
| @ -74,7 +75,7 @@ public class OfferingDaoImpl extends GenericDaoBase<OfferingBundleVO, Long> impl | ||||
| 	       SearchBuilder <OfferingBundleVO> searchByAmazon = createSearchBuilder(); | ||||
| 	       searchByAmazon.and("CloudStackOffering", searchByAmazon.entity().getAmazonOffering() , SearchCriteria.Op.EQ); | ||||
| 	       searchByAmazon.done(); | ||||
| 	       Transaction txn = Transaction.open(Transaction.AWSAPI_DB); | ||||
| 	       TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.AWSAPI_DB); | ||||
| 	       try { | ||||
| 	           txn.start(); | ||||
| 	           SearchCriteria<OfferingBundleVO> sc = searchByAmazon.create(); | ||||
| @ -93,7 +94,7 @@ public class OfferingDaoImpl extends GenericDaoBase<OfferingBundleVO, Long> impl | ||||
|         searchByAmazon.and("CloudStackOffering", searchByAmazon.entity().getAmazonOffering() , SearchCriteria.Op.EQ); | ||||
|         searchByAmazon.and("AmazonEC2Offering", searchByAmazon.entity().getCloudstackOffering() , SearchCriteria.Op.EQ); | ||||
|         searchByAmazon.done(); | ||||
|         Transaction txn = Transaction.open(Transaction.AWSAPI_DB); | ||||
|         TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.AWSAPI_DB); | ||||
|         OfferingBundleVO offering = null; | ||||
|         try { | ||||
|             txn.start(); | ||||
| @ -122,7 +123,7 @@ public class OfferingDaoImpl extends GenericDaoBase<OfferingBundleVO, Long> impl | ||||
| 	    SearchBuilder <OfferingBundleVO> searchByAmazon = createSearchBuilder(); | ||||
|         searchByAmazon.and("AmazonEC2Offering", searchByAmazon.entity().getAmazonOffering() , SearchCriteria.Op.EQ); | ||||
|         searchByAmazon.done(); | ||||
|         Transaction txn = Transaction.open(Transaction.AWSAPI_DB); | ||||
|         TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.AWSAPI_DB); | ||||
|         try { | ||||
|             txn.start(); | ||||
|             SearchCriteria<OfferingBundleVO> sc = searchByAmazon.create(); | ||||
|  | ||||
| @ -32,6 +32,7 @@ import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| 
 | ||||
| @Component | ||||
| @Local(value={SAclDao.class}) | ||||
| @ -46,7 +47,7 @@ public class SAclDaoImpl extends GenericDaoBase<SAclVO, Long> implements SAclDao | ||||
| 	    SearchByTarget.and("TargetID", SearchByTarget.entity().getTargetId(), SearchCriteria.Op.EQ); | ||||
| 	    SearchByTarget.done(); | ||||
| 	    Filter filter = new Filter(SAclVO.class, "grantOrder", Boolean.TRUE, null, null); | ||||
| 	    Transaction txn = Transaction.open( Transaction.AWSAPI_DB); | ||||
| 	    TransactionLegacy txn = TransactionLegacy.open( TransactionLegacy.AWSAPI_DB); | ||||
| 	    try { | ||||
| 		txn.start(); | ||||
| 		SearchCriteria<SAclVO> sc = SearchByTarget.create(); | ||||
| @ -66,7 +67,7 @@ public class SAclDaoImpl extends GenericDaoBase<SAclVO, Long> implements SAclDao | ||||
| 	    SearchByAcl.and("TargetID", SearchByAcl.entity().getTargetId(), SearchCriteria.Op.EQ); | ||||
| 	    SearchByAcl.and("GranteeCanonicalID", SearchByAcl.entity().getGranteeCanonicalId(), SearchCriteria.Op.EQ); | ||||
| 	    Filter filter = new Filter(SAclVO.class, "grantOrder", Boolean.TRUE, null, null); | ||||
| 	    Transaction txn = Transaction.open( Transaction.AWSAPI_DB); | ||||
| 	    TransactionLegacy txn = TransactionLegacy.open( TransactionLegacy.AWSAPI_DB); | ||||
| 	    try { | ||||
|     		txn.start(); | ||||
|     		SearchCriteria<SAclVO> sc = SearchByAcl.create(); | ||||
| @ -85,7 +86,7 @@ public class SAclDaoImpl extends GenericDaoBase<SAclVO, Long> implements SAclDao | ||||
| 	    SearchByTarget.and("Target", SearchByTarget.entity().getTarget(), SearchCriteria.Op.EQ); | ||||
| 	    SearchByTarget.and("TargetID", SearchByTarget.entity().getTargetId(), SearchCriteria.Op.EQ); | ||||
| 
 | ||||
| 	    Transaction txn = Transaction.open(Transaction.AWSAPI_DB); | ||||
| 	    TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.AWSAPI_DB); | ||||
| 	    try { | ||||
| 		txn.start(); | ||||
| 		SearchCriteria<SAclVO> sc = SearchByTarget.create(); | ||||
|  | ||||
| @ -29,6 +29,7 @@ import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| 
 | ||||
| @Component | ||||
| @Local(value={SBucketDao.class}) | ||||
| @ -42,7 +43,7 @@ public class SBucketDaoImpl extends GenericDaoBase<SBucketVO, Long> implements S | ||||
| 	    SearchBuilder<SBucketVO> SearchByName = createSearchBuilder(); | ||||
| 	    SearchByName.and("Name", SearchByName.entity().getName(), SearchCriteria.Op.EQ); | ||||
| 	    //Transaction txn = Transaction.open(Transaction.AWSAPI_DB); | ||||
| 	    Transaction txn = Transaction.open("cloudbridge", Transaction.AWSAPI_DB, true); | ||||
| 	    TransactionLegacy txn = TransactionLegacy.open("cloudbridge", TransactionLegacy.AWSAPI_DB, true); | ||||
| 	    try { | ||||
| 		txn.start(); | ||||
| 		SearchCriteria<SBucketVO> sc = SearchByName.create(); | ||||
| @ -59,7 +60,7 @@ public class SBucketDaoImpl extends GenericDaoBase<SBucketVO, Long> implements S | ||||
| 	    SearchBuilder<SBucketVO> ByCanonicalID = createSearchBuilder(); | ||||
| 	    ByCanonicalID.and("OwnerCanonicalID", ByCanonicalID.entity().getOwnerCanonicalId(), SearchCriteria.Op.EQ); | ||||
| 	    Filter filter = new Filter(SBucketVO.class, "createTime", Boolean.TRUE, null, null); | ||||
| 	    Transaction txn = Transaction.currentTxn();  // Transaction.open("cloudbridge", Transaction.AWSAPI_DB, true); | ||||
| 	    TransactionLegacy txn = TransactionLegacy.currentTxn();  // Transaction.open("cloudbridge", Transaction.AWSAPI_DB, true); | ||||
| 	    try { | ||||
|             txn.start(); | ||||
|             SearchCriteria<SBucketVO> sc = ByCanonicalID.create(); | ||||
|  | ||||
| @ -25,6 +25,7 @@ import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| 
 | ||||
| @Component | ||||
| @Local(value={SHostDao.class}) | ||||
| @ -36,7 +37,7 @@ public class SHostDaoImpl extends GenericDaoBase<SHostVO, Long> implements SHost | ||||
| 	    SearchBuilder <SHostVO> HostSearch = createSearchBuilder(); | ||||
| 	    HostSearch.and("Host", HostSearch.entity().getHost(), SearchCriteria.Op.EQ); | ||||
| 	    HostSearch.done(); | ||||
| 	    Transaction txn = Transaction.open(Transaction.AWSAPI_DB); | ||||
| 	    TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.AWSAPI_DB); | ||||
| 	    try { | ||||
|     		txn.start(); | ||||
|     		SearchCriteria<SHostVO> sc = HostSearch.create(); | ||||
| @ -55,7 +56,7 @@ public class SHostDaoImpl extends GenericDaoBase<SHostVO, Long> implements SHost | ||||
| 	    LocalStorageHostSearch.and("MHostID", LocalStorageHostSearch.entity().getMhostid(), SearchCriteria.Op.EQ); | ||||
| 	    LocalStorageHostSearch.and("ExportRoot", LocalStorageHostSearch.entity().getExportRoot(), SearchCriteria.Op.EQ); | ||||
| 	    LocalStorageHostSearch.done(); | ||||
| 	    Transaction txn = Transaction.currentTxn(); | ||||
| 	    TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
| 	    try { | ||||
|             txn.start(); | ||||
|             SearchCriteria<SHostVO> sc = LocalStorageHostSearch.create(); | ||||
|  | ||||
| @ -28,6 +28,7 @@ import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| 
 | ||||
| @Component | ||||
| @Local(value={SMetaDao.class}) | ||||
| @ -41,7 +42,7 @@ public class SMetaDaoImpl extends GenericDaoBase<SMetaVO, Long> implements SMeta | ||||
| 	    SearchByTarget.and("Target", SearchByTarget.entity().getTarget(), SearchCriteria.Op.EQ); | ||||
| 	    SearchByTarget.and("TargetID", SearchByTarget.entity().getTargetId(), SearchCriteria.Op.EQ); | ||||
| 	    SearchByTarget.done(); | ||||
| 	    Transaction txn = Transaction.open( Transaction.AWSAPI_DB); | ||||
| 	    TransactionLegacy txn = TransactionLegacy.open( TransactionLegacy.AWSAPI_DB); | ||||
| 	    try { | ||||
|             txn.start(); | ||||
|             SearchCriteria<SMetaVO> sc = SearchByTarget.create(); | ||||
| @ -71,7 +72,7 @@ public class SMetaDaoImpl extends GenericDaoBase<SMetaVO, Long> implements SMeta | ||||
| 	    SearchBuilder <SMetaVO> SearchByTarget = createSearchBuilder(); | ||||
| 	    SearchByTarget.and("Target", SearchByTarget.entity().getTarget(), SearchCriteria.Op.EQ); | ||||
| 	    SearchByTarget.and("TargetID", SearchByTarget.entity().getTargetId(), SearchCriteria.Op.EQ); | ||||
| 	    Transaction txn = Transaction.open(Transaction.AWSAPI_DB); | ||||
| 	    TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.AWSAPI_DB); | ||||
| 	    try { | ||||
| 		txn.start(); | ||||
| 		SearchCriteria<SMetaVO> sc = SearchByTarget.create(); | ||||
|  | ||||
| @ -33,6 +33,7 @@ import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| 
 | ||||
| @Component | ||||
| @Local(value={SObjectDao.class}) | ||||
| @ -47,7 +48,7 @@ public class SObjectDaoImpl extends GenericDaoBase<SObjectVO, Long> implements S | ||||
|         SearchBuilder<SObjectVO> SearchByName = createSearchBuilder(); | ||||
|         SearchByName.and("SBucketID", SearchByName.entity().getBucketID() , SearchCriteria.Op.EQ); | ||||
|         SearchByName.and("NameKey", SearchByName.entity().getNameKey() , SearchCriteria.Op.EQ); | ||||
|         Transaction txn = Transaction.open(Transaction.AWSAPI_DB); | ||||
|         TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.AWSAPI_DB); | ||||
|         try { | ||||
|             txn.start(); | ||||
|             SearchCriteria<SObjectVO> sc = SearchByName.create(); | ||||
| @ -76,7 +77,7 @@ public class SObjectDaoImpl extends GenericDaoBase<SObjectVO, Long> implements S | ||||
| 
 | ||||
|         SearchByBucket.and("SBucketID", SearchByBucket.entity().getBucketID(), SearchCriteria.Op.EQ); | ||||
|         SearchByBucket.and("DeletionMark", SearchByBucket.entity().getDeletionMark(), SearchCriteria.Op.NULL);		 | ||||
|         Transaction txn = Transaction.currentTxn();  // Transaction.open("cloudbridge", Transaction.AWSAPI_DB, true); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn();  // Transaction.open("cloudbridge", Transaction.AWSAPI_DB, true); | ||||
|         try { | ||||
|             txn.start(); | ||||
|             SearchCriteria<SObjectVO> sc = SearchByBucket.create(); | ||||
| @ -100,7 +101,7 @@ public class SObjectDaoImpl extends GenericDaoBase<SObjectVO, Long> implements S | ||||
|         List<SObjectVO> objects = new ArrayList<SObjectVO>(); | ||||
|         getAllBuckets.and("SBucketID", getAllBuckets.entity().getBucketID(), SearchCriteria.Op.EQ); | ||||
| 
 | ||||
|         Transaction txn = Transaction.currentTxn();  // Transaction.open("cloudbridge", Transaction.AWSAPI_DB, true); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn();  // Transaction.open("cloudbridge", Transaction.AWSAPI_DB, true); | ||||
|         try { | ||||
|             txn.start(); | ||||
|             SearchCriteria<SObjectVO> sc = getAllBuckets.create(); | ||||
|  | ||||
| @ -27,6 +27,7 @@ import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| 
 | ||||
| @Component | ||||
| @Local(value={SObjectItemDao.class}) | ||||
| @ -39,7 +40,7 @@ public class SObjectItemDaoImpl extends GenericDaoBase<SObjectItemVO, Long> impl | ||||
| 	@Override | ||||
| 	public SObjectItemVO getByObjectIdNullVersion(long id) { | ||||
| 	     | ||||
| 	    Transaction txn = Transaction.open(Transaction.AWSAPI_DB); | ||||
| 	    TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.AWSAPI_DB); | ||||
| 	    SearchBuilder <SObjectItemVO> SearchByID = createSearchBuilder(); | ||||
| 	    SearchByID.and("ID", SearchByID.entity().getId(), SearchCriteria.Op.EQ); | ||||
| 	     | ||||
| @ -56,7 +57,7 @@ public class SObjectItemDaoImpl extends GenericDaoBase<SObjectItemVO, Long> impl | ||||
| 	@Override | ||||
|     public List<SObjectItemVO> getItems(long sobjectID) { | ||||
| 
 | ||||
|         Transaction txn = Transaction.open(Transaction.AWSAPI_DB); | ||||
| 	    TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.AWSAPI_DB); | ||||
|         SearchBuilder<SObjectItemVO> SearchBySobjectID = createSearchBuilder(); | ||||
|         SearchBySobjectID.and("SObjectID", SearchBySobjectID.entity().getId(), SearchCriteria.Op.EQ); | ||||
| 
 | ||||
|  | ||||
| @ -29,6 +29,7 @@ import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| 
 | ||||
| @Component | ||||
| @Local(value={UserCredentialsDao.class}) | ||||
| @ -41,7 +42,7 @@ public class UserCredentialsDaoImpl extends GenericDaoBase<UserCredentialsVO, Lo | ||||
| 	@Override | ||||
| 	public UserCredentialsVO getByAccessKey( String cloudAccessKey ) { | ||||
| 	        SearchBuilder<UserCredentialsVO> SearchByAccessKey = createSearchBuilder(); | ||||
| 	        Transaction txn = Transaction.open(Transaction.AWSAPI_DB); | ||||
| 	        TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.AWSAPI_DB); | ||||
| 	    try { | ||||
|             txn.start(); | ||||
|             SearchByAccessKey.and("AccessKey", SearchByAccessKey.entity() | ||||
| @ -60,7 +61,7 @@ public class UserCredentialsDaoImpl extends GenericDaoBase<UserCredentialsVO, Lo | ||||
| 	public UserCredentialsVO getByCertUniqueId( String certId ) { | ||||
| 	    SearchBuilder<UserCredentialsVO> SearchByCertID = createSearchBuilder(); | ||||
| 	    SearchByCertID.and("CertUniqueId", SearchByCertID.entity().getCertUniqueId(), SearchCriteria.Op.EQ); | ||||
| 	    Transaction txn = Transaction.open(Transaction.AWSAPI_DB); | ||||
| 	    TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.AWSAPI_DB); | ||||
| 	    try { | ||||
|             txn.start(); | ||||
|             SearchCriteria<UserCredentialsVO> sc = SearchByCertID.create(); | ||||
|  | ||||
| @ -161,6 +161,7 @@ import com.cloud.bridge.util.ConfigurationHelper; | ||||
| import com.cloud.bridge.util.EC2RestAuth; | ||||
| import com.cloud.stack.models.CloudStackAccount; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| 
 | ||||
| @Component("EC2RestServlet") | ||||
| public class EC2RestServlet extends HttpServlet { | ||||
| @ -377,7 +378,7 @@ public class EC2RestServlet extends HttpServlet { | ||||
|     private void setUserKeys( HttpServletRequest request, HttpServletResponse response ) { | ||||
|         String[] accessKey = null; | ||||
|         String[] secretKey = null; | ||||
|         Transaction txn = null; | ||||
|         TransactionLegacy txn = null; | ||||
|         try { | ||||
|             // -> all these parameters are required | ||||
|             accessKey = request.getParameterValues( "accesskey" ); | ||||
| @ -398,7 +399,7 @@ public class EC2RestServlet extends HttpServlet { | ||||
|             return; | ||||
|         } | ||||
|         try { | ||||
|             txn = Transaction.open(Transaction.AWSAPI_DB); | ||||
|             txn = TransactionLegacy.open(TransactionLegacy.AWSAPI_DB); | ||||
|             txn.start(); | ||||
|             // -> use the keys to see if the account actually exists | ||||
|             ServiceProvider.getInstance().getEC2Engine().validateAccount( accessKey[0], secretKey[0] ); | ||||
| @ -434,7 +435,7 @@ public class EC2RestServlet extends HttpServlet { | ||||
|      */ | ||||
|     private void setCertificate( HttpServletRequest request, HttpServletResponse response )  | ||||
|             throws Exception {  | ||||
|         Transaction txn = null; | ||||
|         TransactionLegacy txn = null; | ||||
|         try { | ||||
|             // [A] Pull the cert and cloud AccessKey from the request | ||||
|             String[] certificate = request.getParameterValues( "cert" ); | ||||
| @ -470,7 +471,7 @@ public class EC2RestServlet extends HttpServlet { | ||||
|             // [C] Associate the cert's uniqueId with the Cloud API keys | ||||
|             String uniqueId = AuthenticationUtils.X509CertUniqueId( userCert ); | ||||
|             logger.debug( "SetCertificate, uniqueId: " + uniqueId ); | ||||
|             txn = Transaction.open(Transaction.AWSAPI_DB); | ||||
|             txn = TransactionLegacy.open(TransactionLegacy.AWSAPI_DB); | ||||
|             txn.start(); | ||||
|             UserCredentialsVO user = ucDao.getByAccessKey(accessKey[0]); | ||||
|             user.setCertUniqueId(uniqueId); | ||||
| @ -505,7 +506,7 @@ public class EC2RestServlet extends HttpServlet { | ||||
|      */ | ||||
|     private void deleteCertificate( HttpServletRequest request, HttpServletResponse response )  | ||||
|             throws Exception { | ||||
|         Transaction txn = null; | ||||
|         TransactionLegacy txn = null; | ||||
|         try { | ||||
|             String [] accessKey = request.getParameterValues( "AWSAccessKeyId" ); | ||||
|             if ( null == accessKey || 0 == accessKey.length ) {  | ||||
| @ -527,7 +528,7 @@ public class EC2RestServlet extends HttpServlet { | ||||
|                 /*	     	     UserCredentialsDao credentialDao = new UserCredentialsDao(); | ||||
| 	     	     credentialDao.setCertificateId( accessKey[0], null ); | ||||
| 
 | ||||
|                  */	     	     txn = Transaction.open(Transaction.AWSAPI_DB); | ||||
|                  */	     	     txn = TransactionLegacy.open(TransactionLegacy.AWSAPI_DB); | ||||
|                  UserCredentialsVO user = ucDao.getByAccessKey(accessKey[0]); | ||||
|                  user.setCertUniqueId(null); | ||||
|                  ucDao.update(user.getId(), user); | ||||
|  | ||||
| @ -67,6 +67,7 @@ import com.cloud.bridge.util.RestAuth; | ||||
| import com.cloud.bridge.util.S3SoapAuth; | ||||
| import com.cloud.utils.db.DB; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| public class S3RestServlet extends HttpServlet { | ||||
|     private static final long serialVersionUID = -6168996266762804877L; | ||||
|     public static final String ENABLE_S3_API="enable.s3.api"; | ||||
| @ -139,7 +140,7 @@ public class S3RestServlet extends HttpServlet { | ||||
|      */ | ||||
|     private void processRequest( HttpServletRequest request, HttpServletResponse response, String method )  | ||||
|     { | ||||
|         Transaction txn = Transaction.open("cloudbridge", Transaction.AWSAPI_DB, true); | ||||
|         TransactionLegacy txn = TransactionLegacy.open("cloudbridge", TransactionLegacy.AWSAPI_DB, true); | ||||
|         try { | ||||
|             logRequest(request); | ||||
| 
 | ||||
| @ -274,7 +275,7 @@ public class S3RestServlet extends HttpServlet { | ||||
|             // -> use the keys to see if the account actually exists | ||||
|             //ServiceProvider.getInstance().getEC2Engine().validateAccount( accessKey[0], secretKey[0] ); | ||||
|             //UserCredentialsDaoImpl credentialDao = new UserCredentialsDao(); | ||||
|             Transaction txn = Transaction.open(Transaction.AWSAPI_DB); | ||||
|             TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.AWSAPI_DB); | ||||
|             txn.start(); | ||||
|             UserCredentialsVO user = new UserCredentialsVO(accessKey[0], secretKey[0]); | ||||
|             user = ucDao.persist(user); | ||||
|  | ||||
| @ -94,6 +94,7 @@ import com.cloud.bridge.util.XSerializer; | ||||
| import com.cloud.bridge.util.XSerializerXmlAdapter; | ||||
| import com.cloud.bridge.util.XmlHelper; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| 
 | ||||
| 
 | ||||
| public class S3BucketAction implements ServletAction { | ||||
| @ -371,7 +372,7 @@ public class S3BucketAction implements ServletAction { | ||||
|             response.setStatus(403); | ||||
|             return; | ||||
|         }			 | ||||
|         Transaction txn = Transaction.open(Transaction.AWSAPI_DB); | ||||
|         TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.AWSAPI_DB); | ||||
|         // [B] Place the policy into the database over writting an existing policy | ||||
|         try { | ||||
|             // -> first make sure that the policy is valid by parsing it | ||||
|  | ||||
| @ -62,6 +62,7 @@ import com.cloud.bridge.util.OrderedPair; | ||||
| import com.cloud.utils.component.ManagerBase; | ||||
| import com.cloud.utils.db.DB; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| 
 | ||||
| @Component | ||||
| public class ServiceProvider extends ManagerBase { | ||||
| @ -90,7 +91,7 @@ public class ServiceProvider extends ManagerBase { | ||||
| 
 | ||||
|     protected ServiceProvider() throws IOException { | ||||
|         // register service implementation object | ||||
|         Transaction txn = Transaction.open(Transaction.AWSAPI_DB); | ||||
|         TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.AWSAPI_DB); | ||||
|         txn.close(); | ||||
|     } | ||||
| 
 | ||||
| @ -183,7 +184,7 @@ public class ServiceProvider extends ManagerBase { | ||||
| 
 | ||||
|     public UserInfo getUserInfo(String accessKey) { | ||||
|         UserInfo info = new UserInfo(); | ||||
|         Transaction txn = Transaction.open(Transaction.AWSAPI_DB); | ||||
|         TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.AWSAPI_DB); | ||||
|         try { | ||||
|             txn.start(); | ||||
|             UserCredentialsVO cloudKeys = ucDao.getByAccessKey( accessKey );  | ||||
| @ -253,7 +254,7 @@ public class ServiceProvider extends ManagerBase { | ||||
| 
 | ||||
|         multipartDir = properties.getProperty("storage.multipartDir"); | ||||
| 
 | ||||
|         Transaction txn1 = Transaction.open(Transaction.AWSAPI_DB); | ||||
|         TransactionLegacy txn1 = TransactionLegacy.open(TransactionLegacy.AWSAPI_DB); | ||||
|         timer.schedule(getHeartbeatTask(), HEARTBEAT_INTERVAL, HEARTBEAT_INTERVAL); | ||||
|         txn1.close(); | ||||
| 
 | ||||
|  | ||||
| @ -86,6 +86,7 @@ import com.cloud.bridge.util.StringHelper; | ||||
| import com.cloud.bridge.util.Triple; | ||||
| import com.cloud.utils.db.DB; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| 
 | ||||
| /** | ||||
|  * The CRUD control actions to be invoked from S3BucketAction or S3ObjectAction. | ||||
| @ -195,7 +196,7 @@ public class S3Engine { | ||||
|         String cannedAccessPolicy = request.getCannedAccess(); | ||||
|         String bucketName = request.getBucketName(); | ||||
|         response.setBucketName( bucketName ); | ||||
|         Transaction txn= null; | ||||
|         TransactionLegacy txn= null; | ||||
|         verifyBucketName( bucketName, false ); | ||||
| 
 | ||||
|         S3PolicyContext context = new S3PolicyContext( PolicyActions.CreateBucket,  bucketName ); | ||||
| @ -205,7 +206,7 @@ public class S3Engine { | ||||
|         OrderedPair<SHostVO, String> shost_storagelocation_pair = null; | ||||
|         boolean success = false; | ||||
|         try { | ||||
|             txn = Transaction.open(Transaction.AWSAPI_DB); | ||||
|             txn = TransactionLegacy.open(TransactionLegacy.AWSAPI_DB); | ||||
| 
 | ||||
|             if (bucketDao.getByName(request.getBucketName()) != null) | ||||
|                 throw new ObjectAlreadyExistsException("Bucket already exists"); | ||||
| @ -257,10 +258,10 @@ public class S3Engine { | ||||
|         String bucketName = request.getBucketName(); | ||||
|         SBucketVO sbucket   = bucketDao.getByName(bucketName); | ||||
| 
 | ||||
|         Transaction txn = null; | ||||
|         TransactionLegacy txn = null; | ||||
|         if ( sbucket != null )  | ||||
|         {	 | ||||
|             txn = Transaction.open(Transaction.AWSAPI_DB); | ||||
|             txn = TransactionLegacy.open(TransactionLegacy.AWSAPI_DB); | ||||
|             txn.start(); | ||||
|             S3PolicyContext context = new S3PolicyContext( PolicyActions.DeleteBucket, bucketName ); | ||||
|             switch( verifyPolicy( context )) | ||||
| @ -699,7 +700,7 @@ public class S3Engine { | ||||
|         if (null != version) | ||||
|             httpResp.addHeader("x-amz-version-id", version); | ||||
|         httpResp.flushBuffer(); | ||||
|         Transaction txn = Transaction.open(Transaction.AWSAPI_DB); | ||||
|         TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.AWSAPI_DB); | ||||
|         // [C] Re-assemble the object from its uploaded file parts | ||||
|         try { | ||||
|             // explicit transaction control to avoid holding transaction during | ||||
| @ -752,11 +753,11 @@ public class S3Engine { | ||||
|         S3BucketAdapter bucketAdapter = getStorageHostBucketAdapter(host_storagelocation_pair.getFirst()); | ||||
|         String itemFileName = object_objectitem_pair.getSecond().getStoredPath(); | ||||
|         InputStream is = null; | ||||
|         Transaction txn = null; | ||||
|         TransactionLegacy txn = null; | ||||
|         try { | ||||
|             // explicit transaction control to avoid holding transaction during file-copy process | ||||
| 
 | ||||
|             txn = Transaction.open(Transaction.AWSAPI_DB); | ||||
|             txn = TransactionLegacy.open(TransactionLegacy.AWSAPI_DB); | ||||
|             txn.start(); | ||||
|             is = request.getDataInputStream(); | ||||
|             String md5Checksum = bucketAdapter.saveObject(is, host_storagelocation_pair.getSecond(), bucket.getName(), itemFileName); | ||||
| @ -813,11 +814,11 @@ public class S3Engine { | ||||
|         S3BucketAdapter bucketAdapter =  getStorageHostBucketAdapter(host_storagelocation_pair.getFirst()); | ||||
|         String itemFileName = object_objectitem_pair.getSecond().getStoredPath(); | ||||
|         InputStream is = null; | ||||
|         Transaction txn = null; | ||||
|         TransactionLegacy txn = null; | ||||
|         try { | ||||
|             // explicit transaction control to avoid holding transaction during file-copy process | ||||
| 
 | ||||
|             txn = Transaction.open(Transaction.AWSAPI_DB); | ||||
|             txn = TransactionLegacy.open(TransactionLegacy.AWSAPI_DB); | ||||
|             txn.start(); | ||||
| 
 | ||||
|             is = request.getInputStream(); | ||||
| @ -1505,7 +1506,7 @@ public class S3Engine { | ||||
|         context.setEvalParam( ConditionKeys.Acl, cannedAccessPolicy); | ||||
| 
 | ||||
|         verifyAccess( context, "SBucket", bucket.getId(), SAcl.PERMISSION_WRITE );  // TODO - check this validates plain POSTs | ||||
|         Transaction txn = Transaction.open(Transaction.AWSAPI_DB); | ||||
|         TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.AWSAPI_DB); | ||||
|         txn.start(); | ||||
| 
 | ||||
|         // [B] If versioning is off them we over write a null object item | ||||
| @ -1554,7 +1555,7 @@ public class S3Engine { | ||||
|         }  | ||||
|         else  | ||||
|         {     | ||||
|             Transaction txn1 = Transaction.open(Transaction.AWSAPI_DB); | ||||
|             TransactionLegacy txn1 = TransactionLegacy.open(TransactionLegacy.AWSAPI_DB); | ||||
|             txn1.start(); | ||||
|             // -> there is no object nor an object item | ||||
|             object = new SObjectVO(); | ||||
|  | ||||
| @ -97,6 +97,7 @@ import com.cloud.utils.concurrency.NamedThreadFactory; | ||||
| import com.cloud.utils.db.DB; | ||||
| import com.cloud.utils.db.EntityManager; | ||||
| import com.cloud.utils.db.QueryBuilder; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| import com.cloud.utils.db.SearchCriteria.Op; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.exception.CloudRuntimeException; | ||||
| @ -355,7 +356,7 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl | ||||
| 
 | ||||
|     @DB | ||||
|     protected boolean noDbTxn() { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         return !txn.dbTxnStarted(); | ||||
|     } | ||||
| 
 | ||||
| @ -1252,7 +1253,7 @@ public class AgentManagerImpl extends ManagerBase implements AgentManager, Handl | ||||
| 
 | ||||
|         @Override | ||||
|         protected void doTask(final Task task) throws Exception { | ||||
|             Transaction txn = Transaction.open(Transaction.CLOUD_DB); | ||||
|             TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.CLOUD_DB); | ||||
|             try { | ||||
|                 final Type type = task.getType(); | ||||
|                 if (type == Task.Type.DATA) { | ||||
|  | ||||
| @ -85,8 +85,8 @@ import com.cloud.serializer.GsonHelper; | ||||
| import com.cloud.utils.DateUtil; | ||||
| import com.cloud.utils.concurrency.NamedThreadFactory; | ||||
| import com.cloud.utils.db.QueryBuilder; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| import com.cloud.utils.db.SearchCriteria.Op; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.exception.CloudRuntimeException; | ||||
| import com.cloud.utils.nio.Link; | ||||
| import com.cloud.utils.nio.Task; | ||||
| @ -591,7 +591,7 @@ public class ClusteredAgentManagerImpl extends AgentManagerImpl implements Clust | ||||
| 
 | ||||
|         @Override | ||||
|         protected void doTask(final Task task) throws Exception { | ||||
|             Transaction txn = Transaction.open(Transaction.CLOUD_DB); | ||||
|             TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.CLOUD_DB); | ||||
|             try { | ||||
|                 if (task.getType() != Task.Type.DATA) { | ||||
|                     super.doTask(task); | ||||
|  | ||||
| @ -36,7 +36,6 @@ import javax.inject.Inject; | ||||
| import javax.naming.ConfigurationException; | ||||
| 
 | ||||
| import org.apache.log4j.Logger; | ||||
| 
 | ||||
| import org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao; | ||||
| import org.apache.cloudstack.context.CallContext; | ||||
| import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService; | ||||
| @ -165,6 +164,11 @@ import com.cloud.utils.db.DB; | ||||
| import com.cloud.utils.db.EntityManager; | ||||
| import com.cloud.utils.db.GlobalLock; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionCallback; | ||||
| import com.cloud.utils.db.TransactionCallbackNoReturn; | ||||
| import com.cloud.utils.db.TransactionCallbackWithException; | ||||
| import com.cloud.utils.db.TransactionCallbackWithExceptionNoReturn; | ||||
| import com.cloud.utils.db.TransactionStatus; | ||||
| import com.cloud.utils.exception.CloudRuntimeException; | ||||
| import com.cloud.utils.exception.ExecutionException; | ||||
| import com.cloud.utils.fsm.NoTransitionException; | ||||
| @ -311,12 +315,12 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac | ||||
| 
 | ||||
|     @Override | ||||
|     @DB | ||||
|     public void allocate(String vmInstanceName, VirtualMachineTemplate template, ServiceOffering serviceOffering, Pair<? extends DiskOffering, Long> rootDiskOffering, | ||||
|         LinkedHashMap<? extends DiskOffering, Long> dataDiskOfferings, LinkedHashMap<? extends Network, ? extends NicProfile> auxiliaryNetworks, DeploymentPlan plan, | ||||
|     public void allocate(String vmInstanceName, final VirtualMachineTemplate template, ServiceOffering serviceOffering, final Pair<? extends DiskOffering, Long> rootDiskOffering, | ||||
|         LinkedHashMap<? extends DiskOffering, Long> dataDiskOfferings, final LinkedHashMap<? extends Network, ? extends NicProfile> auxiliaryNetworks, DeploymentPlan plan, | ||||
|         HypervisorType hyperType) throws InsufficientCapacityException { | ||||
| 
 | ||||
|         VMInstanceVO vm = _vmDao.findVMByInstanceName(vmInstanceName); | ||||
|         Account owner = _entityMgr.findById(Account.class, vm.getAccountId()); | ||||
|         final Account owner = _entityMgr.findById(Account.class, vm.getAccountId()); | ||||
| 
 | ||||
|         if (s_logger.isDebugEnabled()) { | ||||
|             s_logger.debug("Allocating entries for VM: " + vm); | ||||
| @ -327,15 +331,18 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac | ||||
|             vm.setPodId(plan.getPodId()); | ||||
|         } | ||||
|         assert (plan.getClusterId() == null && plan.getPoolId() == null) : "We currently don't support cluster and pool preset yet"; | ||||
|         vm = _vmDao.persist(vm); | ||||
|         final VMInstanceVO vmFinal = _vmDao.persist(vm); | ||||
|         final LinkedHashMap<? extends DiskOffering, Long> dataDiskOfferingsFinal = dataDiskOfferings == null ?  | ||||
|                 new LinkedHashMap<DiskOffering, Long>() : dataDiskOfferings; | ||||
| 
 | ||||
|         VirtualMachineProfileImpl vmProfile = new VirtualMachineProfileImpl(vm, template, serviceOffering, null, null); | ||||
| 
 | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         txn.start(); | ||||
|         final VirtualMachineProfileImpl vmProfile = new VirtualMachineProfileImpl(vmFinal, template, serviceOffering, null, null); | ||||
| 
 | ||||
|         Transaction.execute(new TransactionCallbackWithExceptionNoReturn<InsufficientCapacityException>() { | ||||
|             @Override | ||||
|             public void doInTransactionWithoutResult(TransactionStatus status) throws InsufficientCapacityException { | ||||
|                 if (s_logger.isDebugEnabled()) { | ||||
|             s_logger.debug("Allocating nics for " + vm); | ||||
|                     s_logger.debug("Allocating nics for " + vmFinal); | ||||
|                 } | ||||
|          | ||||
|                 try { | ||||
| @ -344,29 +351,26 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac | ||||
|                     throw new CloudRuntimeException("Concurrent operation while trying to allocate resources for the VM", e); | ||||
|                 } | ||||
|          | ||||
|         if (dataDiskOfferings == null) { | ||||
|             dataDiskOfferings = new LinkedHashMap<DiskOffering, Long>(0); | ||||
|         } | ||||
| 
 | ||||
|                 if (s_logger.isDebugEnabled()) { | ||||
|             s_logger.debug("Allocating disks for " + vm); | ||||
|                     s_logger.debug("Allocating disks for " + vmFinal); | ||||
|                 } | ||||
|          | ||||
|                 if (template.getFormat() == ImageFormat.ISO) { | ||||
|             volumeMgr.allocateRawVolume(Type.ROOT, "ROOT-" + vm.getId(), rootDiskOffering.first(), rootDiskOffering.second(), vm, template, owner); | ||||
|                     volumeMgr.allocateRawVolume(Type.ROOT, "ROOT-" + vmFinal.getId(), rootDiskOffering.first(), rootDiskOffering.second(), vmFinal, template, owner); | ||||
|                 } else if (template.getFormat() == ImageFormat.BAREMETAL) { | ||||
|                     // Do nothing | ||||
|                 } else { | ||||
|             volumeMgr.allocateTemplatedVolume(Type.ROOT, "ROOT-" + vm.getId(), rootDiskOffering.first(), template, vm, owner); | ||||
|                     volumeMgr.allocateTemplatedVolume(Type.ROOT, "ROOT-" + vmFinal.getId(), rootDiskOffering.first(), template, vmFinal, owner); | ||||
|                 } | ||||
|          | ||||
|         for (Map.Entry<? extends DiskOffering, Long> offering : dataDiskOfferings.entrySet()) { | ||||
|             volumeMgr.allocateRawVolume(Type.DATADISK, "DATA-" + vm.getId(), offering.getKey(), offering.getValue(), vm, template, owner); | ||||
|                 for (Map.Entry<? extends DiskOffering, Long> offering : dataDiskOfferingsFinal.entrySet()) { | ||||
|                     volumeMgr.allocateRawVolume(Type.DATADISK, "DATA-" + vmFinal.getId(), offering.getKey(), offering.getValue(), vmFinal, template, owner); | ||||
|                 } | ||||
|             } | ||||
|         }); | ||||
| 
 | ||||
|         txn.commit(); | ||||
|         if (s_logger.isDebugEnabled()) { | ||||
|             s_logger.debug("Allocation completed for VM: " + vm); | ||||
|             s_logger.debug("Allocation completed for VM: " + vmFinal); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
| @ -551,37 +555,41 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac | ||||
|     } | ||||
| 
 | ||||
|     @DB | ||||
|     protected Ternary<VMInstanceVO, ReservationContext, ItWorkVO> changeToStartState(VirtualMachineGuru vmGuru, VMInstanceVO vm, User caller, Account account) | ||||
|     protected Ternary<VMInstanceVO, ReservationContext, ItWorkVO> changeToStartState(VirtualMachineGuru vmGuru, final VMInstanceVO vm, final User caller, final Account account) | ||||
|         throws ConcurrentOperationException { | ||||
|         long vmId = vm.getId(); | ||||
| 
 | ||||
|         ItWorkVO work = new ItWorkVO(UUID.randomUUID().toString(), _nodeId, State.Starting, vm.getType(), vm.getId()); | ||||
|         int retry = VmOpLockStateRetry.value(); | ||||
|         while (retry-- != 0) { | ||||
|             Transaction txn = Transaction.currentTxn(); | ||||
|             Ternary<VMInstanceVO, ReservationContext, ItWorkVO> result = null; | ||||
|             txn.start(); | ||||
|             try { | ||||
|                 final ItWorkVO workFinal = work; | ||||
|                 Ternary<VMInstanceVO, ReservationContext, ItWorkVO> result =  | ||||
|                         Transaction.execute(new TransactionCallbackWithException<Ternary<VMInstanceVO, ReservationContext, ItWorkVO>, NoTransitionException>() { | ||||
|                     @Override | ||||
|                     public Ternary<VMInstanceVO, ReservationContext, ItWorkVO> doInTransaction(TransactionStatus status) throws NoTransitionException { | ||||
|                         Journal journal = new Journal.LogJournal("Creating " + vm, s_logger); | ||||
|                 work = _workDao.persist(work); | ||||
|                         ItWorkVO work = _workDao.persist(workFinal); | ||||
|                         ReservationContextImpl context = new ReservationContextImpl(work.getId(), journal, caller, account); | ||||
| 
 | ||||
|                         if (stateTransitTo(vm, Event.StartRequested, null, work.getId())) { | ||||
|                             if (s_logger.isDebugEnabled()) { | ||||
|                                 s_logger.debug("Successfully transitioned to start state for " + vm + " reservation id = " + work.getId()); | ||||
|                             } | ||||
|                     result = new Ternary<VMInstanceVO, ReservationContext, ItWorkVO>(vm, context, work); | ||||
|                     txn.commit(); | ||||
|                     return result; | ||||
|                             return new Ternary<VMInstanceVO, ReservationContext, ItWorkVO>(vm, context, work); | ||||
|                         } | ||||
| 
 | ||||
|                         return new Ternary<VMInstanceVO, ReservationContext, ItWorkVO>(null, null, work); | ||||
|                     } | ||||
|                 }); | ||||
|                  | ||||
|                 work = result.third(); | ||||
|                 if (result.first() != null) | ||||
|                     return result; | ||||
|             } catch (NoTransitionException e) { | ||||
|                 if (s_logger.isDebugEnabled()) { | ||||
|                     s_logger.debug("Unable to transition into Starting state due to " + e.getMessage()); | ||||
|                 } | ||||
|             } finally { | ||||
|                 if (result == null) { | ||||
|                     txn.rollback(); | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|             VMInstanceVO instance = _vmDao.findById(vmId); | ||||
|  | ||||
| @ -29,7 +29,7 @@ import org.springframework.stereotype.Component; | ||||
| import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| 
 | ||||
| @Component(value="EngineDcDetailsDao") | ||||
| @Local(value=DcDetailsDao.class) | ||||
| @ -83,7 +83,7 @@ public class DcDetailsDaoImpl extends GenericDaoBase<DcDetailVO, Long> implement | ||||
| 
 | ||||
|     @Override | ||||
|     public void persist(long dcId, Map<String, String> details) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         txn.start(); | ||||
|         SearchCriteria<DcDetailVO> sc = DcSearch.create(); | ||||
|         sc.setParameters("dcId", dcId); | ||||
|  | ||||
| @ -45,7 +45,7 @@ import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.SearchCriteria.Func; | ||||
| import com.cloud.utils.db.SearchCriteria.Op; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| import com.cloud.utils.db.UpdateBuilder; | ||||
| import com.cloud.utils.exception.CloudRuntimeException; | ||||
| 
 | ||||
| @ -162,7 +162,7 @@ public class EngineClusterDaoImpl extends GenericDaoBase<EngineClusterVO, Long> | ||||
| 
 | ||||
|     @Override | ||||
|     public Map<Long, List<Long>> getPodClusterIdMap(List<Long> clusterIds){ | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         PreparedStatement pstmt = null; | ||||
|         Map<Long, List<Long>> result = new HashMap<Long, List<Long>>(); | ||||
| 
 | ||||
| @ -243,7 +243,7 @@ public class EngineClusterDaoImpl extends GenericDaoBase<EngineClusterVO, Long> | ||||
| 
 | ||||
|     @Override | ||||
|     public boolean remove(Long id) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         txn.start(); | ||||
|         EngineClusterVO cluster = createForUpdate(); | ||||
|         cluster.setName(null); | ||||
|  | ||||
| @ -40,7 +40,7 @@ import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.SequenceFetcher; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| import com.cloud.utils.db.UpdateBuilder; | ||||
| import com.cloud.utils.net.NetUtils; | ||||
| 
 | ||||
| @ -216,7 +216,7 @@ public class EngineDataCenterDaoImpl extends GenericDaoBase<EngineDataCenterVO, | ||||
| 
 | ||||
|     @Override @DB | ||||
|     public boolean update(Long zoneId, EngineDataCenterVO zone) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         txn.start(); | ||||
|         boolean persisted = super.update(zoneId, zone); | ||||
|         if (!persisted) { | ||||
| @ -281,7 +281,7 @@ public class EngineDataCenterDaoImpl extends GenericDaoBase<EngineDataCenterVO, | ||||
| 
 | ||||
|     @Override | ||||
|     public boolean remove(Long id) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         txn.start(); | ||||
|         EngineDataCenterVO zone = createForUpdate(); | ||||
|         zone.setName(null); | ||||
|  | ||||
| @ -54,7 +54,7 @@ import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.SearchCriteria.Func; | ||||
| import com.cloud.utils.db.SearchCriteria.Op; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| import com.cloud.utils.db.UpdateBuilder; | ||||
| import com.cloud.utils.exception.CloudRuntimeException; | ||||
| 
 | ||||
| @ -336,7 +336,7 @@ public class EngineHostDaoImpl extends GenericDaoBase<EngineHostVO, Long> implem | ||||
| 
 | ||||
|     @Override @DB | ||||
|     public List<EngineHostVO> findAndUpdateDirectAgentToLoad(long lastPingSecondsAfter, Long limit, long managementServerId) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         txn.start(); | ||||
|         SearchCriteria<EngineHostVO> sc = UnmanagedDirectConnectSearch.create(); | ||||
|         sc.setParameters("lastPinged", lastPingSecondsAfter); | ||||
| @ -356,7 +356,7 @@ public class EngineHostDaoImpl extends GenericDaoBase<EngineHostVO, Long> implem | ||||
| 
 | ||||
|     @Override @DB | ||||
|     public List<EngineHostVO> findAndUpdateApplianceToLoad(long lastPingSecondsAfter, long managementServerId) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
| 
 | ||||
|         txn.start(); | ||||
|         SearchCriteria<EngineHostVO> sc = UnmanagedApplianceSearch.create(); | ||||
| @ -495,7 +495,7 @@ public class EngineHostDaoImpl extends GenericDaoBase<EngineHostVO, Long> implem | ||||
|     @DB | ||||
|     @Override | ||||
|     public List<EngineHostVO> findLostHosts(long timeout) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         PreparedStatement pstmt = null; | ||||
|         List<EngineHostVO> result = new ArrayList<EngineHostVO>(); | ||||
|         ResultSet rs = null; | ||||
| @ -546,7 +546,7 @@ public class EngineHostDaoImpl extends GenericDaoBase<EngineHostVO, Long> implem | ||||
|     public EngineHostVO persist(EngineHostVO host) { | ||||
|         final String InsertSequenceSql = "INSERT INTO op_host(id) VALUES(?)"; | ||||
| 
 | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         txn.start(); | ||||
| 
 | ||||
|         EngineHostVO dbHost = super.persist(host); | ||||
| @ -572,7 +572,7 @@ public class EngineHostDaoImpl extends GenericDaoBase<EngineHostVO, Long> implem | ||||
|     @Override | ||||
|     @DB | ||||
|     public boolean update(Long hostId, EngineHostVO host) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         txn.start(); | ||||
| 
 | ||||
|         boolean persisted = super.update(hostId, host); | ||||
| @ -598,7 +598,7 @@ public class EngineHostDaoImpl extends GenericDaoBase<EngineHostVO, Long> implem | ||||
| 
 | ||||
|         ArrayList<RunningHostCountInfo> l = new ArrayList<RunningHostCountInfo>(); | ||||
| 
 | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         ; | ||||
|         PreparedStatement pstmt = null; | ||||
|         try { | ||||
|  | ||||
| @ -41,7 +41,7 @@ import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.UpdateBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria.Op; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| 
 | ||||
| @Component(value="EngineHostPodDao") | ||||
| @Local(value={EngineHostPodDao.class}) | ||||
| @ -97,7 +97,7 @@ public class EngineHostPodDaoImpl extends GenericDaoBase<EngineHostPodVO, Long> | ||||
| 		HashMap<Long, List<Object>> currentPodCidrSubnets = new HashMap<Long, List<Object>>(); | ||||
| 
 | ||||
| 		String selectSql = "SELECT id, cidr_address, cidr_size FROM host_pod_ref WHERE data_center_id=" + zoneId +" and removed IS NULL"; | ||||
| 		Transaction txn = Transaction.currentTxn(); | ||||
| 		TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
| 		try { | ||||
| 		PreparedStatement stmt = txn.prepareAutoCloseStatement(selectSql); | ||||
| 		ResultSet rs = stmt.executeQuery(); | ||||
| @ -123,7 +123,7 @@ public class EngineHostPodDaoImpl extends GenericDaoBase<EngineHostPodVO, Long> | ||||
| 
 | ||||
|     @Override | ||||
|     public boolean remove(Long id) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         txn.start(); | ||||
|         EngineHostPodVO pod = createForUpdate(); | ||||
|         pod.setName(null); | ||||
|  | ||||
| @ -31,7 +31,7 @@ import com.cloud.utils.crypt.DBEncryptionUtil; | ||||
| import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| import com.cloud.utils.exception.CloudRuntimeException; | ||||
| 
 | ||||
| @Component(value="EngineHostDetailsDao") | ||||
| @ -96,7 +96,7 @@ public class HostDetailsDaoImpl extends GenericDaoBase<DetailVO, Long> implement | ||||
|     public void persist(long hostId, Map<String, String> details) { | ||||
|         final String InsertOrUpdateSql = "INSERT INTO `cloud`.`host_details` (host_id, name, value) VALUES (?,?,?) ON DUPLICATE KEY UPDATE value=?"; | ||||
| 
 | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         txn.start(); | ||||
| 
 | ||||
|         for (Map.Entry<String, String> detail : details.entrySet()) { | ||||
|  | ||||
| @ -27,7 +27,7 @@ import com.cloud.host.HostTagVO; | ||||
| import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| 
 | ||||
| @Component(value="EngineHostTagsDao") | ||||
| @Local(value=HostTagsDao.class) | ||||
| @ -56,7 +56,7 @@ public class HostTagsDaoImpl extends GenericDaoBase<HostTagVO, Long> implements | ||||
|      | ||||
|     @Override | ||||
|     public void persist(long hostId, List<String> hostTags) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
| 
 | ||||
|         txn.start(); | ||||
|         SearchCriteria<HostTagVO> sc = HostSearch.create(); | ||||
|  | ||||
| @ -167,6 +167,10 @@ import com.cloud.utils.concurrency.NamedThreadFactory; | ||||
| import com.cloud.utils.db.DB; | ||||
| import com.cloud.utils.db.EntityManager; | ||||
| import com.cloud.utils.db.GlobalLock; | ||||
| import com.cloud.utils.db.TransactionCallback; | ||||
| import com.cloud.utils.db.TransactionCallbackNoReturn; | ||||
| import com.cloud.utils.db.TransactionCallbackWithExceptionNoReturn; | ||||
| import com.cloud.utils.db.TransactionStatus; | ||||
| import com.cloud.utils.db.JoinBuilder.JoinType; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria.Op; | ||||
| @ -346,7 +350,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra | ||||
|     @DB | ||||
|     public boolean configure(final String name, final Map<String, Object> params) throws ConfigurationException { | ||||
|         // populate providers | ||||
|         Map<Network.Service, Set<Network.Provider>> defaultSharedNetworkOfferingProviders = new HashMap<Network.Service, Set<Network.Provider>>(); | ||||
|         final Map<Network.Service, Set<Network.Provider>> defaultSharedNetworkOfferingProviders = new HashMap<Network.Service, Set<Network.Provider>>(); | ||||
|         Set<Network.Provider> defaultProviders = new HashSet<Network.Provider>(); | ||||
| 
 | ||||
|         defaultProviders.add(Network.Provider.VirtualRouter); | ||||
| @ -354,7 +358,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra | ||||
|         defaultSharedNetworkOfferingProviders.put(Service.Dns, defaultProviders); | ||||
|         defaultSharedNetworkOfferingProviders.put(Service.UserData, defaultProviders); | ||||
| 
 | ||||
|         Map<Network.Service, Set<Network.Provider>> defaultIsolatedNetworkOfferingProviders = defaultSharedNetworkOfferingProviders; | ||||
|         final Map<Network.Service, Set<Network.Provider>> defaultIsolatedNetworkOfferingProviders = defaultSharedNetworkOfferingProviders; | ||||
|         defaultIsolatedNetworkOfferingProviders.put(Service.Dhcp, defaultProviders); | ||||
|         defaultIsolatedNetworkOfferingProviders.put(Service.Dns, defaultProviders); | ||||
|         defaultIsolatedNetworkOfferingProviders.put(Service.UserData, defaultProviders); | ||||
| @ -365,7 +369,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra | ||||
|         defaultIsolatedNetworkOfferingProviders.put(Service.PortForwarding, defaultProviders); | ||||
|         defaultIsolatedNetworkOfferingProviders.put(Service.Vpn, defaultProviders); | ||||
| 
 | ||||
|         Map<Network.Service, Set<Network.Provider>> defaultSharedSGEnabledNetworkOfferingProviders = new HashMap<Network.Service, Set<Network.Provider>>(); | ||||
|         final Map<Network.Service, Set<Network.Provider>> defaultSharedSGEnabledNetworkOfferingProviders = new HashMap<Network.Service, Set<Network.Provider>>(); | ||||
|         defaultSharedSGEnabledNetworkOfferingProviders.put(Service.Dhcp, defaultProviders); | ||||
|         defaultSharedSGEnabledNetworkOfferingProviders.put(Service.Dns, defaultProviders); | ||||
|         defaultSharedSGEnabledNetworkOfferingProviders.put(Service.UserData, defaultProviders); | ||||
| @ -373,7 +377,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra | ||||
|         sgProviders.add(Provider.SecurityGroupProvider); | ||||
|         defaultSharedSGEnabledNetworkOfferingProviders.put(Service.SecurityGroup, sgProviders); | ||||
| 
 | ||||
|         Map<Network.Service, Set<Network.Provider>> defaultIsolatedSourceNatEnabledNetworkOfferingProviders = new HashMap<Network.Service, Set<Network.Provider>>(); | ||||
|         final Map<Network.Service, Set<Network.Provider>> defaultIsolatedSourceNatEnabledNetworkOfferingProviders = new HashMap<Network.Service, Set<Network.Provider>>(); | ||||
|         defaultProviders.clear(); | ||||
|         defaultProviders.add(Network.Provider.VirtualRouter); | ||||
|         defaultIsolatedSourceNatEnabledNetworkOfferingProviders.put(Service.Dhcp, defaultProviders); | ||||
| @ -387,7 +391,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra | ||||
|         defaultIsolatedSourceNatEnabledNetworkOfferingProviders.put(Service.PortForwarding, defaultProviders); | ||||
|         defaultIsolatedSourceNatEnabledNetworkOfferingProviders.put(Service.Vpn, defaultProviders); | ||||
| 
 | ||||
|         Map<Network.Service, Set<Network.Provider>> defaultVPCOffProviders = new HashMap<Network.Service, Set<Network.Provider>>(); | ||||
|         final Map<Network.Service, Set<Network.Provider>> defaultVPCOffProviders = new HashMap<Network.Service, Set<Network.Provider>>(); | ||||
|         defaultProviders.clear(); | ||||
|         defaultProviders.add(Network.Provider.VPCVirtualRouter); | ||||
|         defaultVPCOffProviders.put(Service.Dhcp, defaultProviders); | ||||
| @ -401,9 +405,9 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra | ||||
|         defaultVPCOffProviders.put(Service.PortForwarding, defaultProviders); | ||||
|         defaultVPCOffProviders.put(Service.Vpn, defaultProviders); | ||||
| 
 | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         txn.start(); | ||||
| 
 | ||||
|         Transaction.execute(new TransactionCallbackNoReturn() { | ||||
|             @Override | ||||
|             public void doInTransactionWithoutResult(TransactionStatus status) { | ||||
|                 NetworkOfferingVO offering = null; | ||||
|                 //#1 - quick cloud network offering | ||||
|                 if (_networkOfferingDao.findByUniqueName(NetworkOffering.QuickCloudNoServices) == null) { | ||||
| @ -526,8 +530,9 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra | ||||
|                     offering.setDedicatedLB(false); | ||||
|                     _networkOfferingDao.update(offering.getId(), offering); | ||||
|                 } | ||||
|             } | ||||
|         }); | ||||
| 
 | ||||
|         txn.commit(); | ||||
| 
 | ||||
|         AssignIpAddressSearch = _ipAddressDao.createSearchBuilder(); | ||||
|         AssignIpAddressSearch.and("dc", AssignIpAddressSearch.entity().getDataCenterId(), Op.EQ); | ||||
| @ -590,8 +595,8 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra | ||||
| 
 | ||||
|     @Override | ||||
|     @DB | ||||
|     public List<? extends Network> setupNetwork(Account owner, NetworkOffering offering, Network predefined, DeploymentPlan plan, String name, String displayText, | ||||
|         boolean errorIfAlreadySetup, Long domainId, ACLType aclType, Boolean subdomainAccess, Long vpcId, Boolean isDisplayNetworkEnabled) throws ConcurrentOperationException { | ||||
|     public List<? extends Network> setupNetwork(final Account owner, final NetworkOffering offering, final Network predefined, final DeploymentPlan plan, final String name, final String displayText, | ||||
|         boolean errorIfAlreadySetup, final Long domainId, final ACLType aclType, final Boolean subdomainAccess, final Long vpcId, final Boolean isDisplayNetworkEnabled) throws ConcurrentOperationException { | ||||
| 
 | ||||
|         Account locked = _accountDao.acquireInLockTable(owner.getId()); | ||||
|         if (locked == null) { | ||||
| @ -622,12 +627,12 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|             List<NetworkVO> networks = new ArrayList<NetworkVO>(); | ||||
|             final List<NetworkVO> networks = new ArrayList<NetworkVO>(); | ||||
| 
 | ||||
|             long related = -1; | ||||
| 
 | ||||
|             for (NetworkGuru guru : _networkGurus) { | ||||
|                 Network network = guru.design(offering, plan, predefined, owner); | ||||
|             for (final NetworkGuru guru : _networkGurus) { | ||||
|                 final Network network = guru.design(offering, plan, predefined, owner); | ||||
|                 if (network == null) { | ||||
|                     continue; | ||||
|                 } | ||||
| @ -641,28 +646,26 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra | ||||
|                     continue; | ||||
|                 } | ||||
| 
 | ||||
|                 long id = _networksDao.getNextInSequence(Long.class, "id"); | ||||
|                 final long id = _networksDao.getNextInSequence(Long.class, "id"); | ||||
|                 if (related == -1) { | ||||
|                     related = id; | ||||
|                 } | ||||
| 
 | ||||
|                 Transaction txn = Transaction.currentTxn(); | ||||
|                 txn.start(); | ||||
| 
 | ||||
|                 NetworkVO vo = new NetworkVO(id, network, offering.getId(), guru.getName(), owner.getDomainId(), owner.getId(), related, name, displayText, | ||||
|                 final long relatedFile = related; | ||||
|                 Transaction.execute(new TransactionCallbackNoReturn() { | ||||
|                     @Override | ||||
|                     public void doInTransactionWithoutResult(TransactionStatus status) { | ||||
|                         NetworkVO vo = new NetworkVO(id, network, offering.getId(), guru.getName(), owner.getDomainId(), owner.getId(), relatedFile, name, displayText, | ||||
|                             predefined.getNetworkDomain(), offering.getGuestType(), plan.getDataCenterId(), plan.getPhysicalNetworkId(), aclType, offering.getSpecifyIpRanges(), vpcId); | ||||
|                         vo.setDisplayNetwork(isDisplayNetworkEnabled == null ? true : isDisplayNetworkEnabled); | ||||
|                         networks.add(_networksDao.persist(vo, vo.getGuestType() == Network.GuestType.Isolated, | ||||
|                             finalizeServicesAndProvidersForNetwork(offering, plan.getPhysicalNetworkId()))); | ||||
|          | ||||
|                         if (domainId != null && aclType == ACLType.Domain) { | ||||
|                     if (subdomainAccess == null) { | ||||
|                         subdomainAccess = true; | ||||
|                             _networksDao.addDomainToNetwork(id, domainId, subdomainAccess == null ? true : subdomainAccess); | ||||
|                         } | ||||
|                     _networksDao.addDomainToNetwork(id, domainId, subdomainAccess); | ||||
|                     } | ||||
| 
 | ||||
|                 txn.commit(); | ||||
|                 }); | ||||
|             } | ||||
| 
 | ||||
|             if (networks.size() < 1) { | ||||
| @ -681,11 +684,12 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra | ||||
| 
 | ||||
|     @Override | ||||
|     @DB | ||||
|     public void allocate(VirtualMachineProfile vm, LinkedHashMap<? extends Network, ? extends NicProfile> networks) throws InsufficientCapacityException, | ||||
|     public void allocate(final VirtualMachineProfile vm, final LinkedHashMap<? extends Network, ? extends NicProfile> networks) throws InsufficientCapacityException, | ||||
|         ConcurrentOperationException { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         txn.start(); | ||||
| 
 | ||||
|         Transaction.execute(new TransactionCallbackWithExceptionNoReturn<InsufficientCapacityException>() { | ||||
|             @Override | ||||
|             public void doInTransactionWithoutResult(TransactionStatus status) throws InsufficientCapacityException { | ||||
|                 int deviceId = 0; | ||||
|          | ||||
|                 boolean[] deviceIds = new boolean[networks.size()]; | ||||
| @ -746,8 +750,8 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra | ||||
|                 if (nics.size() == 1) { | ||||
|                     nics.get(0).setDefaultNic(true); | ||||
|                 } | ||||
| 
 | ||||
|         txn.commit(); | ||||
|             } | ||||
|         }); | ||||
|     } | ||||
| 
 | ||||
|     @DB | ||||
| @ -900,7 +904,6 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra | ||||
|     @DB | ||||
|     public Pair<NetworkGuru, NetworkVO> implementNetwork(long networkId, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, | ||||
|         ResourceUnavailableException, InsufficientCapacityException { | ||||
|         Transaction.currentTxn(); | ||||
|         Pair<NetworkGuru, NetworkVO> implemented = new Pair<NetworkGuru, NetworkVO>(null, null); | ||||
| 
 | ||||
|         NetworkVO network = _networksDao.findById(networkId); | ||||
| @ -1176,9 +1179,10 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra | ||||
|     } | ||||
| 
 | ||||
|     @DB | ||||
|     protected void updateNic(NicVO nic, long networkId, int count) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         txn.start(); | ||||
|     protected void updateNic(final NicVO nic, final long networkId, final int count) { | ||||
|         Transaction.execute(new TransactionCallbackNoReturn() { | ||||
|             @Override | ||||
|             public void doInTransactionWithoutResult(TransactionStatus status) { | ||||
|                 _nicDao.update(nic.getId(), nic); | ||||
|          | ||||
|                 if (nic.getVmType() == VirtualMachine.Type.User) { | ||||
| @ -1190,8 +1194,8 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra | ||||
|                     (nic.getVmType() == VirtualMachine.Type.DomainRouter && _networksDao.findById(networkId).getTrafficType() == TrafficType.Guest)) { | ||||
|                     _networksDao.setCheckForGc(networkId); | ||||
|                 } | ||||
| 
 | ||||
|         txn.commit(); | ||||
|             } | ||||
|         }); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
| @ -1414,11 +1418,10 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra | ||||
|     } | ||||
| 
 | ||||
|     @DB | ||||
|     protected void releaseNic(VirtualMachineProfile vmProfile, long nicId) throws ConcurrentOperationException, ResourceUnavailableException { | ||||
|         //lock the nic | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         txn.start(); | ||||
| 
 | ||||
|     protected void releaseNic(final VirtualMachineProfile vmProfile, final long nicId) throws ConcurrentOperationException, ResourceUnavailableException { | ||||
|         Pair<Network,NicProfile> networkToRelease = Transaction.execute(new TransactionCallback<Pair<Network,NicProfile>>() { | ||||
|             @Override | ||||
|             public Pair<Network,NicProfile> doInTransaction(TransactionStatus status) { | ||||
|                 NicVO nic = _nicDao.lockRow(nicId, true); | ||||
|                 if (nic == null) { | ||||
|                     throw new ConcurrentOperationException("Unable to acquire lock on nic " + nic); | ||||
| @ -1443,10 +1446,21 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra | ||||
|                                 _nicDao.update(nic.getId(), nic); | ||||
|                             } | ||||
|                         } | ||||
|                 //commit the transaction before proceeding releasing nic profile on the network elements | ||||
|                 txn.commit(); | ||||
| 
 | ||||
|                         // Perform release on network elements | ||||
|                         return new Pair<Network,NicProfile>(network, profile); | ||||
|                     } else { | ||||
|                         nic.setState(Nic.State.Allocated); | ||||
|                         updateNic(nic, network.getId(), -1); | ||||
|                     } | ||||
|                 } | ||||
| 
 | ||||
|                 return null; | ||||
|             } | ||||
|         }); | ||||
| 
 | ||||
|         if (networkToRelease != null) { | ||||
|             Network network = networkToRelease.first(); | ||||
|             NicProfile profile = networkToRelease.second(); | ||||
|             List<Provider> providersToImplement = getNetworkProviders(network.getId()); | ||||
|             for (NetworkElement element : _networkElements) { | ||||
|                 if (providersToImplement.contains(element.getProvider())) { | ||||
| @ -1455,19 +1469,13 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra | ||||
|                                                         " either doesn't exist or is not enabled in physical network id: " + network.getPhysicalNetworkId()); | ||||
|                     } | ||||
|                     if (s_logger.isDebugEnabled()) { | ||||
|                             s_logger.debug("Asking " + element.getName() + " to release " + nic); | ||||
|                         s_logger.debug("Asking " + element.getName() + " to release " + profile); | ||||
|                     } | ||||
|                     //NOTE: Context appear to never be used in release method | ||||
|                     //implementations. Consider removing it from interface Element | ||||
|                     element.release(network, profile, vmProfile, null); | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|             } else { | ||||
|                 nic.setState(Nic.State.Allocated); | ||||
|                 updateNic(nic, network.getId(), -1); | ||||
|                 txn.commit(); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
| @ -1563,15 +1571,17 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra | ||||
|         Network network = _networksDao.findById(nic.getNetworkId()); | ||||
|         DhcpServiceProvider dhcpServiceProvider = getDhcpServiceProvider(network); | ||||
|         try { | ||||
|             NicIpAliasVO ipAlias = _nicIpAliasDao.findByGatewayAndNetworkIdAndState(nic.getGateway(), network.getId(), NicIpAlias.state.active); | ||||
|             final NicIpAliasVO ipAlias = _nicIpAliasDao.findByGatewayAndNetworkIdAndState(nic.getGateway(), network.getId(), NicIpAlias.state.active); | ||||
|             if (ipAlias != null) { | ||||
|                 ipAlias.setState(NicIpAlias.state.revoked); | ||||
|                 Transaction txn = Transaction.currentTxn(); | ||||
|                 txn.start(); | ||||
|                 Transaction.execute(new TransactionCallbackNoReturn() { | ||||
|                     @Override | ||||
|                     public void doInTransactionWithoutResult(TransactionStatus status) { | ||||
|                     _nicIpAliasDao.update(ipAlias.getId(), ipAlias); | ||||
|                     IPAddressVO aliasIpaddressVo = _publicIpAddressDao.findByIpAndSourceNetworkId(ipAlias.getNetworkId(), ipAlias.getIp4Address()); | ||||
|                     _publicIpAddressDao.unassignIpAddress(aliasIpaddressVo.getId()); | ||||
|                 txn.commit(); | ||||
|                     } | ||||
|                 }); | ||||
|                 if (!dhcpServiceProvider.removeDhcpSupportForSubnet(network)) { | ||||
|                     s_logger.warn("Failed to remove the ip alias on the router, marking it as removed in db and freed the allocated ip " + ipAlias.getIp4Address()); | ||||
|                 } | ||||
| @ -1593,18 +1603,18 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra | ||||
| 
 | ||||
|     @Override | ||||
|     @DB | ||||
|     public Network createGuestNetwork(long networkOfferingId, String name, String displayText, String gateway, String cidr, String vlanId, String networkDomain, Account owner, | ||||
|         Long domainId, PhysicalNetwork pNtwk, long zoneId, ACLType aclType, Boolean subdomainAccess, Long vpcId, String ip6Gateway, String ip6Cidr, | ||||
|         Boolean isDisplayNetworkEnabled, String isolatedPvlan) throws ConcurrentOperationException, InsufficientCapacityException, ResourceAllocationException { | ||||
|     public Network createGuestNetwork(long networkOfferingId, final String name, final String displayText, final String gateway, final String cidr, String vlanId, String networkDomain, final Account owner, | ||||
|         final Long domainId, final PhysicalNetwork pNtwk, final long zoneId, final ACLType aclType, Boolean subdomainAccess, final Long vpcId, final String ip6Gateway, final String ip6Cidr, | ||||
|         final Boolean isDisplayNetworkEnabled, final String isolatedPvlan) throws ConcurrentOperationException, InsufficientCapacityException, ResourceAllocationException { | ||||
| 
 | ||||
|         NetworkOfferingVO ntwkOff = _networkOfferingDao.findById(networkOfferingId); | ||||
|         final NetworkOfferingVO ntwkOff = _networkOfferingDao.findById(networkOfferingId); | ||||
|         // this method supports only guest network creation | ||||
|         if (ntwkOff.getTrafficType() != TrafficType.Guest) { | ||||
|             s_logger.warn("Only guest networks can be created using this method"); | ||||
|             return null; | ||||
|         } | ||||
| 
 | ||||
|         boolean updateResourceCount = resourceCountNeedsUpdate(ntwkOff, aclType); | ||||
|         final boolean updateResourceCount = resourceCountNeedsUpdate(ntwkOff, aclType); | ||||
|         //check resource limits | ||||
|         if (updateResourceCount) { | ||||
|             _resourceLimitMgr.checkResourceLimit(owner, ResourceType.network); | ||||
| @ -1632,7 +1642,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra | ||||
|             ipv6 = true; | ||||
|         } | ||||
|         // Validate zone | ||||
|         DataCenterVO zone = _dcDao.findById(zoneId); | ||||
|         final DataCenterVO zone = _dcDao.findById(zoneId); | ||||
|         if (zone.getNetworkType() == NetworkType.Basic) { | ||||
|             if (ipv6) { | ||||
|                 throw new InvalidParameterValueException("IPv6 is not supported in Basic zone"); | ||||
| @ -1819,16 +1829,19 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         txn.start(); | ||||
| 
 | ||||
|         final String networkDomainFinal = networkDomain; | ||||
|         final String vlanIdFinal = vlanId; | ||||
|         final Boolean subdomainAccessFinal = subdomainAccess; | ||||
|         Network network = Transaction.execute(new TransactionCallback<Network>() { | ||||
|             @Override | ||||
|             public Network doInTransaction(TransactionStatus status) { | ||||
|                 Long physicalNetworkId = null; | ||||
|                 if (pNtwk != null) { | ||||
|                     physicalNetworkId = pNtwk.getId(); | ||||
|                 } | ||||
|                 DataCenterDeployment plan = new DataCenterDeployment(zoneId, null, null, null, null, physicalNetworkId); | ||||
|                 NetworkVO userNetwork = new NetworkVO(); | ||||
|         userNetwork.setNetworkDomain(networkDomain); | ||||
|                 userNetwork.setNetworkDomain(networkDomainFinal); | ||||
|          | ||||
|                 if (cidr != null && gateway != null) { | ||||
|                     userNetwork.setCidr(cidr); | ||||
| @ -1840,25 +1853,25 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra | ||||
|                     userNetwork.setIp6Gateway(ip6Gateway); | ||||
|                 } | ||||
|          | ||||
|         if (vlanId != null) { | ||||
|                 if (vlanIdFinal != null) { | ||||
|                 	if (isolatedPvlan == null) { | ||||
|                 URI uri = BroadcastDomainType.fromString(vlanId); | ||||
|                         URI uri = BroadcastDomainType.fromString(vlanIdFinal); | ||||
|                         userNetwork.setBroadcastUri(uri); | ||||
|         		if (!vlanId.equalsIgnoreCase(Vlan.UNTAGGED)) { | ||||
|                 		if (!vlanIdFinal.equalsIgnoreCase(Vlan.UNTAGGED)) { | ||||
|                 			userNetwork.setBroadcastDomainType(BroadcastDomainType.Vlan); | ||||
|                 		} else { | ||||
|                 			userNetwork.setBroadcastDomainType(BroadcastDomainType.Native); | ||||
|                 		} | ||||
|                 	} else { | ||||
|         		if (vlanId.equalsIgnoreCase(Vlan.UNTAGGED)) { | ||||
|                 		if (vlanIdFinal.equalsIgnoreCase(Vlan.UNTAGGED)) { | ||||
|                 			throw new InvalidParameterValueException("Cannot support pvlan with untagged primary vlan!"); | ||||
|                 		} | ||||
|         		userNetwork.setBroadcastUri(NetUtils.generateUriForPvlan(vlanId, isolatedPvlan)); | ||||
|                 		userNetwork.setBroadcastUri(NetUtils.generateUriForPvlan(vlanIdFinal, isolatedPvlan)); | ||||
|                 		userNetwork.setBroadcastDomainType(BroadcastDomainType.Pvlan); | ||||
|                 	} | ||||
|                 } | ||||
|                  | ||||
|         List<? extends Network> networks = setupNetwork(owner, ntwkOff, userNetwork, plan, name, displayText, true, domainId, aclType, subdomainAccess, vpcId, | ||||
|                 List<? extends Network> networks = setupNetwork(owner, ntwkOff, userNetwork, plan, name, displayText, true, domainId, aclType, subdomainAccessFinal, vpcId, | ||||
|                     isDisplayNetworkEnabled); | ||||
|          | ||||
|                 Network network = null; | ||||
| @ -1883,15 +1896,17 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra | ||||
|                     _resourceLimitMgr.incrementResourceCount(owner.getId(), ResourceType.network); | ||||
|                 } | ||||
|                  | ||||
|         txn.commit(); | ||||
|                 return network; | ||||
|             } | ||||
|         }); | ||||
| 
 | ||||
|         CallContext.current().setEventDetails("Network Id: " + network.getId()); | ||||
|         return network; | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     @DB | ||||
|     public boolean shutdownNetwork(long networkId, ReservationContext context, boolean cleanupElements) { | ||||
|         boolean result = false; | ||||
|     public boolean shutdownNetwork(final long networkId, ReservationContext context, boolean cleanupElements) { | ||||
|         NetworkVO network = _networksDao.findById(networkId); | ||||
|         if (network.getState() == Network.State.Allocated) { | ||||
|             s_logger.debug("Network is already shutdown: " + network); | ||||
| @ -1936,43 +1951,51 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|             boolean success = shutdownNetworkElementsAndResources(context, cleanupElements, network); | ||||
|             final boolean success = shutdownNetworkElementsAndResources(context, cleanupElements, network); | ||||
| 
 | ||||
|             final NetworkVO networkFinal = network; | ||||
|             boolean result = Transaction.execute(new TransactionCallback<Boolean>() { | ||||
|                 @Override | ||||
|                 public Boolean doInTransaction(TransactionStatus status) { | ||||
|                     boolean result = false; | ||||
| 
 | ||||
|             Transaction txn = Transaction.currentTxn(); | ||||
|             txn.start(); | ||||
|                     if (success) { | ||||
|                         if (s_logger.isDebugEnabled()) { | ||||
|                             s_logger.debug("Network id=" + networkId + " is shutdown successfully, cleaning up corresponding resources now."); | ||||
|                         } | ||||
|                 NetworkGuru guru = AdapterBase.getAdapterByName(_networkGurus, network.getGuruName()); | ||||
|                 NetworkProfile profile = convertNetworkToNetworkProfile(network.getId()); | ||||
|                 guru.shutdown(profile, _networkOfferingDao.findById(network.getNetworkOfferingId())); | ||||
|                         NetworkGuru guru = AdapterBase.getAdapterByName(_networkGurus, networkFinal.getGuruName()); | ||||
|                         NetworkProfile profile = convertNetworkToNetworkProfile(networkFinal.getId()); | ||||
|                         guru.shutdown(profile, _networkOfferingDao.findById(networkFinal.getNetworkOfferingId())); | ||||
|          | ||||
|                 applyProfileToNetwork(network, profile); | ||||
|                 DataCenterVO zone = _dcDao.findById(network.getDataCenterId()); | ||||
|                 if (isSharedNetworkOfferingWithServices(network.getNetworkOfferingId()) && (zone.getNetworkType() == NetworkType.Advanced)) { | ||||
|                     network.setState(Network.State.Setup); | ||||
|                         applyProfileToNetwork(networkFinal, profile); | ||||
|                         DataCenterVO zone = _dcDao.findById(networkFinal.getDataCenterId()); | ||||
|                         if (isSharedNetworkOfferingWithServices(networkFinal.getNetworkOfferingId()) && (zone.getNetworkType() == NetworkType.Advanced)) { | ||||
|                             networkFinal.setState(Network.State.Setup); | ||||
|                         } else { | ||||
|                             try { | ||||
|                         stateTransitTo(network, Event.OperationSucceeded); | ||||
|                                 stateTransitTo(networkFinal, Event.OperationSucceeded); | ||||
|                             } catch (NoTransitionException e) { | ||||
|                         network.setState(Network.State.Allocated); | ||||
|                         network.setRestartRequired(false); | ||||
|                                 networkFinal.setState(Network.State.Allocated); | ||||
|                                 networkFinal.setRestartRequired(false); | ||||
|                             } | ||||
|                         } | ||||
|                 _networksDao.update(network.getId(), network); | ||||
|                         _networksDao.update(networkFinal.getId(), networkFinal); | ||||
|                         _networksDao.clearCheckForGc(networkId); | ||||
|                         result = true; | ||||
|                     } else { | ||||
|                         try { | ||||
|                     stateTransitTo(network, Event.OperationFailed); | ||||
|                             stateTransitTo(networkFinal, Event.OperationFailed); | ||||
|                         } catch (NoTransitionException e) { | ||||
|                     network.setState(Network.State.Implemented); | ||||
|                     _networksDao.update(network.getId(), network); | ||||
|                             networkFinal.setState(Network.State.Implemented); | ||||
|                             _networksDao.update(networkFinal.getId(), networkFinal); | ||||
|                         } | ||||
|                         result = false; | ||||
|                     } | ||||
|             txn.commit(); | ||||
| 
 | ||||
|                     return result; | ||||
|                 } | ||||
|             }); | ||||
| 
 | ||||
|             return result; | ||||
|         } finally { | ||||
|             if (network != null) { | ||||
| @ -2036,8 +2059,8 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra | ||||
| 
 | ||||
|     @Override | ||||
|     @DB | ||||
|     public boolean destroyNetwork(long networkId, ReservationContext context) { | ||||
|         Account callerAccount = context.getAccount(); | ||||
|     public boolean destroyNetwork(long networkId, final ReservationContext context) { | ||||
|         final Account callerAccount = context.getAccount(); | ||||
| 
 | ||||
|         NetworkVO network = _networksDao.findById(networkId); | ||||
|         if (network == null) { | ||||
| @ -2126,38 +2149,48 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra | ||||
|             if (s_logger.isDebugEnabled()) { | ||||
|                 s_logger.debug("Network id=" + networkId + " is destroyed successfully, cleaning up corresponding resources now."); | ||||
|             } | ||||
|             NetworkGuru guru = AdapterBase.getAdapterByName(_networkGurus, network.getGuruName()); | ||||
| 
 | ||||
|             Transaction txn = Transaction.currentTxn(); | ||||
|             txn.start(); | ||||
|             guru.trash(network, _networkOfferingDao.findById(network.getNetworkOfferingId())); | ||||
|             final NetworkVO networkFinal = network; | ||||
|             try { | ||||
|                 Transaction.execute(new TransactionCallbackNoReturn() { | ||||
|                     @Override | ||||
|                     public void doInTransactionWithoutResult(TransactionStatus status) { | ||||
|                         NetworkGuru guru = AdapterBase.getAdapterByName(_networkGurus, networkFinal.getGuruName()); | ||||
|      | ||||
|             if (!deleteVlansInNetwork(network.getId(), context.getCaller().getId(), callerAccount)) { | ||||
|                 success = false; | ||||
|                 s_logger.warn("Failed to delete network " + network + "; was unable to cleanup corresponding ip ranges"); | ||||
|                         guru.trash(networkFinal, _networkOfferingDao.findById(networkFinal.getNetworkOfferingId())); | ||||
|      | ||||
|                         if (!deleteVlansInNetwork(networkFinal.getId(), context.getCaller().getId(), callerAccount)) { | ||||
|                             s_logger.warn("Failed to delete network " + networkFinal + "; was unable to cleanup corresponding ip ranges"); | ||||
|                             throw new CloudRuntimeException("Failed to delete network " + networkFinal + "; was unable to cleanup corresponding ip ranges"); | ||||
|                         } else { | ||||
|                             // commit transaction only when ips and vlans for the network are released successfully | ||||
|                             try { | ||||
|                     stateTransitTo(network, Event.DestroyNetwork); | ||||
|                                 stateTransitTo(networkFinal, Event.DestroyNetwork); | ||||
|                             } catch (NoTransitionException e) { | ||||
|                                 s_logger.debug(e.getMessage()); | ||||
|                             } | ||||
|                 if (_networksDao.remove(network.getId())) { | ||||
|                     NetworkDomainVO networkDomain = _networkDomainDao.getDomainNetworkMapByNetworkId(network.getId()); | ||||
|                             if (_networksDao.remove(networkFinal.getId())) { | ||||
|                                 NetworkDomainVO networkDomain = _networkDomainDao.getDomainNetworkMapByNetworkId(networkFinal.getId()); | ||||
|                                 if (networkDomain != null) | ||||
|                                     _networkDomainDao.remove(networkDomain.getId()); | ||||
|      | ||||
|                     NetworkAccountVO networkAccount = _networkAccountDao.getAccountNetworkMapByNetworkId(network.getId()); | ||||
|                                 NetworkAccountVO networkAccount = _networkAccountDao.getAccountNetworkMapByNetworkId(networkFinal.getId()); | ||||
|                                 if (networkAccount != null) | ||||
|                                     _networkAccountDao.remove(networkAccount.getId()); | ||||
|                             } | ||||
|      | ||||
|                 NetworkOffering ntwkOff = _entityMgr.findById(NetworkOffering.class, network.getNetworkOfferingId()); | ||||
|                 boolean updateResourceCount = resourceCountNeedsUpdate(ntwkOff, network.getAclType()); | ||||
|                             NetworkOffering ntwkOff = _entityMgr.findById(NetworkOffering.class, networkFinal.getNetworkOfferingId()); | ||||
|                             boolean updateResourceCount = resourceCountNeedsUpdate(ntwkOff, networkFinal.getAclType()); | ||||
|                             if (updateResourceCount) { | ||||
|                     _resourceLimitMgr.decrementResourceCount(network.getAccountId(), ResourceType.network); | ||||
|                                 _resourceLimitMgr.decrementResourceCount(networkFinal.getAccountId(), ResourceType.network); | ||||
|                             } | ||||
|                 txn.commit(); | ||||
|                         } | ||||
|                     } | ||||
|                 }); | ||||
|                 return false; | ||||
|             } catch ( CloudRuntimeException e ) { | ||||
|                 s_logger.error("Failed to delete network", e); | ||||
|                 return false; | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
| @ -2426,24 +2459,22 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra | ||||
| 
 | ||||
|     @DB | ||||
|     @Override | ||||
|     public boolean reallocate(VirtualMachineProfile vm, DataCenterDeployment dest) throws InsufficientCapacityException, ConcurrentOperationException { | ||||
|     public boolean reallocate(final VirtualMachineProfile vm, DataCenterDeployment dest) throws InsufficientCapacityException, ConcurrentOperationException { | ||||
|         VMInstanceVO vmInstance = _vmDao.findById(vm.getId()); | ||||
|         DataCenterVO dc = _dcDao.findById(vmInstance.getDataCenterId()); | ||||
|         if (dc.getNetworkType() == NetworkType.Basic) { | ||||
|             List<NicVO> nics = _nicDao.listByVmId(vmInstance.getId()); | ||||
|             NetworkVO network = _networksDao.findById(nics.get(0).getNetworkId()); | ||||
|             LinkedHashMap<Network, NicProfile> profiles = new LinkedHashMap<Network, NicProfile>(); | ||||
|             final LinkedHashMap<Network, NicProfile> profiles = new LinkedHashMap<Network, NicProfile>(); | ||||
|             profiles.put(network, null); | ||||
| 
 | ||||
|             Transaction txn = Transaction.currentTxn(); | ||||
|             txn.start(); | ||||
| 
 | ||||
|             try { | ||||
|             Transaction.execute(new TransactionCallbackWithExceptionNoReturn<InsufficientCapacityException>() { | ||||
|                 @Override | ||||
|                 public void doInTransactionWithoutResult(TransactionStatus status) throws InsufficientCapacityException { | ||||
|                     cleanupNics(vm); | ||||
|                     allocate(vm, profiles); | ||||
|             } finally { | ||||
|                 txn.commit(); | ||||
|                 } | ||||
|             }); | ||||
|         } | ||||
|         return true; | ||||
|     } | ||||
| @ -3050,9 +3081,10 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra | ||||
|         return nic.getSecondaryIp(); | ||||
|     } | ||||
| 
 | ||||
|     private boolean removeVmSecondaryIpsOfNic(long nicId) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         txn.start(); | ||||
|     private boolean removeVmSecondaryIpsOfNic(final long nicId) { | ||||
|         Transaction.execute(new TransactionCallbackNoReturn() { | ||||
|             @Override | ||||
|             public void doInTransactionWithoutResult(TransactionStatus status) { | ||||
|                 List<NicSecondaryIpVO> ipList = _nicSecondaryIpDao.listByNicId(nicId); | ||||
|                 if (ipList != null) { | ||||
|                     for (NicSecondaryIpVO ip : ipList) { | ||||
| @ -3060,7 +3092,9 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra | ||||
|                     } | ||||
|                     s_logger.debug("Revoving nic secondary ip entry ..."); | ||||
|                 } | ||||
|         txn.commit(); | ||||
|             } | ||||
|         }); | ||||
| 
 | ||||
|         return true; | ||||
|     } | ||||
| 
 | ||||
|  | ||||
| @ -31,7 +31,6 @@ import javax.inject.Inject; | ||||
| import javax.naming.ConfigurationException; | ||||
| 
 | ||||
| import org.apache.log4j.Logger; | ||||
| 
 | ||||
| import org.apache.cloudstack.engine.orchestration.service.VolumeOrchestrationService; | ||||
| import org.apache.cloudstack.engine.subsystem.api.storage.DataStore; | ||||
| import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager; | ||||
| @ -97,6 +96,9 @@ import com.cloud.utils.component.ManagerBase; | ||||
| import com.cloud.utils.db.DB; | ||||
| import com.cloud.utils.db.EntityManager; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionCallback; | ||||
| import com.cloud.utils.db.TransactionCallbackNoReturn; | ||||
| import com.cloud.utils.db.TransactionStatus; | ||||
| import com.cloud.utils.exception.CloudRuntimeException; | ||||
| import com.cloud.utils.fsm.NoTransitionException; | ||||
| import com.cloud.utils.fsm.StateMachine2; | ||||
| @ -681,9 +683,7 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati | ||||
|     } | ||||
| 
 | ||||
|     @DB | ||||
|     protected VolumeVO switchVolume(VolumeVO existingVolume, VirtualMachineProfile vm) throws StorageUnavailableException { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
| 
 | ||||
|     protected VolumeVO switchVolume(final VolumeVO existingVolume, final VirtualMachineProfile vm) throws StorageUnavailableException { | ||||
|         Long templateIdToUse = null; | ||||
|         Long volTemplateId = existingVolume.getTemplateId(); | ||||
|         long vmTemplateId = vm.getTemplateId(); | ||||
| @ -695,8 +695,11 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati | ||||
|             templateIdToUse = vmTemplateId; | ||||
|         } | ||||
| 
 | ||||
|         txn.start(); | ||||
|         VolumeVO newVolume = allocateDuplicateVolumeVO(existingVolume, templateIdToUse); | ||||
|         final Long templateIdToUseFinal = templateIdToUse;  | ||||
|         return Transaction.execute(new TransactionCallback<VolumeVO>() { | ||||
|             @Override | ||||
|             public VolumeVO doInTransaction(TransactionStatus status) { | ||||
|                 VolumeVO newVolume = allocateDuplicateVolumeVO(existingVolume, templateIdToUseFinal); | ||||
|                 // In case of Vmware if vm reference is not removed then during root | ||||
|                 // disk cleanup | ||||
|                 // the vm also gets deleted, so remove the reference | ||||
| @ -708,9 +711,10 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati | ||||
|                 } catch (NoTransitionException e) { | ||||
|                     s_logger.debug("Unable to destroy existing volume: " + e.toString()); | ||||
|                 } | ||||
|         txn.commit(); | ||||
|         return newVolume; | ||||
|                  | ||||
|                 return newVolume; | ||||
|             } | ||||
|         }); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
| @ -724,10 +728,12 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati | ||||
|         if (s_logger.isDebugEnabled()) { | ||||
|             s_logger.debug("Cleaning storage for vm: " + vmId); | ||||
|         } | ||||
|         List<VolumeVO> volumesForVm = _volsDao.findByInstance(vmId); | ||||
|         List<VolumeVO> toBeExpunged = new ArrayList<VolumeVO>(); | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         txn.start(); | ||||
|         final List<VolumeVO> volumesForVm = _volsDao.findByInstance(vmId); | ||||
|         final List<VolumeVO> toBeExpunged = new ArrayList<VolumeVO>(); | ||||
| 
 | ||||
|         Transaction.execute(new TransactionCallbackNoReturn() { | ||||
|             @Override | ||||
|             public void doInTransactionWithoutResult(TransactionStatus status) { | ||||
|                 for (VolumeVO vol : volumesForVm) { | ||||
|                     if (vol.getVolumeType().equals(Type.ROOT)) { | ||||
|                         // Destroy volume if not already destroyed | ||||
| @ -745,7 +751,9 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati | ||||
|                         _volsDao.detachVolume(vol.getId()); | ||||
|                     } | ||||
|                 } | ||||
|         txn.commit(); | ||||
|             } | ||||
|         }); | ||||
| 
 | ||||
|         AsyncCallFuture<VolumeApiResult> future = null; | ||||
|         for (VolumeVO expunge : toBeExpunged) { | ||||
|             future = volService.expungeVolumeAsync(volFactory.getVolume(expunge.getId())); | ||||
|  | ||||
| @ -29,7 +29,7 @@ import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.SearchCriteria.Op; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| 
 | ||||
| @Component | ||||
| @Local(value = { AlertDao.class }) | ||||
| @ -116,7 +116,7 @@ public class AlertDaoImpl extends GenericDaoBase<AlertVO, Long> implements Alert | ||||
|             return result; | ||||
|         } | ||||
|         if (alerts != null && !alerts.isEmpty()) { | ||||
|             Transaction txn = Transaction.currentTxn(); | ||||
|             TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|             txn.start(); | ||||
|             for (AlertVO alert : alerts) { | ||||
|                 alert = lockRow(alert.getId(), true); | ||||
|  | ||||
| @ -46,7 +46,7 @@ import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.SearchCriteria.Func; | ||||
| import com.cloud.utils.db.SearchCriteria.Op; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| import com.cloud.utils.exception.CloudRuntimeException; | ||||
| 
 | ||||
| @Component | ||||
| @ -186,7 +186,7 @@ public class CapacityDaoImpl extends GenericDaoBase<CapacityVO, Long> implements | ||||
|     @Override | ||||
|     public  List<Long> listClustersCrossingThreshold(short capacityType, Long zoneId, String configName, long compute_requested){ | ||||
| 
 | ||||
|          Transaction txn = Transaction.currentTxn(); | ||||
|          TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|          PreparedStatement pstmt = null; | ||||
|          List<Long> result = new ArrayList<Long>();          | ||||
|          StringBuilder sql = new StringBuilder(LIST_CLUSTERS_CROSSING_THRESHOLD); | ||||
| @ -241,7 +241,7 @@ public class CapacityDaoImpl extends GenericDaoBase<CapacityVO, Long> implements | ||||
|     @Override | ||||
|     public  List<SummedCapacity> findCapacityBy(Integer capacityType, Long zoneId, Long podId, Long clusterId, String resource_state){ | ||||
| 
 | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         PreparedStatement pstmt = null; | ||||
|         List<SummedCapacity> result = new ArrayList<SummedCapacity>(); | ||||
| 
 | ||||
| @ -291,7 +291,7 @@ public class CapacityDaoImpl extends GenericDaoBase<CapacityVO, Long> implements | ||||
|     public  List<SummedCapacity> listCapacitiesGroupedByLevelAndType(Integer capacityType, Long zoneId, Long podId, Long clusterId, int level, Long limit){ | ||||
| 
 | ||||
|         StringBuilder finalQuery = new StringBuilder();  | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         PreparedStatement pstmt = null; | ||||
|         List<SummedCapacity> result = new ArrayList<SummedCapacity>(); | ||||
| 
 | ||||
| @ -378,7 +378,7 @@ public class CapacityDaoImpl extends GenericDaoBase<CapacityVO, Long> implements | ||||
|     @Override | ||||
|     public  List<SummedCapacity> findCapacityBy(Integer capacityType, Long zoneId, Long podId, Long clusterId){ | ||||
| 
 | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         PreparedStatement pstmt = null; | ||||
|         List<SummedCapacity> result = new ArrayList<SummedCapacity>(); | ||||
| 
 | ||||
| @ -425,7 +425,7 @@ public class CapacityDaoImpl extends GenericDaoBase<CapacityVO, Long> implements | ||||
|     } | ||||
| 
 | ||||
|     public void updateAllocated(Long hostId, long allocatedAmount, short capacityType, boolean add) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         PreparedStatement pstmt = null; | ||||
|         try { | ||||
|             txn.start(); | ||||
| @ -458,7 +458,7 @@ public class CapacityDaoImpl extends GenericDaoBase<CapacityVO, Long> implements | ||||
| 
 | ||||
|     @Override | ||||
|     public List<Long> listClustersInZoneOrPodByHostCapacities(long id, int requiredCpu, long requiredRam, short capacityTypeForOrdering, boolean isZone){ | ||||
|     Transaction txn = Transaction.currentTxn(); | ||||
|     TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         PreparedStatement pstmt = null; | ||||
|         List<Long> result = new ArrayList<Long>(); | ||||
| 
 | ||||
| @ -503,7 +503,7 @@ public class CapacityDaoImpl extends GenericDaoBase<CapacityVO, Long> implements | ||||
| 
 | ||||
|     @Override | ||||
|     public List<Long> listHostsWithEnoughCapacity(int requiredCpu, long requiredRam, Long clusterId, String hostType){ | ||||
|     Transaction txn = Transaction.currentTxn(); | ||||
|     TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         PreparedStatement pstmt = null; | ||||
|         List<Long> result = new ArrayList<Long>(); | ||||
| 
 | ||||
| @ -599,7 +599,7 @@ public class CapacityDaoImpl extends GenericDaoBase<CapacityVO, Long> implements | ||||
|     @Override | ||||
|     public List<SummedCapacity> findByClusterPodZone(Long zoneId, Long podId, Long clusterId){ | ||||
| 
 | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         PreparedStatement pstmt = null; | ||||
|         List<SummedCapacity> result = new ArrayList<SummedCapacity>(); | ||||
| 
 | ||||
| @ -711,7 +711,7 @@ public class CapacityDaoImpl extends GenericDaoBase<CapacityVO, Long> implements | ||||
| 
 | ||||
|     @Override | ||||
|     public Pair<List<Long>, Map<Long, Double>> orderClustersByAggregateCapacity(long id, short capacityTypeForOrdering, boolean isZone){ | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         PreparedStatement pstmt = null; | ||||
|         List<Long> result = new ArrayList<Long>(); | ||||
|         Map<Long, Double> clusterCapacityMap = new HashMap<Long, Double>(); | ||||
| @ -764,7 +764,7 @@ public class CapacityDaoImpl extends GenericDaoBase<CapacityVO, Long> implements | ||||
| 
 | ||||
|     @Override | ||||
|     public List<Long> listPodsByHostCapacities(long zoneId, int requiredCpu, long requiredRam, short capacityType) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         PreparedStatement pstmt = null; | ||||
|         List<Long> result = new ArrayList<Long>(); | ||||
| 
 | ||||
| @ -798,7 +798,7 @@ public class CapacityDaoImpl extends GenericDaoBase<CapacityVO, Long> implements | ||||
| 
 | ||||
|     @Override | ||||
|     public Pair<List<Long>, Map<Long, Double>> orderPodsByAggregateCapacity(long zoneId, short capacityTypeForOrdering) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         PreparedStatement pstmt = null; | ||||
|         List<Long> result = new ArrayList<Long>(); | ||||
|         Map<Long, Double> podCapacityMap = new HashMap<Long, Double>(); | ||||
| @ -840,7 +840,7 @@ public class CapacityDaoImpl extends GenericDaoBase<CapacityVO, Long> implements | ||||
| 
 | ||||
|     @Override | ||||
|     public void updateCapacityState(Long dcId, Long podId, Long clusterId, Long hostId, String capacityState) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         StringBuilder sql = new StringBuilder(UPDATE_CAPACITY_STATE); | ||||
|         List<Long> resourceIdList = new ArrayList<Long>(); | ||||
| 
 | ||||
|  | ||||
| @ -40,7 +40,7 @@ import com.cloud.utils.db.DB; | ||||
| import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| 
 | ||||
| @Component | ||||
| @Local(value={ResourceCountDao.class}) | ||||
| @ -158,7 +158,7 @@ public class ResourceCountDaoImpl extends GenericDaoBase<ResourceCountVO, Long> | ||||
|     @Override @DB | ||||
|     public void createResourceCounts(long ownerId, ResourceLimit.ResourceOwnerType ownerType){ | ||||
| 
 | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         txn.start(); | ||||
| 
 | ||||
|         ResourceType[] resourceTypes = Resource.ResourceType.values(); | ||||
|  | ||||
| @ -30,7 +30,7 @@ import com.cloud.utils.crypt.DBEncryptionUtil; | ||||
| import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| 
 | ||||
| @Local(value=ClusterDetailsDao.class) | ||||
| public class ClusterDetailsDaoImpl extends GenericDaoBase<ClusterDetailsVO, Long> implements ClusterDetailsDao, ScopedConfigStorage { | ||||
| @ -100,7 +100,7 @@ public class ClusterDetailsDaoImpl extends GenericDaoBase<ClusterDetailsVO, Long | ||||
| 
 | ||||
|     @Override | ||||
|     public void persist(long clusterId, Map<String, String> details) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         txn.start(); | ||||
|         SearchCriteria<ClusterDetailsVO> sc = ClusterSearch.create(); | ||||
|         sc.setParameters("clusterId", clusterId); | ||||
| @ -119,7 +119,7 @@ public class ClusterDetailsDaoImpl extends GenericDaoBase<ClusterDetailsVO, Long | ||||
| 
 | ||||
|     @Override | ||||
|     public void persist(long clusterId, String name, String value) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         txn.start(); | ||||
|         SearchCriteria<ClusterDetailsVO> sc = DetailSearch.create(); | ||||
|         sc.setParameters("clusterId", clusterId); | ||||
|  | ||||
| @ -40,7 +40,7 @@ import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.SearchCriteria.Func; | ||||
| import com.cloud.utils.db.SearchCriteria.Op; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| import com.cloud.utils.exception.CloudRuntimeException; | ||||
| 
 | ||||
| @Component | ||||
| @ -156,7 +156,7 @@ public class ClusterDaoImpl extends GenericDaoBase<ClusterVO, Long> implements C | ||||
| 
 | ||||
|     @Override | ||||
|     public Map<Long, List<Long>> getPodClusterIdMap(List<Long> clusterIds){ | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         PreparedStatement pstmt = null; | ||||
|         Map<Long, List<Long>> result = new HashMap<Long, List<Long>>(); | ||||
| 
 | ||||
| @ -243,7 +243,7 @@ public class ClusterDaoImpl extends GenericDaoBase<ClusterVO, Long> implements C | ||||
| 
 | ||||
|     @Override | ||||
|     public boolean remove(Long id) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         txn.start(); | ||||
|         ClusterVO cluster = createForUpdate(); | ||||
|         cluster.setName(null); | ||||
|  | ||||
| @ -26,7 +26,7 @@ import com.cloud.utils.db.DB; | ||||
| import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| 
 | ||||
| @Component | ||||
| @Local(value=ClusterVSMMapDao.class) | ||||
| @ -79,7 +79,7 @@ public class ClusterVSMMapDaoImpl extends GenericDaoBase<ClusterVSMMapVO, Long> | ||||
|     } | ||||
|      | ||||
|     public boolean remove(Long id) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         txn.start(); | ||||
|         ClusterVSMMapVO cluster = createForUpdate(); | ||||
|         //cluster.setClusterId(null); | ||||
|  | ||||
| @ -44,7 +44,7 @@ import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.SequenceFetcher; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| import com.cloud.utils.net.NetUtils; | ||||
| 
 | ||||
| /** | ||||
| @ -343,7 +343,7 @@ public class DataCenterDaoImpl extends GenericDaoBase<DataCenterVO, Long> implem | ||||
| 
 | ||||
|     @Override @DB | ||||
|     public boolean update(Long zoneId, DataCenterVO zone) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         txn.start(); | ||||
|         boolean persisted = super.update(zoneId, zone); | ||||
|         if (!persisted) { | ||||
| @ -408,7 +408,7 @@ public class DataCenterDaoImpl extends GenericDaoBase<DataCenterVO, Long> implem | ||||
| 
 | ||||
|     @Override | ||||
|     public boolean remove(Long id) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         txn.start(); | ||||
|         DataCenterVO zone = createForUpdate(); | ||||
|         zone.setName(null); | ||||
|  | ||||
| @ -33,7 +33,7 @@ import com.cloud.utils.db.GenericSearchBuilder; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.SearchCriteria.Func; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| import com.cloud.utils.exception.CloudRuntimeException; | ||||
| import com.cloud.utils.net.NetUtils; | ||||
| 
 | ||||
| @ -52,7 +52,7 @@ public class DataCenterIpAddressDaoImpl extends GenericDaoBase<DataCenterIpAddre | ||||
|         sc.setParameters("pod", podId); | ||||
|         sc.setParameters("taken", (Date)null); | ||||
|          | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         txn.start(); | ||||
|         DataCenterIpAddressVO  vo = lockOneRandomRow(sc, true); | ||||
|         if (vo == null) { | ||||
| @ -73,7 +73,7 @@ public class DataCenterIpAddressDaoImpl extends GenericDaoBase<DataCenterIpAddre | ||||
|         sc.setParameters("dc", dcId); | ||||
|         sc.setParameters("taken", (Date)null); | ||||
|          | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         txn.start(); | ||||
|         DataCenterIpAddressVO  vo = lockOneRandomRow(sc, true); | ||||
|         if (vo == null) { | ||||
| @ -108,7 +108,7 @@ public class DataCenterIpAddressDaoImpl extends GenericDaoBase<DataCenterIpAddre | ||||
|      | ||||
|     @DB | ||||
|     public void addIpRange(long dcId, long podId, String start, String end) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         String insertSql = "INSERT INTO `cloud`.`op_dc_ip_address_alloc` (ip_address, data_center_id, pod_id, mac_address) VALUES (?, ?, ?, (select mac_address from `cloud`.`data_center` where id=?))"; | ||||
|         String updateSql = "UPDATE `cloud`.`data_center` set mac_address = mac_address+1 where id=?"; | ||||
|         PreparedStatement stmt = null; | ||||
|  | ||||
| @ -35,7 +35,7 @@ import com.cloud.utils.db.GenericSearchBuilder; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.SearchCriteria.Func; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| import com.cloud.utils.exception.CloudRuntimeException; | ||||
| import com.cloud.utils.net.NetUtils; | ||||
| 
 | ||||
| @ -54,7 +54,7 @@ public class DataCenterLinkLocalIpAddressDaoImpl extends GenericDaoBase<DataCent | ||||
|         sc.setParameters("pod", podId); | ||||
|         sc.setParameters("taken", (Date)null); | ||||
|          | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         txn.start(); | ||||
|          | ||||
|         DataCenterLinkLocalIpAddressVO  vo = lockOneRandomRow(sc, true); | ||||
| @ -84,7 +84,7 @@ public class DataCenterLinkLocalIpAddressDaoImpl extends GenericDaoBase<DataCent | ||||
|         long startIP = NetUtils.ip2Long(start); | ||||
|         long endIP = NetUtils.ip2Long(end); | ||||
| 
 | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         try { | ||||
|             txn.start(); | ||||
|             stmt = txn.prepareAutoCloseStatement(insertSql); | ||||
|  | ||||
| @ -21,6 +21,7 @@ import java.util.List; | ||||
| import com.cloud.dc.DataCenterVnetVO; | ||||
| import com.cloud.utils.db.GenericDao; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| 
 | ||||
| public interface DataCenterVnetDao extends GenericDao<DataCenterVnetVO, Long> { | ||||
|     public List<DataCenterVnetVO> listAllocatedVnets(long physicalNetworkId); | ||||
| @ -33,7 +34,7 @@ public interface DataCenterVnetDao extends GenericDao<DataCenterVnetVO, Long> { | ||||
|      | ||||
|     public void delete(long physicalNetworkId); | ||||
| 
 | ||||
|     public void deleteVnets(Transaction txn, long dcId, long physicalNetworkId, List<String> vnets); | ||||
|     public void deleteVnets(TransactionLegacy txn, long dcId, long physicalNetworkId, List<String> vnets); | ||||
| 
 | ||||
|     public void lockRange(long dcId, long physicalNetworkId, Integer start, Integer end); | ||||
| 
 | ||||
|  | ||||
| @ -38,7 +38,7 @@ import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.SearchCriteria.Func; | ||||
| import com.cloud.utils.db.SearchCriteria.Op; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| import com.cloud.utils.exception.CloudRuntimeException; | ||||
| 
 | ||||
| /** | ||||
| @ -121,7 +121,7 @@ public class DataCenterVnetDaoImpl extends GenericDaoBase<DataCenterVnetVO, Long | ||||
|     public void add(long dcId, long physicalNetworkId, List<String> vnets) { | ||||
|         String insertVnet = "INSERT INTO `cloud`.`op_dc_vnet_alloc` (vnet, data_center_id, physical_network_id) VALUES ( ?, ?, ?)"; | ||||
|          | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         try { | ||||
|             txn.start(); | ||||
|             PreparedStatement stmt = txn.prepareAutoCloseStatement(insertVnet); | ||||
| @ -139,7 +139,7 @@ public class DataCenterVnetDaoImpl extends GenericDaoBase<DataCenterVnetVO, Long | ||||
|     } | ||||
| 
 | ||||
|     //In the List<string> argument each string is a vlan. not a vlanRange. | ||||
|     public void deleteVnets(Transaction txn, long dcId, long physicalNetworkId, List<String> vnets) { | ||||
|     public void deleteVnets(TransactionLegacy txn, long dcId, long physicalNetworkId, List<String> vnets) { | ||||
|         String deleteVnet = "DELETE FROM `cloud`.`op_dc_vnet_alloc` WHERE data_center_id=? AND physical_network_id=? AND taken IS NULL AND vnet=?"; | ||||
|         try { | ||||
|             PreparedStatement stmt = txn.prepareAutoCloseStatement(deleteVnet); | ||||
| @ -171,7 +171,7 @@ public class DataCenterVnetDaoImpl extends GenericDaoBase<DataCenterVnetVO, Long | ||||
|         } | ||||
|         sc.setParameters("physicalNetworkId", physicalNetworkId); | ||||
|         Date now = new Date(); | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         txn.start(); | ||||
|         DataCenterVnetVO vo = lockOneRandomRow(sc, true); | ||||
|         if (vo == null) { | ||||
|  | ||||
| @ -31,7 +31,7 @@ import com.cloud.dc.DcDetailVO; | ||||
| import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| 
 | ||||
| @Local(value=DcDetailsDao.class) | ||||
| public class DcDetailsDaoImpl extends GenericDaoBase<DcDetailVO, Long> implements DcDetailsDao, ScopedConfigStorage { | ||||
| @ -106,7 +106,7 @@ public class DcDetailsDaoImpl extends GenericDaoBase<DcDetailVO, Long> implement | ||||
| 
 | ||||
|     @Override | ||||
|     public void persist(long dcId, Map<String, String> details) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         txn.start(); | ||||
|         SearchCriteria<DcDetailVO> sc = DcSearch.create(); | ||||
|         sc.setParameters("dcId", dcId); | ||||
|  | ||||
| @ -35,7 +35,7 @@ import com.cloud.utils.db.GenericSearchBuilder; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.SearchCriteria.Op; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| 
 | ||||
| @Component | ||||
| @Local(value={HostPodDao.class}) | ||||
| @ -85,7 +85,7 @@ public class HostPodDaoImpl extends GenericDaoBase<HostPodVO, Long> implements H | ||||
|         HashMap<Long, List<Object>> currentPodCidrSubnets = new HashMap<Long, List<Object>>(); | ||||
| 
 | ||||
|         String selectSql = "SELECT id, cidr_address, cidr_size FROM host_pod_ref WHERE data_center_id=" + zoneId +" and removed IS NULL"; | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         try { | ||||
|             PreparedStatement stmt = txn.prepareAutoCloseStatement(selectSql); | ||||
|             ResultSet rs = stmt.executeQuery(); | ||||
| @ -111,7 +111,7 @@ public class HostPodDaoImpl extends GenericDaoBase<HostPodVO, Long> implements H | ||||
| 
 | ||||
|     @Override | ||||
|     public boolean remove(Long id) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         txn.start(); | ||||
|         HostPodVO pod = createForUpdate(); | ||||
|         pod.setName(null); | ||||
|  | ||||
| @ -28,7 +28,7 @@ import com.cloud.utils.db.GenericDao; | ||||
| import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| import com.cloud.utils.exception.CloudRuntimeException; | ||||
| 
 | ||||
| /** | ||||
| @ -49,7 +49,7 @@ public class PodVlanDaoImpl extends GenericDaoBase<PodVlanVO, Long> implements P | ||||
|     public void add(long podId, int start, int end) { | ||||
|         String insertVnet = "INSERT INTO `cloud`.`op_pod_vlan_alloc` (vlan, pod_id) VALUES ( ?, ?)"; | ||||
|          | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         try { | ||||
|             txn.start(); | ||||
|             PreparedStatement stmt = txn.prepareAutoCloseStatement(insertVnet); | ||||
| @ -68,7 +68,7 @@ public class PodVlanDaoImpl extends GenericDaoBase<PodVlanVO, Long> implements P | ||||
|     public void delete(long podId) { | ||||
|     	String deleteVnet = "DELETE FROM `cloud`.`op_pod_vlan_alloc` WHERE pod_id = ?"; | ||||
| 
 | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         try { | ||||
|             PreparedStatement stmt = txn.prepareAutoCloseStatement(deleteVnet); | ||||
|             stmt.setLong(1, podId); | ||||
| @ -82,7 +82,7 @@ public class PodVlanDaoImpl extends GenericDaoBase<PodVlanVO, Long> implements P | ||||
|         SearchCriteria<PodVlanVO> sc = FreeVlanSearch.create(); | ||||
|         sc.setParameters("podId", podId); | ||||
|         Date now = new Date(); | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         try { | ||||
|             txn.start(); | ||||
|             PodVlanVO vo = lockOneRandomRow(sc, true); | ||||
|  | ||||
| @ -30,10 +30,10 @@ import com.cloud.utils.db.GenericSearchBuilder; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.GenericQueryBuilder; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| import com.cloud.utils.db.SearchCriteria.Func; | ||||
| import com.cloud.utils.db.SearchCriteria.Op; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| 
 | ||||
| @Component | ||||
| @Local(value={StorageNetworkIpAddressDao.class}) | ||||
| @ -87,7 +87,7 @@ public class StorageNetworkIpAddressDaoImpl extends GenericDaoBase<StorageNetwor | ||||
|     public StorageNetworkIpAddressVO takeIpAddress(long rangeId) { | ||||
| 		SearchCriteria<StorageNetworkIpAddressVO> sc = untakenIp.create(); | ||||
| 		sc.setParameters("rangeId", rangeId); | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         txn.start(); | ||||
|         StorageNetworkIpAddressVO ip = lockOneRandomRow(sc, true); | ||||
|         if (ip == null) { | ||||
|  | ||||
| @ -28,7 +28,7 @@ import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.JoinBuilder; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| import com.cloud.utils.exception.CloudRuntimeException; | ||||
| import org.springframework.stereotype.Component; | ||||
| 
 | ||||
| @ -301,7 +301,7 @@ public class VlanDaoImpl extends GenericDaoBase<VlanVO, Long> implements VlanDao | ||||
| 
 | ||||
|         StringBuilder sql = new StringBuilder(FindZoneWideVlans); | ||||
| 
 | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         PreparedStatement pstmt = null; | ||||
|         try { | ||||
|             pstmt = txn.prepareAutoCloseStatement(sql.toString()); | ||||
|  | ||||
| @ -35,7 +35,7 @@ import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.GenericSearchBuilder; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| 
 | ||||
| @Component | ||||
| @Local(value={DomainDao.class}) | ||||
| @ -117,7 +117,7 @@ public class DomainDaoImpl extends GenericDaoBase<DomainVO, Long> implements Dom | ||||
|     		return null; | ||||
|     	} | ||||
|     	 | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|     	try { | ||||
|     		txn.start(); | ||||
| 
 | ||||
| @ -168,7 +168,7 @@ public class DomainDaoImpl extends GenericDaoBase<DomainVO, Long> implements Dom | ||||
|         String sql1 = "SELECT * from domain where parent = " + id + " and removed is null"; | ||||
| 
 | ||||
|         boolean success = false; | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         try { | ||||
|         	txn.start(); | ||||
|             DomainVO parentDomain = super.lockRow(domain.getParent(), true); | ||||
|  | ||||
| @ -30,7 +30,7 @@ import com.cloud.utils.db.Filter; | ||||
| import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| import com.cloud.utils.db.SearchCriteria.Op; | ||||
| 
 | ||||
| @Component | ||||
| @ -104,7 +104,7 @@ public class EventDaoImpl extends GenericDaoBase<EventVO, Long> implements Event | ||||
|     @Override | ||||
|     public void archiveEvents(List<EventVO> events) { | ||||
|         if (events != null && !events.isEmpty()) { | ||||
|             Transaction txn = Transaction.currentTxn(); | ||||
|             TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|             txn.start(); | ||||
|             for (EventVO event : events) { | ||||
|                 event = lockRow(event.getId(), true); | ||||
|  | ||||
| @ -36,7 +36,7 @@ import com.cloud.utils.db.Filter; | ||||
| import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| import com.cloud.utils.exception.CloudRuntimeException; | ||||
| 
 | ||||
| @Component | ||||
| @ -90,7 +90,7 @@ public class UsageEventDaoImpl extends GenericDaoBase<UsageEventVO, Long> implem | ||||
|     public synchronized List<UsageEventVO> getRecentEvents(Date endDate) { | ||||
|         long recentEventId = getMostRecentEventId(); | ||||
|         long maxEventId = getMaxEventId(endDate); | ||||
|         Transaction txn = Transaction.open(Transaction.USAGE_DB); | ||||
|         TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.USAGE_DB); | ||||
|         String sql = COPY_EVENTS; | ||||
|         if (recentEventId == 0) { | ||||
|             if (s_logger.isDebugEnabled()) { | ||||
| @ -120,7 +120,7 @@ public class UsageEventDaoImpl extends GenericDaoBase<UsageEventVO, Long> implem | ||||
| 
 | ||||
|     @DB | ||||
|     private long getMostRecentEventId() { | ||||
|         Transaction txn = Transaction.open(Transaction.USAGE_DB); | ||||
|         TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.USAGE_DB); | ||||
|         try { | ||||
|             List<UsageEventVO> latestEvents = getLatestEvent(); | ||||
| 
 | ||||
| @ -140,7 +140,7 @@ public class UsageEventDaoImpl extends GenericDaoBase<UsageEventVO, Long> implem | ||||
|     } | ||||
| 
 | ||||
|     private List<UsageEventVO> findRecentEvents(Date endDate) { | ||||
|         Transaction txn = Transaction.open(Transaction.USAGE_DB); | ||||
|         TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.USAGE_DB); | ||||
|         try { | ||||
|             return listLatestEvents(endDate); | ||||
|         } catch (Exception ex) { | ||||
| @ -152,7 +152,7 @@ public class UsageEventDaoImpl extends GenericDaoBase<UsageEventVO, Long> implem | ||||
|     } | ||||
| 
 | ||||
|     private long getMaxEventId(Date endDate) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         PreparedStatement pstmt = null; | ||||
|         try { | ||||
|             String sql = MAX_EVENT; | ||||
|  | ||||
| @ -59,7 +59,7 @@ import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.SearchCriteria.Func; | ||||
| import com.cloud.utils.db.SearchCriteria.Op; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| import com.cloud.utils.db.UpdateBuilder; | ||||
| import com.cloud.utils.exception.CloudRuntimeException; | ||||
| 
 | ||||
| @ -490,7 +490,7 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao | ||||
|     @Override | ||||
|     @DB | ||||
|     public List<HostVO> findAndUpdateDirectAgentToLoad(long lastPingSecondsAfter, Long limit, long managementServerId) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
| 
 | ||||
|         txn.start(); | ||||
|         if (s_logger.isDebugEnabled()) { | ||||
| @ -589,7 +589,7 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao | ||||
|     @Override | ||||
|     @DB | ||||
|     public List<HostVO> findAndUpdateApplianceToLoad(long lastPingSecondsAfter, long managementServerId) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
| 
 | ||||
|         txn.start(); | ||||
|         SearchCriteria<HostVO> sc = UnmanagedApplianceSearch.create(); | ||||
| @ -728,7 +728,7 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao | ||||
|     @DB | ||||
|     @Override | ||||
|     public List<HostVO> findLostHosts(long timeout) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         PreparedStatement pstmt = null; | ||||
|         List<HostVO> result = new ArrayList<HostVO>(); | ||||
|         ResultSet rs = null; | ||||
| @ -779,7 +779,7 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao | ||||
|     public HostVO persist(HostVO host) { | ||||
|         final String InsertSequenceSql = "INSERT INTO op_host(id) VALUES(?)"; | ||||
| 
 | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         txn.start(); | ||||
| 
 | ||||
|         HostVO dbHost = super.persist(host); | ||||
| @ -805,7 +805,7 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao | ||||
|     @Override | ||||
|     @DB | ||||
|     public boolean update(Long hostId, HostVO host) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         txn.start(); | ||||
| 
 | ||||
|         boolean persisted = super.update(hostId, host); | ||||
| @ -831,7 +831,7 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao | ||||
| 
 | ||||
|         ArrayList<RunningHostCountInfo> l = new ArrayList<RunningHostCountInfo>(); | ||||
| 
 | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         ; | ||||
|         PreparedStatement pstmt = null; | ||||
|         try { | ||||
|  | ||||
| @ -31,7 +31,7 @@ import com.cloud.utils.crypt.DBEncryptionUtil; | ||||
| import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| import com.cloud.utils.exception.CloudRuntimeException; | ||||
| 
 | ||||
| @Component | ||||
| @ -96,7 +96,7 @@ public class HostDetailsDaoImpl extends GenericDaoBase<DetailVO, Long> implement | ||||
|     public void persist(long hostId, Map<String, String> details) { | ||||
|         final String InsertOrUpdateSql = "INSERT INTO `cloud`.`host_details` (host_id, name, value) VALUES (?,?,?) ON DUPLICATE KEY UPDATE value=?"; | ||||
| 
 | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         txn.start(); | ||||
| 
 | ||||
|         for (Map.Entry<String, String> detail : details.entrySet()) { | ||||
|  | ||||
| @ -27,7 +27,7 @@ import com.cloud.host.HostTagVO; | ||||
| import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| 
 | ||||
| @Component | ||||
| @Local(value=HostTagsDao.class) | ||||
| @ -56,7 +56,7 @@ public class HostTagsDaoImpl extends GenericDaoBase<HostTagVO, Long> implements | ||||
|      | ||||
|     @Override | ||||
|     public void persist(long hostId, List<String> hostTags) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
| 
 | ||||
|         txn.start(); | ||||
|         SearchCriteria<HostTagVO> sc = HostSearch.create(); | ||||
|  | ||||
| @ -30,7 +30,7 @@ import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.SearchCriteria.Op; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| import com.cloud.utils.exception.CloudRuntimeException; | ||||
| 
 | ||||
| @Component | ||||
| @ -74,7 +74,7 @@ public class KeystoreDaoImpl extends GenericDaoBase<KeystoreVO, Long> implements | ||||
| 	@Override | ||||
| 	@DB | ||||
| 	public void save(String name, String certificate, String key, String domainSuffix) { | ||||
| 		Transaction txn = Transaction.currentTxn(); | ||||
| 		TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
| 		try { | ||||
| 			txn.start(); | ||||
| 			 | ||||
|  | ||||
| @ -28,7 +28,7 @@ import com.cloud.utils.db.DB; | ||||
| import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| 
 | ||||
| @Component | ||||
| @Local(value=FirewallRulesCidrsDao.class) | ||||
| @ -58,7 +58,7 @@ public class FirewallRulesCidrsDaoImpl extends GenericDaoBase<FirewallRulesCidrs | ||||
|      | ||||
|     @Override @DB | ||||
|     public void persist(long firewallRuleId, List<String> sourceCidrs) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
| 
 | ||||
|         txn.start(); | ||||
|         for (String tag : sourceCidrs) { | ||||
|  | ||||
| @ -39,7 +39,7 @@ import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.SearchCriteria.Func; | ||||
| import com.cloud.utils.db.SearchCriteria.Op; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| 
 | ||||
| @Component | ||||
| @Local(value = FirewallRulesDao.class) | ||||
| @ -220,7 +220,7 @@ public class FirewallRulesDaoImpl extends GenericDaoBase<FirewallRuleVO, Long> i | ||||
|     @Override | ||||
|     @DB | ||||
|     public FirewallRuleVO persist(FirewallRuleVO firewallRule) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         txn.start(); | ||||
| 
 | ||||
|         FirewallRuleVO dbfirewallRule = super.persist(firewallRule); | ||||
| @ -309,7 +309,7 @@ public class FirewallRulesDaoImpl extends GenericDaoBase<FirewallRuleVO, Long> i | ||||
|     @Override | ||||
|     @DB | ||||
|     public boolean remove(Long id) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         txn.start(); | ||||
|         FirewallRuleVO entry = findById(id); | ||||
|         if (entry != null) { | ||||
|  | ||||
| @ -31,7 +31,7 @@ import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.SearchCriteria.Func; | ||||
| import com.cloud.utils.db.SearchCriteria.Op; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| import com.cloud.utils.net.Ip; | ||||
| import org.apache.log4j.Logger; | ||||
| import org.springframework.stereotype.Component; | ||||
| @ -285,7 +285,7 @@ public class IPAddressDaoImpl extends GenericDaoBase<IPAddressVO, Long> implemen | ||||
|     @Override | ||||
|     @DB | ||||
|     public int countIPs(long dcId, Long accountId, String vlanId, String vlanGateway, String vlanNetmask) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         int ipCount = 0; | ||||
|         try { | ||||
|             String sql = "SELECT count(*) FROM user_ip_address u INNER JOIN vlan v on (u.vlan_db_id = v.id AND v.data_center_id = ? AND v.vlan_id = ? AND v.vlan_gateway = ? AND v.vlan_netmask = ? AND u.account_id = ?)"; | ||||
| @ -390,7 +390,7 @@ public class IPAddressDaoImpl extends GenericDaoBase<IPAddressVO, Long> implemen | ||||
|     @Override | ||||
|     @DB | ||||
|     public boolean remove(Long id) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         txn.start(); | ||||
|         IPAddressVO entry = findById(id); | ||||
|         if (entry != null) { | ||||
|  | ||||
| @ -289,7 +289,7 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N | ||||
|     @Override | ||||
|     @DB | ||||
|     public NetworkVO persist(NetworkVO network, boolean gc, Map<String, String> serviceProviderMap) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         txn.start(); | ||||
| 
 | ||||
|         // 1) create network | ||||
| @ -309,7 +309,7 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N | ||||
|     @Override | ||||
|     @DB | ||||
|     public boolean update(Long networkId, NetworkVO network, Map<String, String> serviceProviderMap) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         txn.start(); | ||||
| 
 | ||||
|         super.update(networkId, network); | ||||
| @ -325,7 +325,7 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N | ||||
|     @Override | ||||
|     @DB | ||||
|     public void persistNetworkServiceProviders(long networkId, Map<String, String> serviceProviderMap) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         txn.start(); | ||||
|         for (String service : serviceProviderMap.keySet()) { | ||||
|             NetworkServiceMapVO serviceMap = new NetworkServiceMapVO(networkId, Service.getService(service), Provider.getProvider(serviceProviderMap.get(service))); | ||||
| @ -576,7 +576,7 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N | ||||
|     @Override | ||||
|     @DB | ||||
|     public boolean remove(Long id) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         txn.start(); | ||||
|         NetworkVO entry = findById(id); | ||||
|         if (entry != null) { | ||||
| @ -599,7 +599,7 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N | ||||
|     @Override | ||||
|     public boolean updateState(State currentState, Event event, State nextState, Network vo, Object data) { | ||||
|        // TODO: ensure this update is correct | ||||
|        Transaction txn = Transaction.currentTxn(); | ||||
|        TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|        txn.start(); | ||||
| 
 | ||||
|        NetworkVO networkVo = (NetworkVO) vo; | ||||
|  | ||||
| @ -29,7 +29,7 @@ import com.cloud.utils.db.DB; | ||||
| import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| import com.cloud.utils.db.SearchCriteria.Op; | ||||
| import com.cloud.utils.exception.CloudRuntimeException; | ||||
| 
 | ||||
| @ -66,7 +66,7 @@ public class PortProfileDaoImpl extends GenericDaoBase<PortProfileVO, Long> impl | ||||
|     	String condition = "(trunk_low_vlan_id BETWEEN " + lowVlanId + " AND " + highVlanId + ")" + " OR (trunk_high_vlan_id BETWEEN " + lowVlanId + " AND " + highVlanId + ")"; | ||||
|     	String selectSql = "SELECT * FROM `" + dbName + "`.`" + tableName + "` WHERE " + condition; | ||||
| 
 | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         try { | ||||
|             PreparedStatement stmt = txn.prepareAutoCloseStatement(selectSql); | ||||
|             ResultSet rs = stmt.executeQuery(); | ||||
|  | ||||
| @ -32,7 +32,7 @@ import com.cloud.utils.db.DB; | ||||
| import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| 
 | ||||
| @Component | ||||
| @Local(value={SecurityGroupDao.class}) | ||||
| @ -109,7 +109,7 @@ public class SecurityGroupDaoImpl extends GenericDaoBase<SecurityGroupVO, Long> | ||||
| 	@Override | ||||
|     @DB | ||||
|     public boolean remove(Long id) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         txn.start(); | ||||
|         SecurityGroupVO entry = findById(id); | ||||
|         if (entry != null) { | ||||
| @ -123,7 +123,7 @@ public class SecurityGroupDaoImpl extends GenericDaoBase<SecurityGroupVO, Long> | ||||
| 	@Override | ||||
|     @DB | ||||
|     public boolean expunge(Long id) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         txn.start(); | ||||
|         SecurityGroupVO entry = findById(id); | ||||
|         if (entry != null) { | ||||
|  | ||||
| @ -33,7 +33,7 @@ import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.SearchCriteria.Op; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| import com.cloud.utils.exception.CloudRuntimeException; | ||||
| 
 | ||||
| @Component | ||||
| @ -100,7 +100,7 @@ public class SecurityGroupWorkDaoImpl extends GenericDaoBase<SecurityGroupWorkVO | ||||
| 	@Override | ||||
| 	@DB | ||||
| 	public SecurityGroupWorkVO take(long serverId) { | ||||
| 		final Transaction txn = Transaction.currentTxn(); | ||||
| 		final TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         try { | ||||
|             final SearchCriteria<SecurityGroupWorkVO> sc = UntakenWorkSearch.create(); | ||||
|             sc.setParameters("step", Step.Scheduled); | ||||
| @ -149,7 +149,7 @@ public class SecurityGroupWorkDaoImpl extends GenericDaoBase<SecurityGroupWorkVO | ||||
| 	@Override | ||||
| 	@DB | ||||
| 	public void updateStep(Long vmId, Long logSequenceNumber, Step step) { | ||||
| 		final Transaction txn = Transaction.currentTxn(); | ||||
| 		final TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
| 		txn.start(); | ||||
|         SearchCriteria<SecurityGroupWorkVO> sc = VmIdSeqNumSearch.create(); | ||||
|         sc.setParameters("vmId", vmId); | ||||
| @ -180,7 +180,7 @@ public class SecurityGroupWorkDaoImpl extends GenericDaoBase<SecurityGroupWorkVO | ||||
| 	@Override | ||||
| 	@DB | ||||
| 	public void updateStep(Long workId, Step step) { | ||||
| 		final Transaction txn = Transaction.currentTxn(); | ||||
| 		final TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
| 		txn.start(); | ||||
| 
 | ||||
|         SecurityGroupWorkVO work = lockRow(workId, true); | ||||
|  | ||||
| @ -34,7 +34,7 @@ import com.cloud.network.security.VmRulesetLogVO; | ||||
| import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| 
 | ||||
| @Component | ||||
| @Local(value={VmRulesetLogDao.class}) | ||||
| @ -85,7 +85,7 @@ public class VmRulesetLogDaoImpl extends GenericDaoBase<VmRulesetLogVO, Long> im | ||||
|         return createOrUpdateUsingMultiInsert(workItems); | ||||
|     } | ||||
|      | ||||
|     private int executeWithRetryOnDeadlock(Transaction txn, String pstmt,  List<Long> vmIds) throws SQLException { | ||||
|     private int executeWithRetryOnDeadlock(TransactionLegacy txn, String pstmt,  List<Long> vmIds) throws SQLException { | ||||
| 
 | ||||
|         int numUpdated = 0; | ||||
|         final int maxTries = 3; | ||||
| @ -120,7 +120,7 @@ public class VmRulesetLogDaoImpl extends GenericDaoBase<VmRulesetLogVO, Long> im | ||||
|     } | ||||
|      | ||||
|     protected int createOrUpdateUsingMultiInsert(Set<Long> workItems) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
| 
 | ||||
|         int size = workItems.size(); | ||||
|         int count = 0; | ||||
| @ -156,7 +156,7 @@ public class VmRulesetLogDaoImpl extends GenericDaoBase<VmRulesetLogVO, Long> im | ||||
|     } | ||||
|      | ||||
|     protected int createOrUpdateUsingBatch(Set<Long> workItems) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         PreparedStatement stmtInsert = null; | ||||
|         int [] queryResult = null; | ||||
|         int count=0; | ||||
|  | ||||
| @ -32,7 +32,7 @@ import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.SearchCriteria.Func; | ||||
| import com.cloud.utils.db.SearchCriteria.Op; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| 
 | ||||
| @Component | ||||
| @Local(value = PrivateIpDao.class) | ||||
| @ -78,7 +78,7 @@ public class PrivateIpDaoImpl extends GenericDaoBase<PrivateIpVO, Long> implemen | ||||
|             sc.setParameters("ipAddress", requestedIp); | ||||
|         } | ||||
|          | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         txn.start(); | ||||
|         PrivateIpVO  vo = lockOneRandomRow(sc, true); | ||||
|         if (vo == null) { | ||||
|  | ||||
| @ -36,7 +36,7 @@ import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.SearchCriteria.Func; | ||||
| import com.cloud.utils.db.SearchCriteria.Op; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| 
 | ||||
| @Component | ||||
| @Local(value = StaticRouteDao.class) | ||||
| @ -106,7 +106,7 @@ public class StaticRouteDaoImpl extends GenericDaoBase<StaticRouteVO, Long> impl | ||||
|     @Override | ||||
|     @DB | ||||
|     public boolean remove(Long id) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         txn.start(); | ||||
|         StaticRouteVO entry = findById(id); | ||||
|         if (entry != null) { | ||||
|  | ||||
| @ -38,7 +38,7 @@ import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.SearchCriteria.Func; | ||||
| import com.cloud.utils.db.SearchCriteria.Op; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| 
 | ||||
| @Component | ||||
| @Local(value = VpcDao.class) | ||||
| @ -107,7 +107,7 @@ public class VpcDaoImpl extends GenericDaoBase<VpcVO, Long> implements VpcDao{ | ||||
|     @Override | ||||
|     @DB | ||||
|     public boolean remove(Long id) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         txn.start(); | ||||
|         VpcVO entry = findById(id); | ||||
|         if (entry != null) { | ||||
| @ -129,7 +129,7 @@ public class VpcDaoImpl extends GenericDaoBase<VpcVO, Long> implements VpcDao{ | ||||
|     @Override | ||||
|     @DB | ||||
|     public VpcVO persist(VpcVO vpc, Map<String, List<String>> serviceProviderMap) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         txn.start(); | ||||
|         VpcVO newVpc = super.persist(vpc); | ||||
|         persistVpcServiceProviders(vpc.getId(), serviceProviderMap); | ||||
| @ -140,7 +140,7 @@ public class VpcDaoImpl extends GenericDaoBase<VpcVO, Long> implements VpcDao{ | ||||
|     @Override | ||||
|     @DB | ||||
|     public void persistVpcServiceProviders(long vpcId, Map<String, List<String>> serviceProviderMap) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         txn.start(); | ||||
|         for (String service : serviceProviderMap.keySet()) { | ||||
|             for (String provider : serviceProviderMap.get(service)) { | ||||
|  | ||||
| @ -26,7 +26,7 @@ import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.SearchCriteria.Op; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| 
 | ||||
| @Component | ||||
| @Local(value = VpcOfferingDao.class) | ||||
| @ -51,7 +51,7 @@ public class VpcOfferingDaoImpl extends GenericDaoBase<VpcOfferingVO, Long> impl | ||||
|     @Override | ||||
|     @DB | ||||
|     public boolean remove(Long vpcOffId) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         txn.start(); | ||||
|         VpcOfferingVO offering = findById(vpcOffId); | ||||
|         offering.setUniqueName(null); | ||||
|  | ||||
| @ -38,7 +38,7 @@ import com.cloud.utils.db.GenericSearchBuilder; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.SearchCriteria.Op; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| 
 | ||||
| @Component | ||||
| @Local(value = NetworkOfferingDao.class) | ||||
| @ -129,7 +129,7 @@ public class NetworkOfferingDaoImpl extends GenericDaoBase<NetworkOfferingVO, Lo | ||||
|     @Override | ||||
|     @DB | ||||
|     public boolean remove(Long networkOfferingId) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         txn.start(); | ||||
|         NetworkOfferingVO offering = findById(networkOfferingId); | ||||
|         offering.setUniqueName(null); | ||||
| @ -174,7 +174,7 @@ public class NetworkOfferingDaoImpl extends GenericDaoBase<NetworkOfferingVO, Lo | ||||
|     @Override | ||||
|     @DB | ||||
|     public NetworkOfferingVO persist(NetworkOfferingVO off, Map<Detail, String> details) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         txn.start(); | ||||
|         //1) persist the offering | ||||
|         NetworkOfferingVO vo = super.persist(off); | ||||
|  | ||||
| @ -36,7 +36,7 @@ import com.cloud.utils.db.GenericSearchBuilder; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.SearchCriteria.Func; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| 
 | ||||
| @Component | ||||
| @Local(value = { ProjectDao.class }) | ||||
| @ -75,7 +75,7 @@ public class ProjectDaoImpl extends GenericDaoBase<ProjectVO, Long> implements P | ||||
|     @DB | ||||
|     public boolean remove(Long projectId) { | ||||
|         boolean result = false; | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         txn.start(); | ||||
|         ProjectVO projectToRemove = findById(projectId); | ||||
|         projectToRemove.setName(null); | ||||
|  | ||||
| @ -28,7 +28,7 @@ import com.cloud.service.ServiceOfferingDetailsVO; | ||||
| import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| 
 | ||||
| @Component | ||||
| @Local(value=ServiceOfferingDetailsDao.class) | ||||
| @ -82,7 +82,7 @@ public class ServiceOfferingDetailsDaoImpl extends GenericDaoBase<ServiceOfferin | ||||
| 
 | ||||
|     @Override | ||||
|     public void persist(long serviceOfferingId, Map<String, String> details) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         txn.start(); | ||||
|         SearchCriteria<ServiceOfferingDetailsVO> sc = ServiceOfferingSearch.create(); | ||||
|         sc.setParameters("serviceOfferingId", serviceOfferingId); | ||||
|  | ||||
| @ -35,7 +35,7 @@ import com.cloud.utils.DateUtil; | ||||
| import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| import com.cloud.utils.exception.CloudRuntimeException; | ||||
| 
 | ||||
| @Component | ||||
| @ -69,7 +69,7 @@ public class LaunchPermissionDaoImpl extends GenericDaoBase<LaunchPermissionVO, | ||||
| 
 | ||||
|     @Override | ||||
|     public void removePermissions(long templateId, List<Long> accountIds) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         PreparedStatement pstmt = null; | ||||
|         try { | ||||
|             txn.start(); | ||||
| @ -106,7 +106,7 @@ public class LaunchPermissionDaoImpl extends GenericDaoBase<LaunchPermissionVO, | ||||
| 
 | ||||
|     @Override | ||||
|     public List<VMTemplateVO> listPermittedTemplates(long accountId) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         List<VMTemplateVO> permittedTemplates = new ArrayList<VMTemplateVO>(); | ||||
|         PreparedStatement pstmt = null; | ||||
|         try { | ||||
|  | ||||
| @ -47,7 +47,7 @@ import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.SearchCriteria.Func; | ||||
| import com.cloud.utils.db.SearchCriteria.Op; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| import com.cloud.vm.VMInstanceVO; | ||||
| import com.cloud.vm.dao.VMInstanceDao; | ||||
| 
 | ||||
| @ -204,7 +204,7 @@ public class SnapshotDaoImpl extends GenericDaoBase<SnapshotVO, Long> implements | ||||
|     @Override | ||||
|     public Long getSecHostId(long volumeId) { | ||||
| 
 | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         PreparedStatement pstmt = null; | ||||
|         String sql = GET_SECHOST_ID; | ||||
|         try { | ||||
| @ -221,7 +221,7 @@ public class SnapshotDaoImpl extends GenericDaoBase<SnapshotVO, Long> implements | ||||
| 
 | ||||
|     @Override | ||||
|     public long getLastSnapshot(long volumeId, DataStoreRole role) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         PreparedStatement pstmt = null; | ||||
|         String sql = GET_LAST_SNAPSHOT; | ||||
|         try { | ||||
| @ -240,7 +240,7 @@ public class SnapshotDaoImpl extends GenericDaoBase<SnapshotVO, Long> implements | ||||
| 
 | ||||
|     @Override | ||||
|     public long updateSnapshotVersion(long volumeId, String from, String to) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         PreparedStatement pstmt = null; | ||||
|         String sql = UPDATE_SNAPSHOT_VERSION; | ||||
|         try { | ||||
| @ -258,7 +258,7 @@ public class SnapshotDaoImpl extends GenericDaoBase<SnapshotVO, Long> implements | ||||
| 
 | ||||
|     @Override | ||||
|     public long updateSnapshotSecHost(long dcId, long secHostId) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         PreparedStatement pstmt = null; | ||||
|         String sql = UPDATE_SECHOST_ID; | ||||
|         try { | ||||
| @ -304,7 +304,7 @@ public class SnapshotDaoImpl extends GenericDaoBase<SnapshotVO, Long> implements | ||||
|     @Override | ||||
|     @DB | ||||
|     public boolean remove(Long id) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         txn.start(); | ||||
|         SnapshotVO entry = findById(id); | ||||
|         if (entry != null) { | ||||
| @ -324,7 +324,7 @@ public class SnapshotDaoImpl extends GenericDaoBase<SnapshotVO, Long> implements | ||||
| 
 | ||||
|     @Override | ||||
|     public boolean updateState(State currentState, Event event, State nextState, SnapshotVO snapshot, Object data) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         txn.start(); | ||||
|         SnapshotVO snapshotVO = (SnapshotVO) snapshot; | ||||
|         snapshotVO.setState(nextState); | ||||
|  | ||||
| @ -31,7 +31,7 @@ import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailsDao; | ||||
| import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| 
 | ||||
| @Local(value = StoragePoolDetailsDao.class) | ||||
| public class StoragePoolDetailsDaoImpl extends GenericDaoBase<StoragePoolDetailVO, Long> implements StoragePoolDetailsDao, ScopedConfigStorage { | ||||
| @ -48,7 +48,7 @@ public class StoragePoolDetailsDaoImpl extends GenericDaoBase<StoragePoolDetailV | ||||
| 
 | ||||
|     @Override | ||||
|     public void update(long poolId, Map<String, String> details) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         SearchCriteria<StoragePoolDetailVO> sc = PoolSearch.create(); | ||||
|         sc.setParameters("pool", poolId); | ||||
| 
 | ||||
|  | ||||
| @ -33,7 +33,7 @@ import com.cloud.utils.Pair; | ||||
| import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| 
 | ||||
| @Component | ||||
| @Local(value = { StoragePoolHostDao.class }) | ||||
| @ -104,7 +104,7 @@ public class StoragePoolHostDaoImpl extends GenericDaoBase<StoragePoolHostVO, Lo | ||||
| 
 | ||||
|     @Override | ||||
|     public List<StoragePoolHostVO> listByHostStatus(long poolId, Status hostStatus) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         PreparedStatement pstmt = null; | ||||
|         List<StoragePoolHostVO> result = new ArrayList<StoragePoolHostVO>(); | ||||
|         ResultSet rs = null; | ||||
| @ -142,7 +142,7 @@ public class StoragePoolHostDaoImpl extends GenericDaoBase<StoragePoolHostVO, Lo | ||||
|     public List<Pair<Long, Integer>> getDatacenterStoragePoolHostInfo(long dcId, boolean sharedOnly) { | ||||
|         ArrayList<Pair<Long, Integer>> l = new ArrayList<Pair<Long, Integer>>(); | ||||
|         String sql = sharedOnly ? SHARED_STORAGE_POOL_HOST_INFO : STORAGE_POOL_HOST_INFO; | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         ; | ||||
|         PreparedStatement pstmt = null; | ||||
|         try { | ||||
| @ -169,7 +169,7 @@ public class StoragePoolHostDaoImpl extends GenericDaoBase<StoragePoolHostVO, Lo | ||||
|     public void deletePrimaryRecordsForHost(long hostId) { | ||||
|         SearchCriteria<StoragePoolHostVO> sc = HostSearch.create(); | ||||
|         sc.setParameters("host_id", hostId); | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         txn.start(); | ||||
|         remove(sc); | ||||
|         txn.commit(); | ||||
| @ -180,7 +180,7 @@ public class StoragePoolHostDaoImpl extends GenericDaoBase<StoragePoolHostVO, Lo | ||||
|         SearchCriteria<StoragePoolHostVO> sc = PoolHostSearch.create(); | ||||
|         sc.setParameters("host_id", hostId); | ||||
|         sc.setParameters("pool_id", poolId); | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         txn.start(); | ||||
|         remove(sc); | ||||
|         txn.commit(); | ||||
|  | ||||
| @ -31,7 +31,7 @@ import com.cloud.utils.db.DB; | ||||
| import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| import com.cloud.utils.exception.CloudRuntimeException; | ||||
| 
 | ||||
| @Component | ||||
| @ -125,7 +125,7 @@ public class StoragePoolWorkDaoImpl extends GenericDaoBase<StoragePoolWorkVO, Lo | ||||
| 
 | ||||
|         StringBuilder sql = new StringBuilder(FindPoolIds); | ||||
| 
 | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         PreparedStatement pstmt = null; | ||||
|         try { | ||||
|             pstmt = txn.prepareAutoCloseStatement(sql.toString()); | ||||
|  | ||||
| @ -57,7 +57,7 @@ import com.cloud.utils.db.JoinBuilder; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.SearchCriteria.Func; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| import com.cloud.utils.exception.CloudRuntimeException; | ||||
| 
 | ||||
| @Component | ||||
| @ -220,7 +220,7 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem | ||||
| 
 | ||||
|         List<Long> l = new ArrayList<Long>(); | ||||
| 
 | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
| 
 | ||||
|         PreparedStatement pstmt = null; | ||||
|         try { | ||||
| @ -438,7 +438,7 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem | ||||
|      * permittedAccountsStr = permittedAccountsStr.substring(0, | ||||
|      * permittedAccountsStr.length() - 1); } | ||||
|      * | ||||
|      * Transaction txn = Transaction.currentTxn(); txn.start(); | ||||
|      * TransactionLegacy txn = TransactionLegacy.currentTxn(); txn.start(); | ||||
|      * | ||||
|      * Set<Pair<Long, Long>> templateZonePairList = new HashSet<Pair<Long, | ||||
|      * Long>>(); PreparedStatement pstmt = null; ResultSet rs = null; String sql | ||||
| @ -522,7 +522,7 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem | ||||
|      * permittedAccountsStr = permittedAccountsStr.substring(0, | ||||
|      * permittedAccountsStr.length()-1); } | ||||
|      * | ||||
|      * Transaction txn = Transaction.currentTxn(); txn.start(); | ||||
|      * TransactionLegacy txn = TransactionLegacy.currentTxn(); txn.start(); | ||||
|      * | ||||
|      * // Use LinkedHashSet here to guarantee iteration order Set<Pair<Long, | ||||
|      * Long>> templateZonePairList = new LinkedHashSet<Pair<Long, Long>>(); | ||||
| @ -737,7 +737,7 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem | ||||
|     @Override | ||||
|     @DB | ||||
|     public long addTemplateToZone(VMTemplateVO tmplt, long zoneId) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         txn.start(); | ||||
|         VMTemplateVO tmplt2 = findById(tmplt.getId()); | ||||
|         if (tmplt2 == null) { | ||||
| @ -872,7 +872,7 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem | ||||
|     @Override | ||||
|     @DB | ||||
|     public boolean remove(Long id) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         txn.start(); | ||||
|         VMTemplateVO template = createForUpdate(); | ||||
|         template.setRemoved(new Date()); | ||||
| @ -907,7 +907,7 @@ public class VMTemplateDaoImpl extends GenericDaoBase<VMTemplateVO, Long> implem | ||||
|      * | ||||
|      * final String permittedAccountsStr = join(",", permittedAccounts); | ||||
|      * | ||||
|      * final Transaction txn = Transaction.currentTxn(); txn.start(); | ||||
|      * final TransactionLegacy txn = TransactionLegacy.currentTxn(); txn.start(); | ||||
|      * | ||||
|      * Set<Pair<Long, Long>> templateZonePairList = new HashSet<Pair<Long, | ||||
|      * Long>>(); PreparedStatement pstmt = null; ResultSet rs = null; try { | ||||
|  | ||||
| @ -28,7 +28,7 @@ import com.cloud.storage.VMTemplateDetailVO; | ||||
| import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| 
 | ||||
| @Component | ||||
| @Local(value = VMTemplateDetailsDao.class) | ||||
| @ -84,7 +84,7 @@ public class VMTemplateDetailsDaoImpl extends GenericDaoBase<VMTemplateDetailVO, | ||||
| 
 | ||||
|     @Override | ||||
|     public void persist(long templateId, Map<String, String> details) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         txn.start(); | ||||
|         SearchCriteria<VMTemplateDetailVO> sc = TemplateSearch.create(); | ||||
|         sc.setParameters("templateId", templateId); | ||||
|  | ||||
| @ -46,7 +46,7 @@ import com.cloud.utils.db.JoinBuilder; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.SearchCriteria.Op; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| import com.cloud.utils.db.UpdateBuilder; | ||||
| 
 | ||||
| @Component | ||||
| @ -163,7 +163,7 @@ public class VMTemplateHostDaoImpl extends GenericDaoBase<VMTemplateHostVO, Long | ||||
| 
 | ||||
|     @Override | ||||
|     public void update(VMTemplateHostVO instance) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         PreparedStatement pstmt = null; | ||||
|         try { | ||||
|             Date now = new Date(); | ||||
| @ -235,7 +235,7 @@ public class VMTemplateHostDaoImpl extends GenericDaoBase<VMTemplateHostVO, Long | ||||
|     @Override | ||||
|     public List<VMTemplateHostVO> listByTemplateStatus(long templateId, long datacenterId, | ||||
|             VMTemplateHostVO.Status downloadState) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         PreparedStatement pstmt = null; | ||||
|         List<VMTemplateHostVO> result = new ArrayList<VMTemplateHostVO>(); | ||||
|         try { | ||||
| @ -267,7 +267,7 @@ public class VMTemplateHostDaoImpl extends GenericDaoBase<VMTemplateHostVO, Long | ||||
|     @Override | ||||
|     public List<VMTemplateHostVO> listByTemplateStatus(long templateId, long datacenterId, long podId, | ||||
|             VMTemplateHostVO.Status downloadState) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         PreparedStatement pstmt = null; | ||||
|         List<VMTemplateHostVO> result = new ArrayList<VMTemplateHostVO>(); | ||||
|         ResultSet rs = null; | ||||
|  | ||||
| @ -38,7 +38,7 @@ import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.SearchCriteria.Op; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| import com.cloud.utils.db.UpdateBuilder; | ||||
| 
 | ||||
| @Component | ||||
| @ -150,7 +150,7 @@ public class VMTemplatePoolDaoImpl extends GenericDaoBase<VMTemplateStoragePoolV | ||||
|     @Override | ||||
|     public List<VMTemplateStoragePoolVO> listByTemplateStatus(long templateId, long datacenterId, | ||||
|             VMTemplateStoragePoolVO.Status downloadState) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         PreparedStatement pstmt = null; | ||||
|         List<VMTemplateStoragePoolVO> result = new ArrayList<VMTemplateStoragePoolVO>(); | ||||
|         try { | ||||
| @ -173,7 +173,7 @@ public class VMTemplatePoolDaoImpl extends GenericDaoBase<VMTemplateStoragePoolV | ||||
|     @Override | ||||
|     public List<VMTemplateStoragePoolVO> listByTemplateStatus(long templateId, long datacenterId, long podId, | ||||
|             VMTemplateStoragePoolVO.Status downloadState) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         PreparedStatement pstmt = null; | ||||
|         List<VMTemplateStoragePoolVO> result = new ArrayList<VMTemplateStoragePoolVO>(); | ||||
|         ResultSet rs = null; | ||||
| @ -210,7 +210,7 @@ public class VMTemplatePoolDaoImpl extends GenericDaoBase<VMTemplateStoragePoolV | ||||
|     } | ||||
| 
 | ||||
|     public List<VMTemplateStoragePoolVO> listByHostTemplate(long hostId, long templateId) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         PreparedStatement pstmt = null; | ||||
|         List<VMTemplateStoragePoolVO> result = new ArrayList<VMTemplateStoragePoolVO>(); | ||||
|         ResultSet rs = null; | ||||
|  | ||||
| @ -27,7 +27,7 @@ import com.cloud.storage.VMTemplateZoneVO; | ||||
| import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| 
 | ||||
| @Component | ||||
| @Local(value = { VMTemplateZoneDao.class }) | ||||
| @ -89,7 +89,7 @@ public class VMTemplateZoneDaoImpl extends GenericDaoBase<VMTemplateZoneVO, Long | ||||
|     public void deletePrimaryRecordsForTemplate(long templateId) { | ||||
|         SearchCriteria<VMTemplateZoneVO> sc = TemplateSearch.create(); | ||||
|         sc.setParameters("template_id", templateId); | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         txn.start(); | ||||
|         remove(sc); | ||||
|         txn.commit(); | ||||
|  | ||||
| @ -48,7 +48,7 @@ import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.SearchCriteria.Func; | ||||
| import com.cloud.utils.db.SearchCriteria.Op; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| import com.cloud.utils.db.UpdateBuilder; | ||||
| import com.cloud.utils.exception.CloudRuntimeException; | ||||
| 
 | ||||
| @ -237,7 +237,7 @@ public class VolumeDaoImpl extends GenericDaoBase<VolumeVO, Long> implements Vol | ||||
|     @DB | ||||
|     public HypervisorType getHypervisorType(long volumeId) { | ||||
|         /* lookup from cluster of pool */ | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         PreparedStatement pstmt = null; | ||||
|         String sql = null; | ||||
|         try { | ||||
| @ -458,7 +458,7 @@ public class VolumeDaoImpl extends GenericDaoBase<VolumeVO, Long> implements Vol | ||||
| 
 | ||||
|     @Override | ||||
|     public List<Long> listPoolIdsByVolumeCount(long dcId, Long podId, Long clusterId, long accountId) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         PreparedStatement pstmt = null; | ||||
|         List<Long> result = new ArrayList<Long>(); | ||||
|         try { | ||||
| @ -484,7 +484,7 @@ public class VolumeDaoImpl extends GenericDaoBase<VolumeVO, Long> implements Vol | ||||
|     @Override | ||||
|     public List<Long> listZoneWidePoolIdsByVolumeCount(long dcId, long accountId) { | ||||
| 
 | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         PreparedStatement pstmt = null; | ||||
|         List<Long> result = new ArrayList<Long>(); | ||||
|         try { | ||||
| @ -519,7 +519,7 @@ public class VolumeDaoImpl extends GenericDaoBase<VolumeVO, Long> implements Vol | ||||
|     @Override | ||||
|     @DB | ||||
|     public boolean remove(Long id) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         txn.start(); | ||||
|         VolumeVO entry = findById(id); | ||||
|         if (entry != null) { | ||||
| @ -533,7 +533,7 @@ public class VolumeDaoImpl extends GenericDaoBase<VolumeVO, Long> implements Vol | ||||
|     @Override | ||||
|     public ScopeType getVolumeStoragePoolScope(long volumeId) { | ||||
|         // finding the storage scope where the volume is present | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         PreparedStatement pstmt = null; | ||||
| 
 | ||||
|         try { | ||||
|  | ||||
| @ -27,7 +27,7 @@ import org.springframework.stereotype.Component; | ||||
| import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| 
 | ||||
| @Component | ||||
| @Local(value=VolumeDetailsDao.class) | ||||
| @ -98,7 +98,7 @@ public class VolumeDetailsDaoImpl extends GenericDaoBase<VolumeDetailVO, Long> i | ||||
| 
 | ||||
|     @Override | ||||
|     public void persist(long volumeId, Map<String, String> details) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         txn.start(); | ||||
|         SearchCriteria<VolumeDetailVO> sc = VolumeSearch.create(); | ||||
|         sc.setParameters("volumeId", volumeId); | ||||
|  | ||||
| @ -30,11 +30,11 @@ import java.util.Properties; | ||||
| import org.springframework.context.support.ClassPathXmlApplicationContext; | ||||
| 
 | ||||
| import com.cloud.utils.PropertiesUtil; | ||||
| 
 | ||||
| import com.cloud.utils.component.ComponentContext; | ||||
| import com.cloud.utils.component.SystemIntegrityChecker; | ||||
| import com.cloud.utils.db.ScriptRunner; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| 
 | ||||
| // Creates the CloudStack Database by using the 4.0 schema and apply | ||||
| // upgrade steps to it. | ||||
| @ -172,7 +172,7 @@ public class DatabaseCreator { | ||||
|         } | ||||
| 
 | ||||
|         try { | ||||
|             Transaction.initDataSource(dbPropsFile); | ||||
|             TransactionLegacy.initDataSource(dbPropsFile); | ||||
|         } catch (NullPointerException e) { | ||||
|         } | ||||
|         initDB(dbPropsFile, rootPassword, databases, dryRun); | ||||
| @ -187,7 +187,7 @@ public class DatabaseCreator { | ||||
|             } | ||||
| 
 | ||||
|             System.out.println("========> Processing SQL file at " + sqlScript.getAbsolutePath()); | ||||
|             Connection conn = Transaction.getStandaloneConnection(); | ||||
|             Connection conn = TransactionLegacy.getStandaloneConnection(); | ||||
|             try { | ||||
|                 FileReader reader = null; | ||||
|                 try { | ||||
| @ -207,7 +207,7 @@ public class DatabaseCreator { | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         Transaction txn = Transaction.open(Transaction.CLOUD_DB); | ||||
|         TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.CLOUD_DB); | ||||
|         try { | ||||
|         // Process db upgrade classes | ||||
|         for (String upgradeClass: upgradeClasses) { | ||||
|  | ||||
| @ -29,12 +29,11 @@ import org.springframework.stereotype.Component; | ||||
| 
 | ||||
| import com.cloud.maint.Version; | ||||
| import com.cloud.upgrade.dao.VersionDao; | ||||
| 
 | ||||
| import com.cloud.utils.component.AdapterBase; | ||||
| import com.cloud.utils.component.ComponentLifecycle; | ||||
| import com.cloud.utils.component.SystemIntegrityChecker; | ||||
| import com.cloud.utils.db.GlobalLock; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| import com.cloud.utils.exception.CloudRuntimeException; | ||||
| 
 | ||||
| @Component | ||||
| @ -72,7 +71,7 @@ public class DatabaseIntegrityChecker extends AdapterBase implements SystemInteg | ||||
| 	} | ||||
| 	 | ||||
| 	private Boolean checkDuplicateHostWithTheSameLocalStorage() { | ||||
| 		Transaction txn = Transaction.open("Integrity"); | ||||
| 	    TransactionLegacy txn = TransactionLegacy.open("Integrity"); | ||||
| 		txn.start(); | ||||
| 		try { | ||||
| 			Connection conn; | ||||
| @ -167,7 +166,7 @@ public class DatabaseIntegrityChecker extends AdapterBase implements SystemInteg | ||||
| 	} | ||||
| 	 | ||||
| 	private boolean checkMissedPremiumUpgradeFor228() { | ||||
| 		Transaction txn = Transaction.open("Integrity"); | ||||
| 	    TransactionLegacy txn = TransactionLegacy.open("Integrity"); | ||||
| 		txn.start(); | ||||
| 		try { | ||||
| 		    String dbVersion = _dao.getCurrentVersion(); | ||||
|  | ||||
| @ -73,7 +73,7 @@ import com.cloud.upgrade.dao.VersionVO.Step; | ||||
| import com.cloud.utils.component.SystemIntegrityChecker; | ||||
| import com.cloud.utils.db.GlobalLock; | ||||
| import com.cloud.utils.db.ScriptRunner; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| import com.cloud.utils.exception.CloudRuntimeException; | ||||
| 
 | ||||
| @Local(value = {SystemIntegrityChecker.class}) | ||||
| @ -269,7 +269,7 @@ public class DatabaseUpgradeChecker implements SystemIntegrityChecker { | ||||
|             s_logger.debug("Running upgrade " + upgrade.getClass().getSimpleName() + " to upgrade from " + upgrade.getUpgradableVersionRange()[0] + "-" | ||||
|                     + upgrade.getUpgradableVersionRange()[1] | ||||
|                     + " to " + upgrade.getUpgradedVersion()); | ||||
|             Transaction txn = Transaction.open("Upgrade"); | ||||
|             TransactionLegacy txn = TransactionLegacy.open("Upgrade"); | ||||
|             txn.start(); | ||||
|             try { | ||||
|                 Connection conn; | ||||
| @ -339,7 +339,7 @@ public class DatabaseUpgradeChecker implements SystemIntegrityChecker { | ||||
|                 VersionVO version = _dao.findByVersion(upgradedVersion, Step.Upgrade); | ||||
|                 s_logger.debug("Upgrading to version " + upgradedVersion + "..."); | ||||
| 
 | ||||
|                 Transaction txn = Transaction.open("Cleanup"); | ||||
|                 TransactionLegacy txn = TransactionLegacy.open("Cleanup"); | ||||
|                 try { | ||||
|                     if (version != null) { | ||||
|                         for (DbUpgrade upgrade : versionUpgrades) { | ||||
|  | ||||
| @ -29,7 +29,6 @@ import com.cloud.utils.PropertiesUtil; | ||||
| import com.cloud.utils.crypt.EncryptionSecretKeyChecker; | ||||
| import org.apache.log4j.Logger; | ||||
| 
 | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.exception.CloudRuntimeException; | ||||
| import com.cloud.utils.script.Script; | ||||
| import org.jasypt.encryption.pbe.StandardPBEStringEncryptor; | ||||
|  | ||||
| @ -35,7 +35,7 @@ import com.cloud.utils.db.GenericSearchBuilder; | ||||
| import com.cloud.utils.db.SearchBuilder; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.SearchCriteria.Op; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| import com.cloud.utils.exception.CloudRuntimeException; | ||||
| 
 | ||||
| @Component | ||||
| @ -79,7 +79,7 @@ public class VersionDaoImpl extends GenericDaoBase<VersionVO, Long> implements V | ||||
|         try { | ||||
|             s_logger.debug("Checking to see if the database is at a version before it was the version table is created"); | ||||
| 
 | ||||
|             conn = Transaction.getStandaloneConnection(); | ||||
|             conn = TransactionLegacy.getStandaloneConnection(); | ||||
| 
 | ||||
|             PreparedStatement pstmt = conn.prepareStatement("SHOW TABLES LIKE 'version'"); | ||||
|             ResultSet rs = pstmt.executeQuery(); | ||||
|  | ||||
| @ -38,7 +38,7 @@ import com.cloud.utils.DateUtil; | ||||
| import com.cloud.utils.db.Filter; | ||||
| import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| import com.cloud.utils.exception.CloudRuntimeException; | ||||
| 
 | ||||
| @Component | ||||
| @ -74,7 +74,7 @@ public class UsageDaoImpl extends GenericDaoBase<UsageVO, Long> implements Usage | ||||
| 	@Override | ||||
|     public void deleteRecordsForAccount(Long accountId) { | ||||
| 	    String sql = ((accountId == null) ? DELETE_ALL : DELETE_ALL_BY_ACCOUNTID); | ||||
|         Transaction txn = Transaction.open(Transaction.USAGE_DB); | ||||
|         TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.USAGE_DB); | ||||
|         PreparedStatement pstmt = null; | ||||
|         try { | ||||
|             txn.start(); | ||||
| @ -99,7 +99,7 @@ public class UsageDaoImpl extends GenericDaoBase<UsageVO, Long> implements Usage | ||||
| 
 | ||||
| 	@Override | ||||
|     public void saveAccounts(List<AccountVO> accounts) { | ||||
| 	    Transaction txn = Transaction.currentTxn(); | ||||
| 	    TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
| 	    try { | ||||
| 	        txn.start(); | ||||
| 	        String sql = INSERT_ACCOUNT; | ||||
| @ -133,7 +133,7 @@ public class UsageDaoImpl extends GenericDaoBase<UsageVO, Long> implements Usage | ||||
| 
 | ||||
|     @Override | ||||
|     public void updateAccounts(List<AccountVO> accounts) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         try { | ||||
|             txn.start(); | ||||
|             String sql = UPDATE_ACCOUNT; | ||||
| @ -163,7 +163,7 @@ public class UsageDaoImpl extends GenericDaoBase<UsageVO, Long> implements Usage | ||||
| 
 | ||||
| 	@Override | ||||
|     public void saveUserStats(List<UserStatisticsVO> userStats) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         try { | ||||
|             txn.start(); | ||||
|             String sql = INSERT_USER_STATS; | ||||
| @ -204,7 +204,7 @@ public class UsageDaoImpl extends GenericDaoBase<UsageVO, Long> implements Usage | ||||
| 
 | ||||
|     @Override | ||||
|     public void updateUserStats(List<UserStatisticsVO> userStats) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         try { | ||||
|             txn.start(); | ||||
|             String sql = UPDATE_USER_STATS; | ||||
| @ -231,7 +231,7 @@ public class UsageDaoImpl extends GenericDaoBase<UsageVO, Long> implements Usage | ||||
| 
 | ||||
| 	@Override | ||||
|     public Long getLastAccountId() { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         PreparedStatement pstmt = null; | ||||
|         String sql = GET_LAST_ACCOUNT; | ||||
|         try { | ||||
| @ -248,7 +248,7 @@ public class UsageDaoImpl extends GenericDaoBase<UsageVO, Long> implements Usage | ||||
| 
 | ||||
|     @Override | ||||
|     public Long getLastUserStatsId() { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         PreparedStatement pstmt = null; | ||||
|         String sql = GET_LAST_USER_STATS; | ||||
|         try { | ||||
| @ -265,7 +265,7 @@ public class UsageDaoImpl extends GenericDaoBase<UsageVO, Long> implements Usage | ||||
| 
 | ||||
|     @Override | ||||
|     public List<Long> listPublicTemplatesByAccount(long accountId) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         PreparedStatement pstmt = null; | ||||
|         String sql = GET_PUBLIC_TEMPLATES_BY_ACCOUNTID; | ||||
|         List<Long> templateList = new ArrayList<Long>(); | ||||
| @ -284,7 +284,7 @@ public class UsageDaoImpl extends GenericDaoBase<UsageVO, Long> implements Usage | ||||
| 
 | ||||
|        @Override | ||||
|        public Long getLastVmDiskStatsId() { | ||||
|                Transaction txn = Transaction.currentTxn(); | ||||
|                TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         PreparedStatement pstmt = null; | ||||
|         String sql = GET_LAST_VM_DISK_STATS; | ||||
|         try { | ||||
| @ -301,7 +301,7 @@ public class UsageDaoImpl extends GenericDaoBase<UsageVO, Long> implements Usage | ||||
| 
 | ||||
|        @Override | ||||
|        public void updateVmDiskStats(List<VmDiskStatisticsVO> vmDiskStats) { | ||||
|                Transaction txn = Transaction.currentTxn(); | ||||
|                TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         try { | ||||
|             txn.start(); | ||||
|             String sql = UPDATE_VM_DISK_STATS; | ||||
| @ -335,7 +335,7 @@ public class UsageDaoImpl extends GenericDaoBase<UsageVO, Long> implements Usage | ||||
| 
 | ||||
|        @Override | ||||
|        public void saveVmDiskStats(List<VmDiskStatisticsVO> vmDiskStats) { | ||||
|                Transaction txn = Transaction.currentTxn(); | ||||
|                TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         try { | ||||
|             txn.start(); | ||||
|             String sql = INSERT_VM_DISK_STATS; | ||||
| @ -381,7 +381,7 @@ public class UsageDaoImpl extends GenericDaoBase<UsageVO, Long> implements Usage | ||||
| 
 | ||||
|     @Override | ||||
|     public void saveUsageRecords(List<UsageVO> usageRecords) { | ||||
|        Transaction txn = Transaction.currentTxn(); | ||||
|        TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         try { | ||||
|             txn.start(); | ||||
|             String sql = INSERT_USGAE_RECORDS; | ||||
|  | ||||
| @ -32,7 +32,7 @@ import com.cloud.usage.UsageIPAddressVO; | ||||
| import com.cloud.user.Account; | ||||
| import com.cloud.utils.DateUtil; | ||||
| import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| 
 | ||||
| @Component | ||||
| @Local(value={UsageIPAddressDao.class}) | ||||
| @ -56,7 +56,7 @@ public class UsageIPAddressDaoImpl extends GenericDaoBase<UsageIPAddressVO, Long | ||||
| 	public UsageIPAddressDaoImpl() {} | ||||
| 
 | ||||
| 	public void update(UsageIPAddressVO usage) { | ||||
| 	    Transaction txn = Transaction.open(Transaction.USAGE_DB); | ||||
| 	    TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.USAGE_DB); | ||||
| 		PreparedStatement pstmt = null; | ||||
| 		try { | ||||
| 		    txn.start(); | ||||
| @ -92,7 +92,7 @@ public class UsageIPAddressDaoImpl extends GenericDaoBase<UsageIPAddressVO, Long | ||||
|             sql = GET_ALL_USAGE_RECORDS; | ||||
|         } | ||||
| 
 | ||||
|         Transaction txn = Transaction.open(Transaction.USAGE_DB); | ||||
|         TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.USAGE_DB); | ||||
|         PreparedStatement pstmt = null; | ||||
| 
 | ||||
|         try { | ||||
|  | ||||
| @ -30,7 +30,7 @@ import com.cloud.usage.UsageJobVO; | ||||
| import com.cloud.utils.db.Filter; | ||||
| import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.SearchCriteria; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| import com.cloud.utils.exception.CloudRuntimeException; | ||||
| 
 | ||||
| @Component | ||||
| @ -42,7 +42,7 @@ public class UsageJobDaoImpl extends GenericDaoBase<UsageJobVO, Long> implements | ||||
| 
 | ||||
|     @Override | ||||
|     public long getLastJobSuccessDateMillis() { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         PreparedStatement pstmt = null; | ||||
|         String sql = GET_LAST_JOB_SUCCESS_DATE_MILLIS; | ||||
|         try { | ||||
| @ -61,7 +61,7 @@ public class UsageJobDaoImpl extends GenericDaoBase<UsageJobVO, Long> implements | ||||
| 
 | ||||
|     @Override | ||||
|     public void updateJobSuccess(Long jobId, long startMillis, long endMillis, long execTime, boolean success) { | ||||
|         Transaction txn = Transaction.open(Transaction.USAGE_DB); | ||||
|         TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.USAGE_DB); | ||||
|         try { | ||||
|             txn.start(); | ||||
| 
 | ||||
| @ -115,7 +115,7 @@ public class UsageJobDaoImpl extends GenericDaoBase<UsageJobVO, Long> implements | ||||
| 
 | ||||
|     @Override | ||||
|     public UsageJobVO isOwner(String hostname, int pid) { | ||||
|         Transaction txn = Transaction.open(Transaction.USAGE_DB); | ||||
|         TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.USAGE_DB); | ||||
|         try { | ||||
|             if ((hostname == null) || (pid <= 0)) { | ||||
|                 return null; | ||||
|  | ||||
| @ -31,7 +31,7 @@ import org.springframework.stereotype.Component; | ||||
| import com.cloud.usage.UsageLoadBalancerPolicyVO; | ||||
| import com.cloud.utils.DateUtil; | ||||
| import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| 
 | ||||
| @Component | ||||
| @Local(value={UsageLoadBalancerPolicyDao.class}) | ||||
| @ -56,7 +56,7 @@ public class UsageLoadBalancerPolicyDaoImpl extends GenericDaoBase<UsageLoadBala | ||||
| 	public UsageLoadBalancerPolicyDaoImpl() {} | ||||
| 
 | ||||
| 	public void removeBy(long accountId, long lbId) { | ||||
| 	    Transaction txn = Transaction.open(Transaction.USAGE_DB); | ||||
| 	    TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.USAGE_DB); | ||||
| 		PreparedStatement pstmt = null; | ||||
| 		try { | ||||
| 		    txn.start(); | ||||
| @ -75,7 +75,7 @@ public class UsageLoadBalancerPolicyDaoImpl extends GenericDaoBase<UsageLoadBala | ||||
| 	} | ||||
| 
 | ||||
| 	public void update(UsageLoadBalancerPolicyVO usage) { | ||||
| 	    Transaction txn = Transaction.open(Transaction.USAGE_DB); | ||||
| 	    TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.USAGE_DB); | ||||
| 		PreparedStatement pstmt = null; | ||||
| 		try { | ||||
| 		    txn.start(); | ||||
| @ -119,7 +119,7 @@ public class UsageLoadBalancerPolicyDaoImpl extends GenericDaoBase<UsageLoadBala | ||||
|             sql += " LIMIT " + startIndex + ",500"; | ||||
|         } | ||||
| 
 | ||||
|         Transaction txn = Transaction.open(Transaction.USAGE_DB); | ||||
|         TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.USAGE_DB); | ||||
|         PreparedStatement pstmt = null; | ||||
| 
 | ||||
|         try { | ||||
|  | ||||
| @ -29,7 +29,7 @@ import org.springframework.stereotype.Component; | ||||
| 
 | ||||
| import com.cloud.usage.UsageNetworkVO; | ||||
| import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| import com.cloud.utils.exception.CloudRuntimeException; | ||||
| 
 | ||||
| @Component | ||||
| @ -50,7 +50,7 @@ public class UsageNetworkDaoImpl extends GenericDaoBase<UsageNetworkVO, Long> im | ||||
| 
 | ||||
| 	@Override | ||||
| 	public Map<String, UsageNetworkVO> getRecentNetworkStats() { | ||||
|         Transaction txn = Transaction.open(Transaction.USAGE_DB); | ||||
|         TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.USAGE_DB); | ||||
|         String sql = SELECT_LATEST_STATS; | ||||
|         PreparedStatement pstmt = null; | ||||
|         try { | ||||
| @ -85,7 +85,7 @@ public class UsageNetworkDaoImpl extends GenericDaoBase<UsageNetworkVO, Long> im | ||||
| 
 | ||||
|     @Override | ||||
| 	public void deleteOldStats(long maxEventTime) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         String sql = DELETE_OLD_STATS; | ||||
|         PreparedStatement pstmt = null; | ||||
|         try { | ||||
| @ -102,7 +102,7 @@ public class UsageNetworkDaoImpl extends GenericDaoBase<UsageNetworkVO, Long> im | ||||
| 
 | ||||
|     @Override | ||||
|     public void saveUsageNetworks (List<UsageNetworkVO> usageNetworks) { | ||||
|         Transaction txn = Transaction.currentTxn(); | ||||
|         TransactionLegacy txn = TransactionLegacy.currentTxn(); | ||||
|         try { | ||||
|             txn.start(); | ||||
|             String sql = INSERT_USAGE_NETWORK; | ||||
|  | ||||
| @ -31,7 +31,7 @@ import org.springframework.stereotype.Component; | ||||
| import com.cloud.usage.UsageNetworkOfferingVO; | ||||
| import com.cloud.utils.DateUtil; | ||||
| import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| 
 | ||||
| @Component | ||||
| @Local(value={UsageNetworkOfferingDao.class}) | ||||
| @ -55,7 +55,7 @@ public class UsageNetworkOfferingDaoImpl extends GenericDaoBase<UsageNetworkOffe | ||||
| 	public UsageNetworkOfferingDaoImpl() {} | ||||
| 
 | ||||
| 	public void update(UsageNetworkOfferingVO usage) { | ||||
| 	    Transaction txn = Transaction.open(Transaction.USAGE_DB); | ||||
| 	    TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.USAGE_DB); | ||||
| 		PreparedStatement pstmt = null; | ||||
| 		try { | ||||
| 		    txn.start(); | ||||
| @ -100,7 +100,7 @@ public class UsageNetworkOfferingDaoImpl extends GenericDaoBase<UsageNetworkOffe | ||||
|             sql += " LIMIT " + startIndex + ",500"; | ||||
|         } | ||||
| 
 | ||||
|         Transaction txn = Transaction.open(Transaction.USAGE_DB); | ||||
|         TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.USAGE_DB); | ||||
|         PreparedStatement pstmt = null; | ||||
| 
 | ||||
|         try { | ||||
|  | ||||
| @ -31,7 +31,7 @@ import org.springframework.stereotype.Component; | ||||
| import com.cloud.usage.UsagePortForwardingRuleVO; | ||||
| import com.cloud.utils.DateUtil; | ||||
| import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| 
 | ||||
| @Component | ||||
| @Local(value={UsagePortForwardingRuleDao.class}) | ||||
| @ -56,7 +56,7 @@ public class UsagePortForwardingRuleDaoImpl extends GenericDaoBase<UsagePortForw | ||||
| 	public UsagePortForwardingRuleDaoImpl() {} | ||||
| 
 | ||||
| 	public void removeBy(long accountId, long pfId) { | ||||
| 	    Transaction txn = Transaction.open(Transaction.USAGE_DB); | ||||
| 	    TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.USAGE_DB); | ||||
| 		PreparedStatement pstmt = null; | ||||
| 		try { | ||||
| 		    txn.start(); | ||||
| @ -75,7 +75,7 @@ public class UsagePortForwardingRuleDaoImpl extends GenericDaoBase<UsagePortForw | ||||
| 	} | ||||
| 
 | ||||
| 	public void update(UsagePortForwardingRuleVO usage) { | ||||
| 	    Transaction txn = Transaction.open(Transaction.USAGE_DB); | ||||
| 	    TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.USAGE_DB); | ||||
| 		PreparedStatement pstmt = null; | ||||
| 		try { | ||||
| 		    txn.start(); | ||||
| @ -119,7 +119,7 @@ public class UsagePortForwardingRuleDaoImpl extends GenericDaoBase<UsagePortForw | ||||
|             sql += " LIMIT " + startIndex + ",500"; | ||||
|         } | ||||
| 
 | ||||
|         Transaction txn = Transaction.open(Transaction.USAGE_DB); | ||||
|         TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.USAGE_DB); | ||||
|         PreparedStatement pstmt = null; | ||||
| 
 | ||||
|         try { | ||||
|  | ||||
| @ -31,7 +31,7 @@ import org.springframework.stereotype.Component; | ||||
| import com.cloud.usage.UsageSecurityGroupVO; | ||||
| import com.cloud.utils.DateUtil; | ||||
| import com.cloud.utils.db.GenericDaoBase; | ||||
| import com.cloud.utils.db.Transaction; | ||||
| import com.cloud.utils.db.TransactionLegacy; | ||||
| 
 | ||||
| @Component | ||||
| @Local(value={UsageSecurityGroupDao.class}) | ||||
| @ -55,7 +55,7 @@ public class UsageSecurityGroupDaoImpl extends GenericDaoBase<UsageSecurityGroup | ||||
| 	public UsageSecurityGroupDaoImpl() {} | ||||
| 
 | ||||
| 	public void update(UsageSecurityGroupVO usage) { | ||||
| 	    Transaction txn = Transaction.open(Transaction.USAGE_DB); | ||||
| 	    TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.USAGE_DB); | ||||
| 		PreparedStatement pstmt = null; | ||||
| 		try { | ||||
| 		    txn.start(); | ||||
| @ -100,7 +100,7 @@ public class UsageSecurityGroupDaoImpl extends GenericDaoBase<UsageSecurityGroup | ||||
|             sql += " LIMIT " + startIndex + ",500"; | ||||
|         } | ||||
| 
 | ||||
|         Transaction txn = Transaction.open(Transaction.USAGE_DB); | ||||
|         TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.USAGE_DB); | ||||
|         PreparedStatement pstmt = null; | ||||
| 
 | ||||
|         try { | ||||
|  | ||||
Some files were not shown because too many files have changed in this diff Show More
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user