Skip to content

Commit 04b5f53

Browse files
committed
Removed unused code handling for DeleteSnapshotBackupCommand since we
don't send that command anymore.
1 parent 83b080c commit 04b5f53

3 files changed

Lines changed: 2 additions & 71 deletions

File tree

engine/storage/integration-test/test/org/apache/cloudstack/storage/test/MockLocalHostEndPoint.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@
2020

2121
import org.apache.cloudstack.storage.LocalHostEndpoint;
2222
import org.apache.cloudstack.storage.command.CopyCommand;
23+
import org.apache.cloudstack.storage.command.DeleteCommand;
2324
import org.apache.cloudstack.storage.command.DownloadCommand;
2425

2526
import com.cloud.agent.api.Answer;
2627
import com.cloud.agent.api.Command;
27-
import com.cloud.agent.api.DeleteSnapshotBackupCommand;
2828

2929
public class MockLocalHostEndPoint extends LocalHostEndpoint {
3030
@Override
3131
public Answer sendMessage(Command cmd) {
3232
if ((cmd instanceof CopyCommand) || (cmd instanceof DownloadCommand)
33-
|| (cmd instanceof DeleteSnapshotBackupCommand)) {
33+
|| (cmd instanceof DeleteCommand)) {
3434
return resource.executeRequest(cmd);
3535
}
3636
// TODO Auto-generated method stub

plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2091,37 +2091,6 @@ protected BackupSnapshotAnswer execute(final BackupSnapshotCommand cmd) {
20912091
+ File.separator + snapshotName, true);
20922092
}
20932093

2094-
protected DeleteSnapshotBackupAnswer execute(
2095-
final DeleteSnapshotBackupCommand cmd) {
2096-
Long dcId = cmd.getDataCenterId();
2097-
Long accountId = cmd.getAccountId();
2098-
Long volumeId = cmd.getVolumeId();
2099-
KVMStoragePool secondaryStoragePool = null;
2100-
try {
2101-
secondaryStoragePool = _storagePoolMgr.getStoragePoolByURI(cmd
2102-
.getSecondaryStorageUrl());
2103-
2104-
String ssPmountPath = secondaryStoragePool.getLocalPath();
2105-
String snapshotDestPath = ssPmountPath + File.separator
2106-
+ "snapshots" + File.separator + dcId + File.separator
2107-
+ accountId + File.separator + volumeId;
2108-
2109-
final Script command = new Script(_manageSnapshotPath,
2110-
_cmdsTimeout, s_logger);
2111-
command.add("-d", snapshotDestPath);
2112-
command.add("-n", cmd.getSnapshotName());
2113-
2114-
command.execute();
2115-
} catch (CloudRuntimeException e) {
2116-
return new DeleteSnapshotBackupAnswer(cmd, false, e.toString());
2117-
} finally {
2118-
if (secondaryStoragePool != null) {
2119-
_storagePoolMgr.deleteStoragePool(secondaryStoragePool.getType(),secondaryStoragePool.getUuid());
2120-
}
2121-
}
2122-
return new DeleteSnapshotBackupAnswer(cmd, true, null);
2123-
}
2124-
21252094

21262095
protected CreateVolumeFromSnapshotAnswer execute(
21272096
final CreateVolumeFromSnapshotCommand cmd) {

services/secondary-storage/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@
6565
import com.cloud.agent.api.CheckHealthCommand;
6666
import com.cloud.agent.api.Command;
6767
import com.cloud.agent.api.ComputeChecksumCommand;
68-
import com.cloud.agent.api.DeleteSnapshotBackupCommand;
6968
import com.cloud.agent.api.DeleteSnapshotsDirCommand;
7069
import com.cloud.agent.api.DownloadSnapshotFromS3Command;
7170
import com.cloud.agent.api.DownloadSnapshotFromSwiftCommand;
@@ -197,8 +196,6 @@ public Answer executeRequest(Command cmd) {
197196
return execute((DownloadSnapshotFromSwiftCommand) cmd);
198197
} else if (cmd instanceof DownloadSnapshotFromS3Command) {
199198
return execute((DownloadSnapshotFromS3Command) cmd);
200-
} else if (cmd instanceof DeleteSnapshotBackupCommand) {
201-
return execute((DeleteSnapshotBackupCommand) cmd);
202199
} else if (cmd instanceof DeleteSnapshotsDirCommand) {
203200
return execute((DeleteSnapshotsDirCommand) cmd);
204201
} else if (cmd instanceof DownloadTemplateFromSwiftToSecondaryStorageCommand) {
@@ -1284,41 +1281,6 @@ protected Answer deleteSnapshot(final DeleteCommand cmd) {
12841281

12851282
}
12861283

1287-
protected Answer execute(final DeleteSnapshotBackupCommand cmd) {
1288-
Long accountId = cmd.getAccountId();
1289-
Long volumeId = cmd.getVolumeId();
1290-
String name = cmd.getSnapshotUuid();
1291-
DataStoreTO dstore = cmd.getDataStore();
1292-
if (dstore instanceof NfsTO) {
1293-
final String result = deleteSnapshotBackupFromLocalFileSystem(((NfsTO) dstore).getUrl(), accountId, volumeId, name, cmd.isAll());
1294-
if (result != null) {
1295-
s_logger.warn(result);
1296-
return new Answer(cmd, false, result);
1297-
}
1298-
} else if (dstore instanceof S3TO) {
1299-
final String result = deleteSnapshotBackupfromS3((S3TO) dstore, accountId, volumeId, name, cmd.isAll());
1300-
if (result != null) {
1301-
s_logger.warn(result);
1302-
return new Answer(cmd, false, result);
1303-
}
1304-
} else if (dstore instanceof SwiftTO) {
1305-
String filename;
1306-
if (cmd.isAll()) {
1307-
filename = "";
1308-
} else {
1309-
filename = name;
1310-
}
1311-
String result = swiftDelete((SwiftTO) dstore, "V-" + volumeId.toString(), filename);
1312-
if (result != null) {
1313-
String errMsg = "failed to delete snapshot " + filename + " , err=" + result;
1314-
s_logger.warn(errMsg);
1315-
return new Answer(cmd, false, errMsg);
1316-
}
1317-
} else {
1318-
return new Answer(cmd, false, "Unsupported image data store: " + dstore);
1319-
}
1320-
return new Answer(cmd, true, "success");
1321-
}
13221284

13231285
Map<String, TemplateProp> swiftListTemplate(SwiftTO swift) {
13241286
String[] containers = swiftList(swift, "", "");

0 commit comments

Comments
 (0)