cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject git commit: updated refs/heads/4.2 to 7edde4a
Date Thu, 27 Nov 2014 11:30:04 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/4.2 14b846877 -> 7edde4a5c


PATCH: CLOUDSTACK-6254

Fixes the cleanup process to only remove the Template symlink, instead of delete the template
from Secondary Storage.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/7edde4a5
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/7edde4a5
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/7edde4a5

Branch: refs/heads/4.2
Commit: 7edde4a5c7d849f5c9184972f8d4bc1f79770f65
Parents: 14b8468
Author: David Bierce <david.bierce@appcore.com>
Authored: Wed Aug 27 09:31:18 2014 -0500
Committer: Rohit Yadav <rohit.yadav@shapeblue.com>
Committed: Thu Nov 27 16:59:06 2014 +0530

----------------------------------------------------------------------
 .../storage/image/datastore/ImageStoreEntity.java  |  3 ++-
 .../storage/image/store/ImageStoreImpl.java        |  5 +++--
 .../storage/image/BaseImageStoreDriverImpl.java    |  3 ++-
 .../cloudstack/storage/image/ImageStoreDriver.java |  4 +++-
 .../driver/CloudStackImageStoreDriverImpl.java     | 17 ++++++++++++-----
 .../src/com/cloud/storage/StorageManagerImpl.java  |  4 ++--
 6 files changed, 24 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7edde4a5/engine/api/src/org/apache/cloudstack/storage/image/datastore/ImageStoreEntity.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/storage/image/datastore/ImageStoreEntity.java
b/engine/api/src/org/apache/cloudstack/storage/image/datastore/ImageStoreEntity.java
index 7ebfd0d..be82364 100644
--- a/engine/api/src/org/apache/cloudstack/storage/image/datastore/ImageStoreEntity.java
+++ b/engine/api/src/org/apache/cloudstack/storage/image/datastore/ImageStoreEntity.java
@@ -27,6 +27,7 @@ import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo;
 import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
 
 import com.cloud.storage.ImageStore;
+import com.cloud.storage.Upload;
 import com.cloud.storage.Storage.ImageFormat;
 
 public interface ImageStoreEntity extends DataStore, ImageStore {
@@ -44,5 +45,5 @@ public interface ImageStoreEntity extends DataStore, ImageStore {
 
     String createEntityExtractUrl(String installPath, ImageFormat format, DataObject dataObject);
 // get the entity download URL
 
-    void deleteExtractUrl(String installPath, String url);
+    void deleteExtractUrl(String installPath, String url, Upload.Type volume);
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7edde4a5/engine/storage/image/src/org/apache/cloudstack/storage/image/store/ImageStoreImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/image/src/org/apache/cloudstack/storage/image/store/ImageStoreImpl.java
b/engine/storage/image/src/org/apache/cloudstack/storage/image/store/ImageStoreImpl.java
index 7bbe324..5c05955 100644
--- a/engine/storage/image/src/org/apache/cloudstack/storage/image/store/ImageStoreImpl.java
+++ b/engine/storage/image/src/org/apache/cloudstack/storage/image/store/ImageStoreImpl.java
@@ -45,6 +45,7 @@ import com.cloud.agent.api.to.DataStoreTO;
 import com.cloud.storage.DataStoreRole;
 import com.cloud.storage.Storage.ImageFormat;
 import com.cloud.storage.dao.VMTemplateDao;
+import com.cloud.storage.Upload;
 import com.cloud.utils.component.ComponentContext;
 
 public class ImageStoreImpl implements ImageStoreEntity {
@@ -195,8 +196,8 @@ public class ImageStoreImpl implements ImageStoreEntity {
     }
 
     @Override
-    public void deleteExtractUrl(String installPath, String url) {
-        driver.deleteEntityExtractUrl(this, installPath, url);
+    public void deleteExtractUrl(String installPath, String url, Upload.Type entityType )
{
+        driver.deleteEntityExtractUrl(this, installPath, url, entityType);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7edde4a5/engine/storage/src/org/apache/cloudstack/storage/image/BaseImageStoreDriverImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/BaseImageStoreDriverImpl.java
b/engine/storage/src/org/apache/cloudstack/storage/image/BaseImageStoreDriverImpl.java
index 2905f08..8e884d5 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/image/BaseImageStoreDriverImpl.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/image/BaseImageStoreDriverImpl.java
@@ -30,6 +30,7 @@ import com.cloud.storage.VolumeVO;
 import com.cloud.storage.dao.VMTemplateDao;
 import com.cloud.storage.dao.VolumeDao;
 import com.cloud.storage.download.DownloadMonitor;
+import com.cloud.storage.Upload;
 import org.apache.cloudstack.engine.subsystem.api.storage.CopyCommandResult;
 import org.apache.cloudstack.engine.subsystem.api.storage.CreateCmdResult;
 import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
@@ -261,7 +262,7 @@ public abstract class BaseImageStoreDriverImpl implements ImageStoreDriver
{
     }
 
     @Override
-    public void deleteEntityExtractUrl(DataStore store, String installPath, String url){
+    public void deleteEntityExtractUrl(DataStore store, String installPath, String url, Upload.Type
entityType){
     }
 
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7edde4a5/engine/storage/src/org/apache/cloudstack/storage/image/ImageStoreDriver.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/ImageStoreDriver.java
b/engine/storage/src/org/apache/cloudstack/storage/image/ImageStoreDriver.java
index 444a6c7..d7d435d 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/image/ImageStoreDriver.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/image/ImageStoreDriver.java
@@ -23,11 +23,13 @@ import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
 import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreDriver;
 
 import com.cloud.storage.Storage.ImageFormat;
+import com.cloud.storage.Upload;
+import com.cloud.storage.Upload.Type;
 
 public interface ImageStoreDriver extends DataStoreDriver {
 
     String createEntityExtractUrl(DataStore store, String installPath, ImageFormat format,
DataObject dataObject);
 
-    void deleteEntityExtractUrl(DataStore store, String installPath, String url);
+	void deleteEntityExtractUrl(DataStore store, String installPath, String downloadUrl, Upload.Type
entityType);
 
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7edde4a5/plugins/storage/image/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackImageStoreDriverImpl.java
----------------------------------------------------------------------
diff --git a/plugins/storage/image/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackImageStoreDriverImpl.java
b/plugins/storage/image/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackImageStoreDriverImpl.java
index 4796653..deba61b 100644
--- a/plugins/storage/image/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackImageStoreDriverImpl.java
+++ b/plugins/storage/image/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackImageStoreDriverImpl.java
@@ -81,14 +81,21 @@ public class CloudStackImageStoreDriverImpl extends BaseImageStoreDriverImpl
{
     }
 
     @Override
-    public void deleteEntityExtractUrl(DataStore store, String installPath, String downloadUrl)
{
+    public void deleteEntityExtractUrl(DataStore store, String installPath, String downloadUrl,
Upload.Type entityType) {
         // find an endpoint to send command
         EndPoint ep = _epSelector.select(store);
-        // Create Symlink at ssvm
-        //CreateEntityDownloadURLCommand cmd = new CreateEntityDownloadURLCommand(((ImageStoreEntity)
store).getMountPoint(), installPath, uuid);
-        DeleteEntityDownloadURLCommand cmd = new DeleteEntityDownloadURLCommand(installPath,
Upload.Type.VOLUME, downloadUrl, ((ImageStoreEntity) store).getMountPoint());
 
-        Answer ans = ep.sendMessage(cmd);
+        // Delete Symlink at ssvm. In case of volume also delete the volume.
+        DeleteEntityDownloadURLCommand cmd = new DeleteEntityDownloadURLCommand(installPath,
entityType, downloadUrl, ((ImageStoreEntity) store).getMountPoint());
+
+        Answer ans = null;
+        if (ep == null) {
+            String errMsg = "No remote endpoint to send command, check if host or ssvm is
down?";
+            s_logger.error(errMsg);
+            ans = new Answer(cmd, false, errMsg);
+        } else {
+            ans = ep.sendMessage(cmd);
+        }
         if (ans == null || !ans.getResult()) {
             String errorString = "Unable to delete the url " + downloadUrl + " for path "
+ installPath + " on ssvm, " + ans.getDetails();
             s_logger.error(errorString);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7edde4a5/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 2a79b0c..d892d8e 100755
--- a/server/src/com/cloud/storage/StorageManagerImpl.java
+++ b/server/src/com/cloud/storage/StorageManagerImpl.java
@@ -1214,7 +1214,7 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager,
C
 
             // Remove it from image store
             ImageStoreEntity secStore = (ImageStoreEntity) _dataStoreMgr.getDataStore(volumeOnImageStore.getDataStoreId(),
DataStoreRole.Image);
-            secStore.deleteExtractUrl(volumeOnImageStore.getInstallPath(), volumeOnImageStore.getExtractUrl());
+            secStore.deleteExtractUrl(volumeOnImageStore.getInstallPath(), volumeOnImageStore.getExtractUrl(),
Upload.Type.VOLUME);
 
              // Now remove it from DB.
              volumeOnImageStore.setExtractUrl(null);
@@ -1240,7 +1240,7 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager,
C
 
                 // Remove it from image store
                 ImageStoreEntity secStore = (ImageStoreEntity) _dataStoreMgr.getDataStore(templateOnImageStore.getDataStoreId(),
DataStoreRole.Image);
-                secStore.deleteExtractUrl(templateOnImageStore.getInstallPath(), templateOnImageStore.getExtractUrl());
+                secStore.deleteExtractUrl(templateOnImageStore.getInstallPath(), templateOnImageStore.getExtractUrl(),
Upload.Type.TEMPLATE);
 
                 // Now remove it from DB.
                 templateOnImageStore.setExtractUrl(null);


Mime
View raw message