Updated Branches: refs/heads/4.3 6a23f0621 -> fcab2b776
0001-Fixed-issue-with-DataStoreDrivers-not-being-able-to- Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/78c77ec9 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/78c77ec9 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/78c77ec9 Branch: refs/heads/4.3 Commit: 78c77ec9051a57fe6a1df179704857d906ecb6ec Parents: 6a23f06 Author: edison su <[email protected]> Authored: Tue Dec 3 13:12:36 2013 -0800 Committer: edison su <[email protected]> Committed: Tue Dec 3 13:16:50 2013 -0800 ---------------------------------------------------------------------- .../cloudstack/api/ServerApiException.java | 4 ++ .../com/cloud/storage/StorageManagerImpl.java | 49 ++++++++++---------- 2 files changed, 28 insertions(+), 25 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/78c77ec9/api/src/org/apache/cloudstack/api/ServerApiException.java ---------------------------------------------------------------------- diff --git a/api/src/org/apache/cloudstack/api/ServerApiException.java b/api/src/org/apache/cloudstack/api/ServerApiException.java index 1a740d5..c202eb3 100644 --- a/api/src/org/apache/cloudstack/api/ServerApiException.java +++ b/api/src/org/apache/cloudstack/api/ServerApiException.java @@ -81,4 +81,8 @@ public class ServerApiException extends CloudRuntimeException { _description = description; } + @Override + public String getMessage() { + return _description; + } } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/78c77ec9/server/src/com/cloud/storage/StorageManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/storage/StorageManagerImpl.java b/server/src/com/cloud/storage/StorageManagerImpl.java index b4446e7..a96a4ee 100755 --- a/server/src/com/cloud/storage/StorageManagerImpl.java +++ b/server/src/com/cloud/storage/StorageManagerImpl.java @@ -41,9 +41,6 @@ import javax.ejb.Local; import javax.inject.Inject; import javax.naming.ConfigurationException; -import org.apache.log4j.Logger; -import org.springframework.stereotype.Component; - import org.apache.cloudstack.api.command.admin.storage.AddImageStoreCmd; import org.apache.cloudstack.api.command.admin.storage.CancelPrimaryStorageMaintenanceCmd; import org.apache.cloudstack.api.command.admin.storage.CreateSecondaryStagingStoreCmd; @@ -89,6 +86,8 @@ import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreDao; import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreVO; import org.apache.cloudstack.storage.datastore.db.VolumeDataStoreDao; import org.apache.cloudstack.storage.datastore.db.VolumeDataStoreVO; +import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; import com.cloud.agent.AgentManager; import com.cloud.agent.api.Answer; @@ -666,12 +665,12 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C lifeCycle.attachZone(store, zoneScope, hypervisorType); } } catch (Exception e) { - s_logger.debug("Failed to add data store", e); + s_logger.debug("Failed to add data store: "+e.getMessage(), e); // clean up the db if (store != null) { lifeCycle.deleteDataStore(store); } - throw new CloudRuntimeException("Failed to add data store", e); + throw new CloudRuntimeException("Failed to add data store: "+e.getMessage(), e); } return (PrimaryDataStoreInfo) dataStoreMgr.getDataStore(store.getId(), DataStoreRole.Primary); @@ -1736,8 +1735,8 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C try { store = lifeCycle.initialize(params); } catch (Exception e) { - s_logger.debug("Failed to add data store", e); - throw new CloudRuntimeException("Failed to add data store", e); + s_logger.debug("Failed to add data store: "+e.getMessage(), e); + throw new CloudRuntimeException("Failed to add data store: "+e.getMessage(), e); } if (((ImageStoreProvider) storeProvider).needDownloadSysTemplate()) { @@ -1827,14 +1826,14 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C Transaction.execute(new TransactionCallbackNoReturn() { @Override public void doInTransactionWithoutResult(TransactionStatus status) { - // first delete from image_store_details table, we need to do that since - // we are not actually deleting record from main - // image_data_store table, so delete cascade will not work - _imageStoreDetailsDao.deleteDetails(storeId); - _snapshotStoreDao.deletePrimaryRecordsForStore(storeId, DataStoreRole.Image); - _volumeStoreDao.deletePrimaryRecordsForStore(storeId); - _templateStoreDao.deletePrimaryRecordsForStore(storeId); - _imageStoreDao.remove(storeId); + // first delete from image_store_details table, we need to do that since + // we are not actually deleting record from main + // image_data_store table, so delete cascade will not work + _imageStoreDetailsDao.deleteDetails(storeId); + _snapshotStoreDao.deletePrimaryRecordsForStore(storeId, DataStoreRole.Image); + _volumeStoreDao.deletePrimaryRecordsForStore(storeId); + _templateStoreDao.deletePrimaryRecordsForStore(storeId); + _imageStoreDao.remove(storeId); } }); @@ -1902,8 +1901,8 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C try { store = lifeCycle.initialize(params); } catch (Exception e) { - s_logger.debug("Failed to add data store", e); - throw new CloudRuntimeException("Failed to add data store", e); + s_logger.debug("Failed to add data store: "+e.getMessage(), e); + throw new CloudRuntimeException("Failed to add data store: "+e.getMessage(), e); } return (ImageStore) _dataStoreMgr.getDataStore(store.getId(), DataStoreRole.ImageCache); @@ -1939,14 +1938,14 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C Transaction.execute(new TransactionCallbackNoReturn() { @Override public void doInTransactionWithoutResult(TransactionStatus status) { - // first delete from image_store_details table, we need to do that since - // we are not actually deleting record from main - // image_data_store table, so delete cascade will not work - _imageStoreDetailsDao.deleteDetails(storeId); - _snapshotStoreDao.deletePrimaryRecordsForStore(storeId, DataStoreRole.ImageCache); - _volumeStoreDao.deletePrimaryRecordsForStore(storeId); - _templateStoreDao.deletePrimaryRecordsForStore(storeId); - _imageStoreDao.remove(storeId); + // first delete from image_store_details table, we need to do that since + // we are not actually deleting record from main + // image_data_store table, so delete cascade will not work + _imageStoreDetailsDao.deleteDetails(storeId); + _snapshotStoreDao.deletePrimaryRecordsForStore(storeId, DataStoreRole.ImageCache); + _volumeStoreDao.deletePrimaryRecordsForStore(storeId); + _templateStoreDao.deletePrimaryRecordsForStore(storeId); + _imageStoreDao.remove(storeId); } });
