Removed files that are no longer used and further separated out the files in the core project

This commit is contained in:
Alex Huang 2013-05-01 15:15:57 -07:00
parent ad2777c547
commit f6913b5088
9 changed files with 27 additions and 96 deletions

View File

@ -22,17 +22,17 @@ import com.cloud.agent.api.to.SwiftTO;
/** /**
* This currently assumes that both primary and secondary storage are mounted on the XenServer. * This currently assumes that both primary and secondary storage are mounted on the XenServer.
*/ */
public class downloadSnapshotFromSwiftCommand extends SnapshotCommand { public class DownloadSnapshotFromSwiftCommand extends SnapshotCommand {
@LogLevel(Log4jLevel.Off) @LogLevel(Log4jLevel.Off)
private SwiftTO _swift; private SwiftTO _swift;
private String _parent; private String _parent;
protected downloadSnapshotFromSwiftCommand() { protected DownloadSnapshotFromSwiftCommand() {
} }
public downloadSnapshotFromSwiftCommand(SwiftTO swift, String secondaryStorageUrl, Long dcId, Long accountId, Long volumeId, String parent, String BackupUuid, int wait) { public DownloadSnapshotFromSwiftCommand(SwiftTO swift, String secondaryStorageUrl, Long dcId, Long accountId, Long volumeId, String parent, String BackupUuid, int wait) {
super(null, secondaryStorageUrl, BackupUuid, "", dcId, accountId, volumeId); super(null, secondaryStorageUrl, BackupUuid, "", dcId, accountId, volumeId);
setParent(parent); setParent(parent);

View File

@ -24,7 +24,7 @@ import com.cloud.agent.api.to.SwiftTO;
* *
*/ */
public class downloadTemplateFromSwiftToSecondaryStorageCommand extends Command { public class DownloadTemplateFromSwiftToSecondaryStorageCommand extends Command {
@LogLevel(Log4jLevel.Off) @LogLevel(Log4jLevel.Off)
private SwiftTO swift; private SwiftTO swift;
private String secondaryStorageUrl; private String secondaryStorageUrl;
@ -34,11 +34,11 @@ public class downloadTemplateFromSwiftToSecondaryStorageCommand extends Command
private Long templateId; private Long templateId;
private String path; private String path;
protected downloadTemplateFromSwiftToSecondaryStorageCommand() { protected DownloadTemplateFromSwiftToSecondaryStorageCommand() {
} }
public downloadTemplateFromSwiftToSecondaryStorageCommand(SwiftTO swift, String secondaryStorageUrl, Long dcId, Long accountId, Long templateId, String path, int wait) { public DownloadTemplateFromSwiftToSecondaryStorageCommand(SwiftTO swift, String secondaryStorageUrl, Long dcId, Long accountId, Long templateId, String path, int wait) {
this.swift = swift; this.swift = swift;
this.secondaryStorageUrl = secondaryStorageUrl; this.secondaryStorageUrl = secondaryStorageUrl;

View File

@ -24,7 +24,7 @@ import com.cloud.agent.api.to.SwiftTO;
* *
*/ */
public class uploadTemplateToSwiftFromSecondaryStorageCommand extends Command { public class UploadTemplateToSwiftFromSecondaryStorageCommand extends Command {
@LogLevel(Log4jLevel.Off) @LogLevel(Log4jLevel.Off)
private SwiftTO swift; private SwiftTO swift;
private String secondaryStorageUrl; private String secondaryStorageUrl;
@ -33,11 +33,11 @@ public class uploadTemplateToSwiftFromSecondaryStorageCommand extends Command {
private Long accountId; private Long accountId;
private Long templateId; private Long templateId;
protected uploadTemplateToSwiftFromSecondaryStorageCommand() { protected UploadTemplateToSwiftFromSecondaryStorageCommand() {
} }
public uploadTemplateToSwiftFromSecondaryStorageCommand(SwiftTO swift, String secondaryStorageUrl, Long dcId, Long accountId, Long templateId, int wait) { public UploadTemplateToSwiftFromSecondaryStorageCommand(SwiftTO swift, String secondaryStorageUrl, Long dcId, Long accountId, Long templateId, int wait) {
this.swift = swift; this.swift = swift;
this.secondaryStorageUrl = secondaryStorageUrl; this.secondaryStorageUrl = secondaryStorageUrl;

View File

@ -1,30 +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.storage;
public interface SecondaryStorage {
String getBackupPath();
String getTemplatePath();
String getIsoPath();
void createTemplate();
void destroyTemplate();
}

View File

@ -1,39 +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.storage;
import java.net.URI;
import com.cloud.storage.Storage.ImageFormat;
import com.cloud.utils.component.Adapter;
public interface SecondaryStorageLayer extends Adapter {
/**
* Mounts a template
*
* @param poolId the pool to mount it to.
* @param poolUuid the pool's uuid if it is needed.
* @param name unique name to the template.
* @param url url to access the template.
* @param format format of the template.
* @param accountId account id the template belongs to.
* @return a String that unique identifies the reference the template once it is mounted.
*/
String mountTemplate(long poolId, String poolUuid, String name, URI url, ImageFormat format, long accountId);
}

View File

@ -48,7 +48,7 @@ import com.cloud.agent.api.Command;
import com.cloud.agent.api.DeleteSnapshotBackupCommand; import com.cloud.agent.api.DeleteSnapshotBackupCommand;
import com.cloud.agent.api.DeleteSnapshotsDirCommand; import com.cloud.agent.api.DeleteSnapshotsDirCommand;
import com.cloud.agent.api.DownloadSnapshotFromS3Command; import com.cloud.agent.api.DownloadSnapshotFromS3Command;
import com.cloud.agent.api.downloadSnapshotFromSwiftCommand; import com.cloud.agent.api.DownloadSnapshotFromSwiftCommand;
import com.cloud.agent.api.to.S3TO; import com.cloud.agent.api.to.S3TO;
import com.cloud.agent.api.to.SwiftTO; import com.cloud.agent.api.to.SwiftTO;
import com.cloud.alert.AlertManager; import com.cloud.alert.AlertManager;
@ -384,7 +384,7 @@ public class SnapshotManagerImpl extends ManagerBase implements SnapshotManager,
String parent = null; String parent = null;
try { try {
for (String backupUuid : BackupUuids) { for (String backupUuid : BackupUuids) {
downloadSnapshotFromSwiftCommand cmd = new downloadSnapshotFromSwiftCommand(swift, secondaryStoragePoolUrl, dcId, accountId, volumeId, parent, backupUuid, _backupsnapshotwait); DownloadSnapshotFromSwiftCommand cmd = new DownloadSnapshotFromSwiftCommand(swift, secondaryStoragePoolUrl, dcId, accountId, volumeId, parent, backupUuid, _backupsnapshotwait);
Answer answer = _agentMgr.sendToSSVM(dcId, cmd); Answer answer = _agentMgr.sendToSSVM(dcId, cmd);
if ((answer == null) || !answer.getResult()) { if ((answer == null) || !answer.getResult()) {
throw new CloudRuntimeException("downloadSnapshotsFromSwift failed "); throw new CloudRuntimeException("downloadSnapshotsFromSwift failed ");

View File

@ -75,8 +75,8 @@ import com.cloud.agent.AgentManager;
import com.cloud.agent.api.Answer; import com.cloud.agent.api.Answer;
import com.cloud.agent.api.AttachIsoCommand; import com.cloud.agent.api.AttachIsoCommand;
import com.cloud.agent.api.ComputeChecksumCommand; import com.cloud.agent.api.ComputeChecksumCommand;
import com.cloud.agent.api.downloadTemplateFromSwiftToSecondaryStorageCommand; import com.cloud.agent.api.DownloadTemplateFromSwiftToSecondaryStorageCommand;
import com.cloud.agent.api.uploadTemplateToSwiftFromSecondaryStorageCommand; import com.cloud.agent.api.UploadTemplateToSwiftFromSecondaryStorageCommand;
import com.cloud.agent.api.storage.DestroyCommand; import com.cloud.agent.api.storage.DestroyCommand;
import com.cloud.agent.api.storage.PrimaryStorageDownloadAnswer; import com.cloud.agent.api.storage.PrimaryStorageDownloadAnswer;
import com.cloud.agent.api.storage.PrimaryStorageDownloadCommand; import com.cloud.agent.api.storage.PrimaryStorageDownloadCommand;
@ -579,7 +579,7 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
return errMsg; return errMsg;
} }
downloadTemplateFromSwiftToSecondaryStorageCommand cmd = new downloadTemplateFromSwiftToSecondaryStorageCommand(swift, secHost.getName(), dcId, template.getAccountId(), templateId, DownloadTemplateFromSwiftToSecondaryStorageCommand cmd = new DownloadTemplateFromSwiftToSecondaryStorageCommand(swift, secHost.getName(), dcId, template.getAccountId(), templateId,
tmpltSwift.getPath(), _primaryStorageDownloadWait); tmpltSwift.getPath(), _primaryStorageDownloadWait);
try { try {
Answer answer = _agentMgr.sendToSSVM(dcId, cmd); Answer answer = _agentMgr.sendToSSVM(dcId, cmd);
@ -628,7 +628,7 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
return errMsg; return errMsg;
} }
uploadTemplateToSwiftFromSecondaryStorageCommand cmd = new uploadTemplateToSwiftFromSecondaryStorageCommand(swift, secHost.getName(), secHost.getDataCenterId(), template.getAccountId(), UploadTemplateToSwiftFromSecondaryStorageCommand cmd = new UploadTemplateToSwiftFromSecondaryStorageCommand(swift, secHost.getName(), secHost.getDataCenterId(), template.getAccountId(),
templateId, _primaryStorageDownloadWait); templateId, _primaryStorageDownloadWait);
Answer answer = null; Answer answer = null;
try { try {

View File

@ -80,9 +80,9 @@ import com.cloud.agent.api.SecStorageVMSetupCommand;
import com.cloud.agent.api.StartupCommand; import com.cloud.agent.api.StartupCommand;
import com.cloud.agent.api.StartupSecondaryStorageCommand; import com.cloud.agent.api.StartupSecondaryStorageCommand;
import com.cloud.agent.api.UploadTemplateToS3FromSecondaryStorageCommand; import com.cloud.agent.api.UploadTemplateToS3FromSecondaryStorageCommand;
import com.cloud.agent.api.downloadSnapshotFromSwiftCommand; import com.cloud.agent.api.DownloadSnapshotFromSwiftCommand;
import com.cloud.agent.api.downloadTemplateFromSwiftToSecondaryStorageCommand; import com.cloud.agent.api.DownloadTemplateFromSwiftToSecondaryStorageCommand;
import com.cloud.agent.api.uploadTemplateToSwiftFromSecondaryStorageCommand; import com.cloud.agent.api.UploadTemplateToSwiftFromSecondaryStorageCommand;
import com.cloud.agent.api.storage.CreateEntityDownloadURLCommand; import com.cloud.agent.api.storage.CreateEntityDownloadURLCommand;
import com.cloud.agent.api.storage.DeleteEntityDownloadURLCommand; import com.cloud.agent.api.storage.DeleteEntityDownloadURLCommand;
import com.cloud.agent.api.storage.DeleteTemplateCommand; import com.cloud.agent.api.storage.DeleteTemplateCommand;
@ -190,20 +190,20 @@ SecondaryStorageResource {
return execute((ListTemplateCommand)cmd); return execute((ListTemplateCommand)cmd);
} else if (cmd instanceof ListVolumeCommand){ } else if (cmd instanceof ListVolumeCommand){
return execute((ListVolumeCommand)cmd); return execute((ListVolumeCommand)cmd);
}else if (cmd instanceof downloadSnapshotFromSwiftCommand){ }else if (cmd instanceof DownloadSnapshotFromSwiftCommand){
return execute((downloadSnapshotFromSwiftCommand)cmd); return execute((DownloadSnapshotFromSwiftCommand)cmd);
} else if (cmd instanceof DownloadSnapshotFromS3Command) { } else if (cmd instanceof DownloadSnapshotFromS3Command) {
return execute((DownloadSnapshotFromS3Command) cmd); return execute((DownloadSnapshotFromS3Command) cmd);
} else if (cmd instanceof DeleteSnapshotBackupCommand){ } else if (cmd instanceof DeleteSnapshotBackupCommand){
return execute((DeleteSnapshotBackupCommand)cmd); return execute((DeleteSnapshotBackupCommand)cmd);
} else if (cmd instanceof DeleteSnapshotsDirCommand){ } else if (cmd instanceof DeleteSnapshotsDirCommand){
return execute((DeleteSnapshotsDirCommand)cmd); return execute((DeleteSnapshotsDirCommand)cmd);
} else if (cmd instanceof downloadTemplateFromSwiftToSecondaryStorageCommand) { } else if (cmd instanceof DownloadTemplateFromSwiftToSecondaryStorageCommand) {
return execute((downloadTemplateFromSwiftToSecondaryStorageCommand) cmd); return execute((DownloadTemplateFromSwiftToSecondaryStorageCommand) cmd);
} else if (cmd instanceof DownloadTemplateFromS3ToSecondaryStorageCommand) { } else if (cmd instanceof DownloadTemplateFromS3ToSecondaryStorageCommand) {
return execute((DownloadTemplateFromS3ToSecondaryStorageCommand) cmd); return execute((DownloadTemplateFromS3ToSecondaryStorageCommand) cmd);
} else if (cmd instanceof uploadTemplateToSwiftFromSecondaryStorageCommand) { } else if (cmd instanceof UploadTemplateToSwiftFromSecondaryStorageCommand) {
return execute((uploadTemplateToSwiftFromSecondaryStorageCommand) cmd); return execute((UploadTemplateToSwiftFromSecondaryStorageCommand) cmd);
} else if (cmd instanceof UploadTemplateToS3FromSecondaryStorageCommand) { } else if (cmd instanceof UploadTemplateToS3FromSecondaryStorageCommand) {
return execute((UploadTemplateToS3FromSecondaryStorageCommand) cmd); return execute((UploadTemplateToS3FromSecondaryStorageCommand) cmd);
} else if (cmd instanceof DeleteObjectFromSwiftCommand) { } else if (cmd instanceof DeleteObjectFromSwiftCommand) {
@ -281,7 +281,7 @@ SecondaryStorageResource {
} }
private Answer execute(downloadTemplateFromSwiftToSecondaryStorageCommand cmd) { private Answer execute(DownloadTemplateFromSwiftToSecondaryStorageCommand cmd) {
SwiftTO swift = cmd.getSwift(); SwiftTO swift = cmd.getSwift();
String secondaryStorageUrl = cmd.getSecondaryStorageUrl(); String secondaryStorageUrl = cmd.getSecondaryStorageUrl();
Long accountId = cmd.getAccountId(); Long accountId = cmd.getAccountId();
@ -324,7 +324,7 @@ SecondaryStorageResource {
} }
} }
private Answer execute(uploadTemplateToSwiftFromSecondaryStorageCommand cmd) { private Answer execute(UploadTemplateToSwiftFromSecondaryStorageCommand cmd) {
SwiftTO swift = cmd.getSwift(); SwiftTO swift = cmd.getSwift();
String secondaryStorageUrl = cmd.getSecondaryStorageUrl(); String secondaryStorageUrl = cmd.getSecondaryStorageUrl();
Long accountId = cmd.getAccountId(); Long accountId = cmd.getAccountId();
@ -769,7 +769,7 @@ SecondaryStorageResource {
SNAPSHOT_ROOT_DIR, accountId, volumeId); SNAPSHOT_ROOT_DIR, accountId, volumeId);
} }
public Answer execute(downloadSnapshotFromSwiftCommand cmd){ public Answer execute(DownloadSnapshotFromSwiftCommand cmd){
SwiftTO swift = cmd.getSwift(); SwiftTO swift = cmd.getSwift();
String secondaryStorageUrl = cmd.getSecondaryStorageUrl(); String secondaryStorageUrl = cmd.getSecondaryStorageUrl();
Long accountId = cmd.getAccountId(); Long accountId = cmd.getAccountId();