diff --git a/core/src/com/cloud/alert/AlertAdapter.java b/api/src/com/cloud/alert/AlertAdapter.java similarity index 100% rename from core/src/com/cloud/alert/AlertAdapter.java rename to api/src/com/cloud/alert/AlertAdapter.java diff --git a/core/src/com/cloud/agent/api/downloadSnapshotFromSwiftCommand.java b/core/src/com/cloud/agent/api/DownloadSnapshotFromSwiftCommand.java similarity index 90% rename from core/src/com/cloud/agent/api/downloadSnapshotFromSwiftCommand.java rename to core/src/com/cloud/agent/api/DownloadSnapshotFromSwiftCommand.java index a2ae611d316..0711b2ef2d8 100644 --- a/core/src/com/cloud/agent/api/downloadSnapshotFromSwiftCommand.java +++ b/core/src/com/cloud/agent/api/DownloadSnapshotFromSwiftCommand.java @@ -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. */ -public class downloadSnapshotFromSwiftCommand extends SnapshotCommand { +public class DownloadSnapshotFromSwiftCommand extends SnapshotCommand { @LogLevel(Log4jLevel.Off) private SwiftTO _swift; 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); setParent(parent); diff --git a/core/src/com/cloud/agent/api/downloadTemplateFromSwiftToSecondaryStorageCommand.java b/core/src/com/cloud/agent/api/DownloadTemplateFromSwiftToSecondaryStorageCommand.java similarity index 91% rename from core/src/com/cloud/agent/api/downloadTemplateFromSwiftToSecondaryStorageCommand.java rename to core/src/com/cloud/agent/api/DownloadTemplateFromSwiftToSecondaryStorageCommand.java index 82290656095..79ec882c8d7 100644 --- a/core/src/com/cloud/agent/api/downloadTemplateFromSwiftToSecondaryStorageCommand.java +++ b/core/src/com/cloud/agent/api/DownloadTemplateFromSwiftToSecondaryStorageCommand.java @@ -24,7 +24,7 @@ import com.cloud.agent.api.to.SwiftTO; * */ -public class downloadTemplateFromSwiftToSecondaryStorageCommand extends Command { +public class DownloadTemplateFromSwiftToSecondaryStorageCommand extends Command { @LogLevel(Log4jLevel.Off) private SwiftTO swift; private String secondaryStorageUrl; @@ -34,11 +34,11 @@ public class downloadTemplateFromSwiftToSecondaryStorageCommand extends Command private Long templateId; 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.secondaryStorageUrl = secondaryStorageUrl; diff --git a/core/src/com/cloud/agent/api/uploadTemplateToSwiftFromSecondaryStorageCommand.java b/core/src/com/cloud/agent/api/UploadTemplateToSwiftFromSecondaryStorageCommand.java similarity index 91% rename from core/src/com/cloud/agent/api/uploadTemplateToSwiftFromSecondaryStorageCommand.java rename to core/src/com/cloud/agent/api/UploadTemplateToSwiftFromSecondaryStorageCommand.java index 10001b149fa..7ba377da8c3 100644 --- a/core/src/com/cloud/agent/api/uploadTemplateToSwiftFromSecondaryStorageCommand.java +++ b/core/src/com/cloud/agent/api/UploadTemplateToSwiftFromSecondaryStorageCommand.java @@ -24,7 +24,7 @@ import com.cloud.agent.api.to.SwiftTO; * */ -public class uploadTemplateToSwiftFromSecondaryStorageCommand extends Command { +public class UploadTemplateToSwiftFromSecondaryStorageCommand extends Command { @LogLevel(Log4jLevel.Off) private SwiftTO swift; private String secondaryStorageUrl; @@ -33,11 +33,11 @@ public class uploadTemplateToSwiftFromSecondaryStorageCommand extends Command { private Long accountId; 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.secondaryStorageUrl = secondaryStorageUrl; diff --git a/core/src/com/cloud/storage/SecondaryStorage.java b/core/src/com/cloud/storage/SecondaryStorage.java deleted file mode 100644 index dc01642767f..00000000000 --- a/core/src/com/cloud/storage/SecondaryStorage.java +++ /dev/null @@ -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(); -} diff --git a/core/src/com/cloud/storage/SecondaryStorageLayer.java b/core/src/com/cloud/storage/SecondaryStorageLayer.java deleted file mode 100644 index 539733d3531..00000000000 --- a/core/src/com/cloud/storage/SecondaryStorageLayer.java +++ /dev/null @@ -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); - -} diff --git a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java b/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java index 7dafe4ac865..26aae48ba38 100755 --- a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java +++ b/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java @@ -48,7 +48,7 @@ import com.cloud.agent.api.Command; import com.cloud.agent.api.DeleteSnapshotBackupCommand; import com.cloud.agent.api.DeleteSnapshotsDirCommand; 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.SwiftTO; import com.cloud.alert.AlertManager; @@ -384,7 +384,7 @@ public class SnapshotManagerImpl extends ManagerBase implements SnapshotManager, String parent = null; try { 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); if ((answer == null) || !answer.getResult()) { throw new CloudRuntimeException("downloadSnapshotsFromSwift failed "); diff --git a/server/src/com/cloud/template/TemplateManagerImpl.java b/server/src/com/cloud/template/TemplateManagerImpl.java index 8b5ee3aac1b..a8729e1490a 100755 --- a/server/src/com/cloud/template/TemplateManagerImpl.java +++ b/server/src/com/cloud/template/TemplateManagerImpl.java @@ -75,8 +75,8 @@ import com.cloud.agent.AgentManager; import com.cloud.agent.api.Answer; import com.cloud.agent.api.AttachIsoCommand; import com.cloud.agent.api.ComputeChecksumCommand; -import com.cloud.agent.api.downloadTemplateFromSwiftToSecondaryStorageCommand; -import com.cloud.agent.api.uploadTemplateToSwiftFromSecondaryStorageCommand; +import com.cloud.agent.api.DownloadTemplateFromSwiftToSecondaryStorageCommand; +import com.cloud.agent.api.UploadTemplateToSwiftFromSecondaryStorageCommand; import com.cloud.agent.api.storage.DestroyCommand; import com.cloud.agent.api.storage.PrimaryStorageDownloadAnswer; import com.cloud.agent.api.storage.PrimaryStorageDownloadCommand; @@ -579,7 +579,7 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager, 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); try { Answer answer = _agentMgr.sendToSSVM(dcId, cmd); @@ -628,7 +628,7 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager, 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); Answer answer = null; try { diff --git a/services/secondary-storage/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java b/services/secondary-storage/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java index 638d5cad99d..e7fa5b2f1bc 100755 --- a/services/secondary-storage/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java +++ b/services/secondary-storage/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java @@ -80,9 +80,9 @@ import com.cloud.agent.api.SecStorageVMSetupCommand; import com.cloud.agent.api.StartupCommand; import com.cloud.agent.api.StartupSecondaryStorageCommand; import com.cloud.agent.api.UploadTemplateToS3FromSecondaryStorageCommand; -import com.cloud.agent.api.downloadSnapshotFromSwiftCommand; -import com.cloud.agent.api.downloadTemplateFromSwiftToSecondaryStorageCommand; -import com.cloud.agent.api.uploadTemplateToSwiftFromSecondaryStorageCommand; +import com.cloud.agent.api.DownloadSnapshotFromSwiftCommand; +import com.cloud.agent.api.DownloadTemplateFromSwiftToSecondaryStorageCommand; +import com.cloud.agent.api.UploadTemplateToSwiftFromSecondaryStorageCommand; import com.cloud.agent.api.storage.CreateEntityDownloadURLCommand; import com.cloud.agent.api.storage.DeleteEntityDownloadURLCommand; import com.cloud.agent.api.storage.DeleteTemplateCommand; @@ -190,20 +190,20 @@ SecondaryStorageResource { return execute((ListTemplateCommand)cmd); } else if (cmd instanceof ListVolumeCommand){ return execute((ListVolumeCommand)cmd); - }else if (cmd instanceof downloadSnapshotFromSwiftCommand){ - return execute((downloadSnapshotFromSwiftCommand)cmd); + }else if (cmd instanceof DownloadSnapshotFromSwiftCommand){ + return execute((DownloadSnapshotFromSwiftCommand)cmd); } else if (cmd instanceof DownloadSnapshotFromS3Command) { return execute((DownloadSnapshotFromS3Command) cmd); } else if (cmd instanceof DeleteSnapshotBackupCommand){ return execute((DeleteSnapshotBackupCommand)cmd); } else if (cmd instanceof DeleteSnapshotsDirCommand){ return execute((DeleteSnapshotsDirCommand)cmd); - } else if (cmd instanceof downloadTemplateFromSwiftToSecondaryStorageCommand) { - return execute((downloadTemplateFromSwiftToSecondaryStorageCommand) cmd); + } else if (cmd instanceof DownloadTemplateFromSwiftToSecondaryStorageCommand) { + return execute((DownloadTemplateFromSwiftToSecondaryStorageCommand) cmd); } else if (cmd instanceof DownloadTemplateFromS3ToSecondaryStorageCommand) { return execute((DownloadTemplateFromS3ToSecondaryStorageCommand) cmd); - } else if (cmd instanceof uploadTemplateToSwiftFromSecondaryStorageCommand) { - return execute((uploadTemplateToSwiftFromSecondaryStorageCommand) cmd); + } else if (cmd instanceof UploadTemplateToSwiftFromSecondaryStorageCommand) { + return execute((UploadTemplateToSwiftFromSecondaryStorageCommand) cmd); } else if (cmd instanceof UploadTemplateToS3FromSecondaryStorageCommand) { return execute((UploadTemplateToS3FromSecondaryStorageCommand) cmd); } else if (cmd instanceof DeleteObjectFromSwiftCommand) { @@ -281,7 +281,7 @@ SecondaryStorageResource { } - private Answer execute(downloadTemplateFromSwiftToSecondaryStorageCommand cmd) { + private Answer execute(DownloadTemplateFromSwiftToSecondaryStorageCommand cmd) { SwiftTO swift = cmd.getSwift(); String secondaryStorageUrl = cmd.getSecondaryStorageUrl(); Long accountId = cmd.getAccountId(); @@ -324,7 +324,7 @@ SecondaryStorageResource { } } - private Answer execute(uploadTemplateToSwiftFromSecondaryStorageCommand cmd) { + private Answer execute(UploadTemplateToSwiftFromSecondaryStorageCommand cmd) { SwiftTO swift = cmd.getSwift(); String secondaryStorageUrl = cmd.getSecondaryStorageUrl(); Long accountId = cmd.getAccountId(); @@ -769,7 +769,7 @@ SecondaryStorageResource { SNAPSHOT_ROOT_DIR, accountId, volumeId); } - public Answer execute(downloadSnapshotFromSwiftCommand cmd){ + public Answer execute(DownloadSnapshotFromSwiftCommand cmd){ SwiftTO swift = cmd.getSwift(); String secondaryStorageUrl = cmd.getSecondaryStorageUrl(); Long accountId = cmd.getAccountId();