From 02ace3442db96c78da53bd79d544b1ab511f2a29 Mon Sep 17 00:00:00 2001 From: edison su Date: Tue, 3 Dec 2013 13:12:36 -0800 Subject: [PATCH] 0001-Fixed-issue-with-DataStoreDrivers-not-being-able-to- --- .../cloudstack/api/ServerApiException.java | 4 ++++ .../com/cloud/storage/StorageManagerImpl.java | 17 ++++++++--------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/api/src/org/apache/cloudstack/api/ServerApiException.java b/api/src/org/apache/cloudstack/api/ServerApiException.java index 81184e3f4f3..a8bb2ed71c9 100644 --- a/api/src/org/apache/cloudstack/api/ServerApiException.java +++ b/api/src/org/apache/cloudstack/api/ServerApiException.java @@ -82,4 +82,8 @@ public class ServerApiException extends CloudRuntimeException { _description = description; } + @Override + public String getMessage() { + return _description; + } } diff --git a/server/src/com/cloud/storage/StorageManagerImpl.java b/server/src/com/cloud/storage/StorageManagerImpl.java index 831fac8ba44..c7503b98aad 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; @@ -87,6 +84,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; @@ -658,12 +657,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); @@ -1698,8 +1697,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()) { @@ -1862,8 +1861,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);