You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ed...@apache.org on 2013/06/20 09:19:47 UTC

[14/50] [abbrv] git commit: updated refs/heads/master to 97f8c52

Remove old DeleteTemplateCommand, DeleteVolumeCommand,
DeleteSnapshotBackupCommand, replaced by DeleteCommand.

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

Branch: refs/heads/master
Commit: cc0de88088784348c3658ed2dbdffe649f8d99b8
Parents: 04b5f53
Author: Min Chen <mi...@citrix.com>
Authored: Mon Jun 10 17:55:30 2013 -0700
Committer: Min Chen <mi...@citrix.com>
Committed: Mon Jun 10 17:55:30 2013 -0700

----------------------------------------------------------------------
 .../agent/api/DeleteSnapshotBackupAnswer.java   | 32 --------
 .../agent/api/DeleteSnapshotBackupCommand.java  | 85 --------------------
 .../api/storage/DeleteTemplateCommand.java      | 62 --------------
 .../agent/api/storage/DeleteVolumeCommand.java  | 54 -------------
 .../cloudstack/storage/to/TemplateObjectTO.java | 13 ++-
 .../cloudstack/storage/to/VolumeObjectTO.java   |  5 ++
 .../storage/image/TemplateServiceImpl.java      | 12 ++-
 .../storage/test/DirectAgentTest.java           |  2 +-
 .../storage/volume/VolumeServiceImpl.java       | 33 +++++---
 .../kvm/resource/LibvirtComputingResource.java  |  3 -
 .../cloud/agent/manager/MockStorageManager.java |  8 +-
 .../agent/manager/MockStorageManagerImpl.java   | 39 +++------
 .../agent/manager/SimulatorManagerImpl.java     |  9 +--
 .../com/cloud/storage/StorageManagerImpl.java   | 73 ++---------------
 .../cloud/storage/swift/SwiftManagerImpl.java   | 13 ++-
 15 files changed, 82 insertions(+), 361 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cc0de880/core/src/com/cloud/agent/api/DeleteSnapshotBackupAnswer.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/DeleteSnapshotBackupAnswer.java b/core/src/com/cloud/agent/api/DeleteSnapshotBackupAnswer.java
deleted file mode 100644
index 9a895d8..0000000
--- a/core/src/com/cloud/agent/api/DeleteSnapshotBackupAnswer.java
+++ /dev/null
@@ -1,32 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.agent.api;
-
-
-public class DeleteSnapshotBackupAnswer extends Answer {
-
-    protected DeleteSnapshotBackupAnswer() {
-
-    }
-
-    public DeleteSnapshotBackupAnswer(DeleteSnapshotBackupCommand cmd, boolean success, String details) {
-        super(cmd, success, details);
-    }
-
-
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cc0de880/core/src/com/cloud/agent/api/DeleteSnapshotBackupCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/DeleteSnapshotBackupCommand.java b/core/src/com/cloud/agent/api/DeleteSnapshotBackupCommand.java
deleted file mode 100644
index c4f20ea..0000000
--- a/core/src/com/cloud/agent/api/DeleteSnapshotBackupCommand.java
+++ /dev/null
@@ -1,85 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.agent.api;
-
-import com.cloud.agent.api.LogLevel.Log4jLevel;
-import com.cloud.agent.api.to.DataStoreTO;
-import com.cloud.agent.api.to.S3TO;
-import com.cloud.agent.api.to.SwiftTO;
-import com.cloud.storage.StoragePool;
-
-/**
- * This command encapsulates a primitive operation which enables coalescing the backed up VHD snapshots on the secondary server
- * This currently assumes that the secondary storage are mounted on the XenServer.
- */
-public class DeleteSnapshotBackupCommand extends SnapshotCommand {
-    @LogLevel(Log4jLevel.Off)
-    private DataStoreTO store;
-    private Boolean all;
-
-    public Boolean isAll() {
-        return all;
-    }
-
-    public void setAll(Boolean all) {
-        this.all = all;
-    }
-
-    public DataStoreTO getDataStore(){
-        return store;
-    }
-
-    protected DeleteSnapshotBackupCommand() {
-    }
-
-    /**
-     * Given 2 VHD files on the secondary storage which are linked in a parent chain as follows:
-     * backupUUID = parent(childUUID)
-     * It gets another VHD
-     * previousBackupVHD = parent(backupUUID)
-     *
-     * And
-     * 1) it coalesces backupUuid into its parent.
-     * 2) It deletes the VHD file corresponding to backupUuid
-     * 3) It sets the parent VHD of childUUID to that of previousBackupUuid
-     *
-     * It takes care of the cases when
-     * 1) childUUID is null. - Step 3 is not done.
-     * 2) previousBackupUUID is null
-     *       - Merge childUUID into its parent backupUUID
-     *       - Set the UUID of the resultant VHD to childUUID
-     *       - Essentially we are deleting the oldest VHD file and setting the current oldest VHD to childUUID
-     *
-     * @param volumeName                  The name of the volume whose snapshot was taken (something like i-3-SV-ROOT)
-     * @param secondaryStoragePoolURL    This is what shows up in the UI when you click on Secondary storage.
-     *                                    In the code, it is present as: In the vmops.host_details table, there is a field mount.parent. This is the value of that field
-     *                                    If you have better ideas on how to get it, you are welcome.
-     * @param backupUUID                  The VHD which has to be deleted
-     * @param childUUID                   The child VHD file of the backup whose parent is reset to its grandparent.
-     */
-    public DeleteSnapshotBackupCommand(DataStoreTO store,
-                                       String secondaryStoragePoolURL,
-                                       Long   dcId,
-                                       Long   accountId,
-                                       Long   volumeId,
- String backupUUID, Boolean all)
-    {
-        super(null, secondaryStoragePoolURL, backupUUID, null, dcId, accountId, volumeId);
-        this.store = store;
-        setAll(all);
-    }
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cc0de880/core/src/com/cloud/agent/api/storage/DeleteTemplateCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/DeleteTemplateCommand.java b/core/src/com/cloud/agent/api/storage/DeleteTemplateCommand.java
deleted file mode 100644
index f72657c..0000000
--- a/core/src/com/cloud/agent/api/storage/DeleteTemplateCommand.java
+++ /dev/null
@@ -1,62 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.agent.api.storage;
-
-import com.cloud.agent.api.to.DataStoreTO;
-
-
-public class DeleteTemplateCommand extends ssCommand {
-    private DataStoreTO store;
-	private String templatePath;
-	private Long templateId;
-	private Long accountId;
-
-
-	public DeleteTemplateCommand() {
-	}
-
-
-	public DeleteTemplateCommand(DataStoreTO store, String templatePath, Long templateId, Long accountId) {
-    	this.templatePath = templatePath;
-    	this.templateId = templateId;
-    	this.accountId = accountId;
-    	this.store = store;
-    }
-
-	@Override
-    public boolean executeInSequence() {
-        return true;
-    }
-
-	public String getTemplatePath() {
-		return templatePath;
-	}
-
-    public Long getTemplateId() {
-        return templateId;
-    }
-
-    public Long getAccountId() {
-        return accountId;
-    }
-
-    public DataStoreTO getDataStore() {
-        return store;
-    }
-
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cc0de880/core/src/com/cloud/agent/api/storage/DeleteVolumeCommand.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/agent/api/storage/DeleteVolumeCommand.java b/core/src/com/cloud/agent/api/storage/DeleteVolumeCommand.java
deleted file mode 100755
index 49f0a21..0000000
--- a/core/src/com/cloud/agent/api/storage/DeleteVolumeCommand.java
+++ /dev/null
@@ -1,54 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-package com.cloud.agent.api.storage;
-
-import com.cloud.agent.api.to.DataStoreTO;
-
-public class DeleteVolumeCommand extends ssCommand {
-    private DataStoreTO store;
-	private String volumePath;
-	private Long volumeId;
-
-	public DeleteVolumeCommand() {
-	}
-
-	public DeleteVolumeCommand(DataStoreTO store, Long volumeId, String volumePath) {
-	    this.store = store;
-	    this.volumeId = volumeId;
-    	this.volumePath = volumePath;
-    }
-
-	@Override
-    public boolean executeInSequence() {
-        return true;
-    }
-
-	public String getVolumePath() {
-		return volumePath;
-	}
-
-    public DataStoreTO getDataStore() {
-        return store;
-    }
-
-    public Long getVolumeId() {
-        return volumeId;
-    }
-
-
-
-}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cc0de880/engine/api/src/org/apache/cloudstack/storage/to/TemplateObjectTO.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/storage/to/TemplateObjectTO.java b/engine/api/src/org/apache/cloudstack/storage/to/TemplateObjectTO.java
index 0effd8d..b3dc189 100644
--- a/engine/api/src/org/apache/cloudstack/storage/to/TemplateObjectTO.java
+++ b/engine/api/src/org/apache/cloudstack/storage/to/TemplateObjectTO.java
@@ -85,6 +85,10 @@ public class TemplateObjectTO implements DataTO {
         return id;
     }
 
+    public void setId(long id){
+        this.id = id;
+    }
+
     public ImageFormat getFormat() {
         return format;
     }
@@ -113,9 +117,6 @@ public class TemplateObjectTO implements DataTO {
         this.displayText = desc;
     }
 
-    public DataStoreTO getImageDataStore() {
-        return this.imageDataStore;
-    }
 
     @Override
     public DataObjectType getObjectType() {
@@ -124,7 +125,11 @@ public class TemplateObjectTO implements DataTO {
 
     @Override
     public DataStoreTO getDataStore() {
-        return (DataStoreTO) this.imageDataStore;
+        return this.imageDataStore;
+    }
+
+    public void setDataStore(DataStoreTO store){
+        this.imageDataStore = store;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cc0de880/engine/api/src/org/apache/cloudstack/storage/to/VolumeObjectTO.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/storage/to/VolumeObjectTO.java b/engine/api/src/org/apache/cloudstack/storage/to/VolumeObjectTO.java
index 549481e..6057a74 100644
--- a/engine/api/src/org/apache/cloudstack/storage/to/VolumeObjectTO.java
+++ b/engine/api/src/org/apache/cloudstack/storage/to/VolumeObjectTO.java
@@ -79,6 +79,11 @@ public class VolumeObjectTO implements DataTO {
         return this.dataStore;
     }
 
+
+    public void setDataStore(DataStoreTO store){
+        this.dataStore = store;
+    }
+
     public void setDataStore(PrimaryDataStoreTO dataStore) {
         this.dataStore = dataStore;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cc0de880/engine/storage/image/src/org/apache/cloudstack/storage/image/TemplateServiceImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/image/src/org/apache/cloudstack/storage/image/TemplateServiceImpl.java b/engine/storage/image/src/org/apache/cloudstack/storage/image/TemplateServiceImpl.java
index a0cbc27..fb8e89c 100644
--- a/engine/storage/image/src/org/apache/cloudstack/storage/image/TemplateServiceImpl.java
+++ b/engine/storage/image/src/org/apache/cloudstack/storage/image/TemplateServiceImpl.java
@@ -51,6 +51,7 @@ import org.apache.cloudstack.framework.async.AsyncCallbackDispatcher;
 import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
 import org.apache.cloudstack.framework.async.AsyncRpcConext;
 import org.apache.cloudstack.storage.command.CommandResult;
+import org.apache.cloudstack.storage.command.DeleteCommand;
 import org.apache.cloudstack.storage.datastore.DataObjectManager;
 import org.apache.cloudstack.storage.datastore.ObjectInDataStoreManager;
 import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreDao;
@@ -58,11 +59,11 @@ import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreVO;
 import org.apache.cloudstack.storage.datastore.db.VolumeDataStoreDao;
 import org.apache.cloudstack.storage.image.manager.ImageDataManager;
 import org.apache.cloudstack.storage.image.store.TemplateObject;
+import org.apache.cloudstack.storage.to.TemplateObjectTO;
 import org.apache.log4j.Logger;
 import org.springframework.stereotype.Component;
 
 import com.cloud.agent.api.Answer;
-import com.cloud.agent.api.storage.DeleteTemplateCommand;
 import com.cloud.agent.api.storage.ListTemplateAnswer;
 import com.cloud.agent.api.storage.ListTemplateCommand;
 import com.cloud.alert.AlertManager;
@@ -445,11 +446,14 @@ public class TemplateServiceImpl implements TemplateService {
         for (String uniqueName : templateInfos.keySet()) {
             TemplateProp tInfo = templateInfos.get(uniqueName);
             if (_tmpltMgr.templateIsDeleteable(tInfo.getId())) {
-                // TODO: we cannot directly call deleteTemplateSync here to
+                // we cannot directly call deleteTemplateSync here to
                 // reuse delete logic since in this case, our db does not have
                 // this template at all.
-                DeleteTemplateCommand dtCommand = new DeleteTemplateCommand(store.getTO(), tInfo.getInstallPath(),
-                        null, null);
+                TemplateObjectTO tmplTO = new TemplateObjectTO();
+                tmplTO.setDataStore(store.getTO());
+                tmplTO.setPath(tInfo.getInstallPath());
+                tmplTO.setId(tInfo.getId());
+                DeleteCommand dtCommand = new DeleteCommand(tmplTO);
                 EndPoint ep = _epSelector.select(store);
                 Answer answer = ep.sendMessage(dtCommand);
                 if (answer == null || !answer.getResult()) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cc0de880/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/DirectAgentTest.java
----------------------------------------------------------------------
diff --git a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/DirectAgentTest.java b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/DirectAgentTest.java
index d0cfa39..b52b1e4 100644
--- a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/DirectAgentTest.java
+++ b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/DirectAgentTest.java
@@ -137,7 +137,7 @@ public class DirectAgentTest extends CloudStackTestNGBase {
 
         TemplateObjectTO template = Mockito.mock(TemplateObjectTO.class);
         Mockito.when(template.getPath()).thenReturn(getTemplateUrl());
-        Mockito.when(template.getImageDataStore()).thenReturn(imageStore);
+        Mockito.when(template.getDataStore()).thenReturn(imageStore);
 
         // Mockito.when(image.getTemplate()).thenReturn(template);
         // CopyTemplateToPrimaryStorageCmd cmd = new

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cc0de880/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
index 04e97dd..ed6b86f 100644
--- a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
+++ b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
@@ -44,18 +44,20 @@ import org.apache.cloudstack.framework.async.AsyncCallbackDispatcher;
 import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
 import org.apache.cloudstack.framework.async.AsyncRpcConext;
 import org.apache.cloudstack.storage.command.CommandResult;
+import org.apache.cloudstack.storage.command.DeleteCommand;
 import org.apache.cloudstack.storage.datastore.DataObjectManager;
 import org.apache.cloudstack.storage.datastore.ObjectInDataStoreManager;
 import org.apache.cloudstack.storage.datastore.PrimaryDataStore;
 import org.apache.cloudstack.storage.datastore.PrimaryDataStoreProviderManager;
 import org.apache.cloudstack.storage.datastore.db.VolumeDataStoreDao;
 import org.apache.cloudstack.storage.datastore.db.VolumeDataStoreVO;
+import org.apache.cloudstack.storage.to.TemplateObjectTO;
+import org.apache.cloudstack.storage.to.VolumeObjectTO;
 import org.apache.log4j.Logger;
 import org.springframework.stereotype.Component;
 
 import com.cloud.agent.AgentManager;
 import com.cloud.agent.api.Answer;
-import com.cloud.agent.api.storage.DeleteVolumeCommand;
 import com.cloud.agent.api.storage.ListVolumeAnswer;
 import com.cloud.agent.api.storage.ListVolumeCommand;
 import com.cloud.agent.api.to.VirtualMachineTO;
@@ -80,7 +82,6 @@ import com.cloud.user.AccountManager;
 import com.cloud.user.ResourceLimitService;
 import com.cloud.utils.NumbersUtil;
 import com.cloud.utils.db.DB;
-import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.vm.dao.VMInstanceDao;
 
 @Component
@@ -1127,15 +1128,27 @@ public class VolumeServiceImpl implements VolumeService {
         }
 
         // Delete volumes which are not present on DB.
-        /*
-         * for (Long uniqueName : volumeInfos.keySet()) { TemplateProp vInfo =
-         * volumeInfos.get(uniqueName);
-         * expungeVolumeAsync(volFactory.getVolume(vInfo.getId(), store));
-         *
-         * String description = "Deleted volume " + vInfo.getTemplateName() +
-         * " on image store " + storeId; s_logger.info(description); }
-         */
+        for (Long uniqueName : volumeInfos.keySet()) {
+            TemplateProp tInfo = volumeInfos.get(uniqueName);
+
+            //we cannot directly call expungeVolumeAsync here to
+            // reuse delete logic since in this case, our db does not have
+            // this template at all.
+            VolumeObjectTO tmplTO = new VolumeObjectTO();
+            tmplTO.setDataStore(store.getTO());
+            tmplTO.setPath(tInfo.getInstallPath());
+            tmplTO.setId(tInfo.getId());
+            DeleteCommand dtCommand = new DeleteCommand(tmplTO);
+            EndPoint ep = _epSelector.select(store);
+            Answer answer = ep.sendMessage(dtCommand);
+            if (answer == null || !answer.getResult()) {
+                s_logger.info("Failed to deleted volume at store: " + store.getName());
 
+            } else {
+                String description = "Deleted volume " + tInfo.getTemplateName() + " on secondary storage " + storeId;
+                s_logger.info(description);
+            }
+        }
     }
 
     private Map<Long, TemplateProp> listVolume(DataStore store) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cc0de880/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
index e77b285..4f90c44 100755
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
@@ -91,9 +91,6 @@ import com.cloud.agent.api.CreatePrivateTemplateFromVolumeCommand;
 import com.cloud.agent.api.CreateStoragePoolCommand;
 import com.cloud.agent.api.CreateVolumeFromSnapshotAnswer;
 import com.cloud.agent.api.CreateVolumeFromSnapshotCommand;
-import com.cloud.agent.api.DeleteSnapshotBackupAnswer;
-import com.cloud.agent.api.DeleteSnapshotBackupCommand;
-import com.cloud.agent.api.DeleteSnapshotsDirCommand;
 import com.cloud.agent.api.DeleteStoragePoolCommand;
 import com.cloud.agent.api.FenceAnswer;
 import com.cloud.agent.api.FenceCommand;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cc0de880/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockStorageManager.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockStorageManager.java b/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockStorageManager.java
index 810f330..80a6055 100644
--- a/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockStorageManager.java
+++ b/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockStorageManager.java
@@ -16,6 +16,7 @@
 // under the License.
 package com.cloud.agent.manager;
 
+import org.apache.cloudstack.storage.command.DeleteCommand;
 import org.apache.cloudstack.storage.command.DownloadCommand;
 import org.apache.cloudstack.storage.command.DownloadProgressCommand;
 
@@ -29,7 +30,6 @@ import com.cloud.agent.api.CreatePrivateTemplateFromSnapshotCommand;
 import com.cloud.agent.api.CreatePrivateTemplateFromVolumeCommand;
 import com.cloud.agent.api.CreateStoragePoolCommand;
 import com.cloud.agent.api.CreateVolumeFromSnapshotCommand;
-import com.cloud.agent.api.DeleteSnapshotBackupCommand;
 import com.cloud.agent.api.DeleteStoragePoolCommand;
 import com.cloud.agent.api.GetStorageStatsAnswer;
 import com.cloud.agent.api.GetStorageStatsCommand;
@@ -42,7 +42,6 @@ import com.cloud.agent.api.storage.CopyVolumeAnswer;
 import com.cloud.agent.api.storage.CopyVolumeCommand;
 import com.cloud.agent.api.storage.CreateAnswer;
 import com.cloud.agent.api.storage.CreateCommand;
-import com.cloud.agent.api.storage.DeleteTemplateCommand;
 import com.cloud.agent.api.storage.DestroyCommand;
 import com.cloud.agent.api.storage.ListTemplateCommand;
 import com.cloud.agent.api.storage.ListVolumeCommand;
@@ -73,9 +72,10 @@ public interface MockStorageManager extends Manager {
 	public GetStorageStatsAnswer GetStorageStats(GetStorageStatsCommand cmd);
 	public Answer ManageSnapshot(ManageSnapshotCommand cmd);
 	public Answer BackupSnapshot(BackupSnapshotCommand cmd, SimulatorInfo info);
-	public Answer DeleteSnapshotBackup(DeleteSnapshotBackupCommand cmd);
+	//public Answer DeleteSnapshotBackup(DeleteSnapshotBackupCommand cmd);
 	public Answer CreateVolumeFromSnapshot(CreateVolumeFromSnapshotCommand cmd);
-	public Answer DeleteTemplate(DeleteTemplateCommand cmd);
+	//public Answer DeleteTemplate(DeleteTemplateCommand cmd);
+	public Answer Delete(DeleteCommand cmd);
 	public Answer SecStorageVMSetup(SecStorageVMSetupCommand cmd);
 
 	public void preinstallTemplates(String url, long zoneId);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cc0de880/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockStorageManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockStorageManagerImpl.java b/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockStorageManagerImpl.java
index a0897b8..1fc1d79 100644
--- a/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockStorageManagerImpl.java
+++ b/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockStorageManagerImpl.java
@@ -28,7 +28,6 @@ import com.cloud.agent.api.CreatePrivateTemplateFromVolumeCommand;
 import com.cloud.agent.api.CreateStoragePoolCommand;
 import com.cloud.agent.api.CreateVolumeFromSnapshotAnswer;
 import com.cloud.agent.api.CreateVolumeFromSnapshotCommand;
-import com.cloud.agent.api.DeleteSnapshotBackupCommand;
 import com.cloud.agent.api.DeleteStoragePoolCommand;
 import com.cloud.agent.api.GetStorageStatsAnswer;
 import com.cloud.agent.api.GetStorageStatsCommand;
@@ -45,7 +44,6 @@ import com.cloud.agent.api.storage.CopyVolumeCommand;
 import com.cloud.agent.api.storage.CreateAnswer;
 import com.cloud.agent.api.storage.CreateCommand;
 import com.cloud.agent.api.storage.CreatePrivateTemplateAnswer;
-import com.cloud.agent.api.storage.DeleteTemplateCommand;
 import com.cloud.agent.api.storage.DestroyCommand;
 import com.cloud.agent.api.storage.DownloadAnswer;
 import com.cloud.agent.api.storage.ListTemplateAnswer;
@@ -54,7 +52,9 @@ import com.cloud.agent.api.storage.ListVolumeAnswer;
 import com.cloud.agent.api.storage.ListVolumeCommand;
 import com.cloud.agent.api.storage.PrimaryStorageDownloadAnswer;
 import com.cloud.agent.api.storage.PrimaryStorageDownloadCommand;
+import com.cloud.agent.api.to.DataObjectType;
 import com.cloud.agent.api.to.DataStoreTO;
+import com.cloud.agent.api.to.DataTO;
 import com.cloud.agent.api.to.StorageFilerTO;
 import com.cloud.agent.api.to.VolumeTO;
 import com.cloud.simulator.MockHost;
@@ -80,6 +80,7 @@ import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.vm.DiskProfile;
 import com.cloud.vm.VirtualMachine.State;
 
+import org.apache.cloudstack.storage.command.DeleteCommand;
 import org.apache.cloudstack.storage.command.DownloadCommand;
 import org.apache.cloudstack.storage.command.DownloadProgressCommand;
 import org.apache.log4j.Logger;
@@ -783,28 +784,6 @@ public class MockStorageManagerImpl extends ManagerBase implements MockStorageMa
     }
 
     @Override
-    public Answer DeleteSnapshotBackup(DeleteSnapshotBackupCommand cmd) {
-        Transaction txn = Transaction.open(Transaction.SIMULATOR_DB);
-        try {
-            txn.start();
-            MockVolumeVO backSnapshot = _mockVolumeDao.findByName(cmd.getSnapshotUuid());
-            if (backSnapshot == null) {
-                return new Answer(cmd, false, "can't find the backupsnapshot: " + cmd.getSnapshotUuid());
-            }
-            _mockVolumeDao.remove(backSnapshot.getId());
-            txn.commit();
-        } catch (Exception ex) {
-            txn.rollback();
-            throw new CloudRuntimeException("Error when deleting snapshot");
-        } finally {
-            txn.close();
-            txn = Transaction.open(Transaction.CLOUD_DB);
-            txn.close();
-        }
-        return new Answer(cmd);
-    }
-
-    @Override
     public CreateVolumeFromSnapshotAnswer CreateVolumeFromSnapshot(CreateVolumeFromSnapshotCommand cmd) {
         Transaction txn = Transaction.open(Transaction.SIMULATOR_DB);
         MockVolumeVO backSnapshot = null;
@@ -858,20 +837,21 @@ public class MockStorageManagerImpl extends ManagerBase implements MockStorageMa
         return new CreateVolumeFromSnapshotAnswer(cmd, true, null, volume.getPath());
     }
 
+
     @Override
-    public Answer DeleteTemplate(DeleteTemplateCommand cmd) {
+    public Answer Delete(DeleteCommand cmd) {
         Transaction txn = Transaction.open(Transaction.SIMULATOR_DB);
         try {
             txn.start();
-            MockVolumeVO template = _mockVolumeDao.findByStoragePathAndType(cmd.getTemplatePath());
+            MockVolumeVO template = _mockVolumeDao.findByStoragePathAndType(cmd.getData().getPath());
             if (template == null) {
-                return new Answer(cmd, false, "can't find template:" + cmd.getTemplatePath());
+                return new Answer(cmd, false, "can't find object to delete:" + cmd.getData().getPath());
             }
             _mockVolumeDao.remove(template.getId());
             txn.commit();
         } catch (Exception ex) {
             txn.rollback();
-            throw new CloudRuntimeException("Error when deleting template");
+            throw new CloudRuntimeException("Error when deleting object");
         } finally {
             txn.close();
             txn = Transaction.open(Transaction.CLOUD_DB);
@@ -880,6 +860,9 @@ public class MockStorageManagerImpl extends ManagerBase implements MockStorageMa
         return new Answer(cmd);
     }
 
+
+
+
     @Override
     public Answer SecStorageVMSetup(SecStorageVMSetupCommand cmd) {
         return new Answer(cmd);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cc0de880/plugins/hypervisors/simulator/src/com/cloud/agent/manager/SimulatorManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/simulator/src/com/cloud/agent/manager/SimulatorManagerImpl.java b/plugins/hypervisors/simulator/src/com/cloud/agent/manager/SimulatorManagerImpl.java
index 081aa5a..5ddf60a 100644
--- a/plugins/hypervisors/simulator/src/com/cloud/agent/manager/SimulatorManagerImpl.java
+++ b/plugins/hypervisors/simulator/src/com/cloud/agent/manager/SimulatorManagerImpl.java
@@ -26,6 +26,7 @@ import javax.naming.ConfigurationException;
 import org.apache.log4j.Logger;
 import org.springframework.stereotype.Component;
 
+import org.apache.cloudstack.storage.command.DeleteCommand;
 import org.apache.cloudstack.storage.command.DownloadCommand;
 import org.apache.cloudstack.storage.command.DownloadProgressCommand;
 
@@ -46,7 +47,6 @@ import com.cloud.agent.api.CreatePrivateTemplateFromSnapshotCommand;
 import com.cloud.agent.api.CreatePrivateTemplateFromVolumeCommand;
 import com.cloud.agent.api.CreateStoragePoolCommand;
 import com.cloud.agent.api.CreateVolumeFromSnapshotCommand;
-import com.cloud.agent.api.DeleteSnapshotBackupCommand;
 import com.cloud.agent.api.DeleteStoragePoolCommand;
 import com.cloud.agent.api.GetDomRVersionCmd;
 import com.cloud.agent.api.GetHostStatsCommand;
@@ -80,7 +80,6 @@ import com.cloud.agent.api.routing.SetStaticNatRulesCommand;
 import com.cloud.agent.api.routing.VmDataCommand;
 import com.cloud.agent.api.storage.CopyVolumeCommand;
 import com.cloud.agent.api.storage.CreateCommand;
-import com.cloud.agent.api.storage.DeleteTemplateCommand;
 import com.cloud.agent.api.storage.DestroyCommand;
 import com.cloud.agent.api.storage.ListTemplateCommand;
 import com.cloud.agent.api.storage.ListVolumeCommand;
@@ -279,12 +278,10 @@ public class SimulatorManagerImpl extends ManagerBase implements SimulatorManage
                 return _mockStorageMgr.ManageSnapshot((ManageSnapshotCommand)cmd);
             } else if (cmd instanceof BackupSnapshotCommand) {
                 return _mockStorageMgr.BackupSnapshot((BackupSnapshotCommand)cmd, info);
-            } else if (cmd instanceof DeleteSnapshotBackupCommand) {
-                return _mockStorageMgr.DeleteSnapshotBackup((DeleteSnapshotBackupCommand)cmd);
             } else if (cmd instanceof CreateVolumeFromSnapshotCommand) {
                 return _mockStorageMgr.CreateVolumeFromSnapshot((CreateVolumeFromSnapshotCommand)cmd);
-            } else if (cmd instanceof DeleteTemplateCommand) {
-                return _mockStorageMgr.DeleteTemplate((DeleteTemplateCommand)cmd);
+            } else if (cmd instanceof DeleteCommand) {
+                return _mockStorageMgr.Delete((DeleteCommand)cmd);
             } else if (cmd instanceof SecStorageVMSetupCommand) {
                 return _mockStorageMgr.SecStorageVMSetup((SecStorageVMSetupCommand)cmd);
             } else if (cmd instanceof CreatePrivateTemplateFromSnapshotCommand) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cc0de880/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 d5b3f23..1146179 100755
--- a/server/src/com/cloud/storage/StorageManagerImpl.java
+++ b/server/src/com/cloud/storage/StorageManagerImpl.java
@@ -65,8 +65,10 @@ import org.apache.cloudstack.engine.subsystem.api.storage.ImageStoreProvider;
 import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo;
 import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotDataFactory;
 import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator;
+import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo;
 import org.apache.cloudstack.engine.subsystem.api.storage.TemplateService;
 import org.apache.cloudstack.engine.subsystem.api.storage.VolumeDataFactory;
+import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
 import org.apache.cloudstack.engine.subsystem.api.storage.VolumeService;
 import org.apache.cloudstack.engine.subsystem.api.storage.VolumeService.VolumeApiResult;
 import org.apache.cloudstack.engine.subsystem.api.storage.ZoneScope;
@@ -90,10 +92,7 @@ import com.cloud.agent.AgentManager;
 import com.cloud.agent.api.Answer;
 import com.cloud.agent.api.Command;
 import com.cloud.agent.api.StoragePoolInfo;
-import com.cloud.agent.api.storage.DeleteTemplateCommand;
-import com.cloud.agent.api.storage.DeleteVolumeCommand;
 import com.cloud.agent.manager.Commands;
-import com.cloud.alert.AlertManager;
 import com.cloud.api.ApiDBUtils;
 import com.cloud.api.query.dao.TemplateJoinDao;
 import com.cloud.api.query.vo.TemplateJoinVO;
@@ -112,11 +111,8 @@ import com.cloud.dc.DataCenterVO;
 import com.cloud.dc.HostPodVO;
 import com.cloud.dc.dao.ClusterDao;
 import com.cloud.dc.dao.DataCenterDao;
-import com.cloud.dc.dao.HostPodDao;
 import com.cloud.deploy.DataCenterDeployment;
 import com.cloud.deploy.DeploymentPlanner.ExcludeList;
-import com.cloud.domain.dao.DomainDao;
-import com.cloud.event.dao.EventDao;
 import com.cloud.exception.AgentUnavailableException;
 import com.cloud.exception.ConnectionException;
 import com.cloud.exception.DiscoveryException;
@@ -133,39 +129,28 @@ import com.cloud.host.Status;
 import com.cloud.host.dao.HostDao;
 import com.cloud.hypervisor.Hypervisor.HypervisorType;
 import com.cloud.hypervisor.HypervisorGuruManager;
-import com.cloud.hypervisor.dao.HypervisorCapabilitiesDao;
 import com.cloud.org.Grouping;
 import com.cloud.org.Grouping.AllocationState;
 import com.cloud.resource.ResourceState;
 import com.cloud.server.ManagementServer;
 import com.cloud.server.StatsCollector;
-import com.cloud.service.dao.ServiceOfferingDao;
 import com.cloud.storage.Storage.ImageFormat;
 import com.cloud.storage.Storage.StoragePoolType;
 import com.cloud.storage.Volume.Type;
-import com.cloud.storage.dao.DiskOfferingDao;
 import com.cloud.storage.dao.SnapshotDao;
-import com.cloud.storage.dao.SnapshotPolicyDao;
 import com.cloud.storage.dao.StoragePoolHostDao;
 import com.cloud.storage.dao.StoragePoolWorkDao;
 import com.cloud.storage.dao.VMTemplateDao;
 import com.cloud.storage.dao.VMTemplatePoolDao;
-import com.cloud.storage.dao.VMTemplateS3Dao;
-import com.cloud.storage.dao.VMTemplateSwiftDao;
 import com.cloud.storage.dao.VMTemplateZoneDao;
 import com.cloud.storage.dao.VolumeDao;
 import com.cloud.storage.listener.StoragePoolMonitor;
 import com.cloud.storage.listener.VolumeStateListener;
-import com.cloud.storage.s3.S3Manager;
-import com.cloud.storage.secondary.SecondaryStorageVmManager;
-import com.cloud.storage.snapshot.SnapshotManager;
-import com.cloud.tags.dao.ResourceTagDao;
 import com.cloud.template.TemplateManager;
 import com.cloud.user.Account;
 import com.cloud.user.AccountManager;
 import com.cloud.user.User;
 import com.cloud.user.UserContext;
-import com.cloud.user.dao.AccountDao;
 import com.cloud.user.dao.UserDao;
 import com.cloud.utils.NumbersUtil;
 import com.cloud.utils.Pair;
@@ -184,13 +169,10 @@ import com.cloud.utils.db.SearchCriteria.Op;
 import com.cloud.utils.db.Transaction;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.vm.DiskProfile;
-import com.cloud.vm.UserVmManager;
 import com.cloud.vm.VMInstanceVO;
 import com.cloud.vm.VirtualMachine.State;
 import com.cloud.vm.VirtualMachineProfile;
 import com.cloud.vm.VirtualMachineProfileImpl;
-import com.cloud.vm.dao.ConsoleProxyDao;
-import com.cloud.vm.dao.UserVmDao;
 import com.cloud.vm.dao.VMInstanceDao;
 
 @Component
@@ -200,8 +182,6 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
 
     protected String _name;
     @Inject
-    protected UserVmManager _userVmMgr;
-    @Inject
     protected AgentManager _agentMgr;
     @Inject
     protected TemplateManager _tmpltMgr;
@@ -214,34 +194,16 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
     @Inject
     protected HostDao _hostDao;
     @Inject
-    protected ConsoleProxyDao _consoleProxyDao;
-    @Inject
     protected SnapshotDao _snapshotDao;
     @Inject
-    protected SnapshotManager _snapMgr;
-    @Inject
-    protected SnapshotPolicyDao _snapshotPolicyDao;
-    @Inject
     protected StoragePoolHostDao _storagePoolHostDao;
     @Inject
-    protected AlertManager _alertMgr;
-    @Inject
     protected VMTemplatePoolDao _vmTemplatePoolDao = null;
     @Inject
     protected VMTemplateZoneDao _vmTemplateZoneDao;
     @Inject
-    protected VMTemplateSwiftDao _vmTemplateSwiftDao = null;
-    @Inject
-    protected VMTemplateS3Dao _vmTemplateS3Dao;
-    @Inject
-    protected S3Manager _s3Mgr;
-    @Inject
     protected VMTemplateDao _vmTemplateDao = null;
     @Inject
-    protected StoragePoolHostDao _poolHostDao = null;
-    @Inject
-    protected UserVmDao _userVmDao;
-    @Inject
     protected VMInstanceDao _vmInstanceDao;
     @Inject
     protected PrimaryDataStoreDao _storagePoolDao = null;
@@ -262,22 +224,10 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
     @Inject
     protected CapacityManager _capacityMgr;
     @Inject
-    protected DiskOfferingDao _diskOfferingDao;
-    @Inject
-    protected AccountDao _accountDao;
-    @Inject
-    protected EventDao _eventDao = null;
-    @Inject
     protected DataCenterDao _dcDao = null;
     @Inject
-    protected HostPodDao _podDao = null;
-    @Inject
     protected VMTemplateDao _templateDao;
     @Inject
-    protected ServiceOfferingDao _offeringDao;
-    @Inject
-    protected DomainDao _domainDao;
-    @Inject
     protected UserDao _userDao;
     @Inject
     protected ClusterDao _clusterDao;
@@ -288,8 +238,6 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
     @Inject
     protected VolumeDao _volumeDao;
     @Inject
-    protected SecondaryStorageVmManager _ssvmMgr;
-    @Inject
     ConfigurationDao _configDao;
     @Inject
     ManagementServer _msServer;
@@ -306,13 +254,7 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
     @Inject
     SnapshotDataFactory snapshotFactory;
     @Inject
-    protected HypervisorCapabilitiesDao _hypervisorCapabilitiesDao;
-    @Inject
     ConfigurationServer _configServer;
-
-    @Inject
-    protected ResourceTagDao _resourceTagDao;
-
     @Inject
     DataStoreManager _dataStoreMgr;
     @Inject
@@ -514,7 +456,7 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
              * cmd
              */
         }
-        List<StoragePoolHostVO> poolHosts = _poolHostDao.listByHostStatus(poolVO.getId(), Status.Up);
+        List<StoragePoolHostVO> poolHosts = _storagePoolHostDao.listByHostStatus(poolVO.getId(), Status.Up);
         Collections.shuffle(poolHosts);
         if (poolHosts != null && poolHosts.size() > 0) {
             for (StoragePoolHostVO sphvo : poolHosts) {
@@ -1153,10 +1095,10 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
                         }
                         String installPath = destroyedTemplateStoreVO.getInstallPath();
 
+                        TemplateInfo tmpl = tmplFactory.getTemplate(destroyedTemplateStoreVO.getTemplateId(), store);
                         if (installPath != null) {
                             EndPoint ep = _epSelector.select(store);
-                            Command cmd = new DeleteTemplateCommand(store.getTO(), destroyedTemplateStoreVO.getInstallPath(),
-                                    destroyedTemplate.getId(), destroyedTemplate.getAccountId());
+                            Command cmd = new DeleteCommand(tmpl.getTO());
                             Answer answer = ep.sendMessage(cmd);
 
                             if (answer == null || !answer.getResult()) {
@@ -1230,10 +1172,11 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
 
                         String installPath = destroyedStoreVO.getInstallPath();
 
+                        VolumeInfo vol = this.volFactory.getVolume(destroyedStoreVO.getVolumeId(), store);
+
                         if (installPath != null) {
                             EndPoint ep = _epSelector.select(store);
-                            DeleteVolumeCommand cmd = new DeleteVolumeCommand(store.getTO(), destroyedStoreVO.getVolumeId(),
-                                    destroyedStoreVO.getInstallPath());
+                            DeleteCommand cmd = new DeleteCommand(vol.getTO());
                             Answer answer = ep.sendMessage(cmd);
                             if (answer == null || !answer.getResult()) {
                                 s_logger.debug("Failed to delete " + destroyedStoreVO + " due to "

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cc0de880/server/src/com/cloud/storage/swift/SwiftManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/swift/SwiftManagerImpl.java b/server/src/com/cloud/storage/swift/SwiftManagerImpl.java
index 75780b8..3149f5a 100644
--- a/server/src/com/cloud/storage/swift/SwiftManagerImpl.java
+++ b/server/src/com/cloud/storage/swift/SwiftManagerImpl.java
@@ -34,9 +34,11 @@ import org.springframework.stereotype.Component;
 
 import com.cloud.agent.AgentManager;
 import com.cloud.agent.api.Answer;
-import com.cloud.agent.api.storage.DeleteTemplateCommand;
 import com.cloud.agent.api.to.SwiftTO;
 import org.apache.cloudstack.api.command.admin.swift.AddSwiftCmd;
+import org.apache.cloudstack.storage.command.DeleteCommand;
+import org.apache.cloudstack.storage.to.TemplateObjectTO;
+
 import com.cloud.configuration.Config;
 import com.cloud.configuration.dao.ConfigurationDao;
 import com.cloud.dc.DataCenterVO;
@@ -144,7 +146,10 @@ public class SwiftManagerImpl extends ManagerBase implements SwiftManager {
            s_logger.warn(msg);
            throw new CloudRuntimeException(msg);
         }
-        Answer answer = _agentMgr.sendToSSVM(null, new DeleteTemplateCommand(swift, null, cmd.getId(), null));
+        TemplateObjectTO tmplTO = new TemplateObjectTO();
+        tmplTO.setDataStore(swift);
+        tmplTO.setId(cmd.getId());
+        Answer answer = _agentMgr.sendToSSVM(null, new DeleteCommand(tmplTO));
         if (answer == null || !answer.getResult()) {
             msg = "Failed to delete " + tmpltSwiftRef + " due to " + ((answer == null) ? "answer is null" : answer.getDetails());
             s_logger.warn(msg);
@@ -170,7 +175,9 @@ public class SwiftManagerImpl extends ManagerBase implements SwiftManager {
             s_logger.warn(msg);
             throw new CloudRuntimeException(msg);
         }
-        Answer answer = _agentMgr.sendToSSVM(null, new DeleteTemplateCommand(swift, null, cmd.getId(), null));
+        TemplateObjectTO tmplTO = new TemplateObjectTO();
+        tmplTO.setId(cmd.getId());
+        Answer answer = _agentMgr.sendToSSVM(null, new DeleteCommand(tmplTO));
         if (answer == null || !answer.getResult()) {
             msg = "Failed to delete " + tmpltSwiftRef + " due to " + ((answer == null) ? "answer is null" : answer.getDetails());
             s_logger.warn(msg);