You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ah...@apache.org on 2012/11/05 18:23:42 UTC
[5/18] git commit: Added engine
Added engine
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/a6df8a5b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/a6df8a5b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/a6df8a5b
Branch: refs/heads/javelin
Commit: a6df8a5b44dc575c5ba58516b8f4ac588b7bd44c
Parents: 3dafea6
Author: Alex Huang <al...@citrix.com>
Authored: Mon Nov 5 09:14:14 2012 -0800
Committer: Alex Huang <al...@citrix.com>
Committed: Mon Nov 5 09:14:14 2012 -0800
----------------------------------------------------------------------
engine/api/pom.xml | 42 +
.../src/org/apache/cloudstack/platform/Rules.java | 85 ++
.../platform/cloud/entity/api/BackupEntity.java | 29 +
.../platform/cloud/entity/api/EdgeService.java | 23 +
.../platform/cloud/entity/api/NetworkEntity.java | 39 +
.../platform/cloud/entity/api/NicEntity.java | 29 +
.../platform/cloud/entity/api/SnapshotEntity.java | 49 +
.../platform/cloud/entity/api/TemplateEntity.java | 27 +
.../cloud/entity/api/VirtualMachineEntity.java | 148 +++
.../platform/cloud/entity/api/VolumeEntity.java | 74 ++
.../datacenter/entity/api/ClusterEntity.java | 25 +
.../entity/api/DataCenterResourceEntity.java | 83 ++
.../datacenter/entity/api/OrganizationScope.java | 23 +
.../platform/datacenter/entity/api/PodEntity.java | 30 +
.../datacenter/entity/api/StorageEntity.java | 24 +
.../platform/datacenter/entity/api/ZoneEntity.java | 30 +
.../platform/entity/api/CloudStackEntity.java | 96 ++
.../exception/InsufficientCapacityException.java | 24 +
.../platform/service/api/DirectoryService.java | 34 +
.../platform/service/api/EntityService.java | 45 +
.../platform/service/api/OperationsServices.java | 57 +
.../platform/service/api/OrchestrationService.java | 84 ++
.../platform/service/api/ProvisioningService.java | 65 +
.../subsystem/api/hypervisor/ComputeSubsystem.java | 31 +
.../api/network/NetworkServiceProvider.java | 47 +
.../subsystem/api/network/NetworkSubsystem.java | 35 +
.../subsystem/api/storage/BackupStrategy.java | 5 +
.../api/storage/DataMigrationSubSystem.java | 29 +
.../platform/subsystem/api/storage/DataObject.java | 42 +
.../DataObjectBackupStorageOperationState.java | 58 +
.../platform/subsystem/api/storage/DataStore.java | 76 ++
.../api/storage/DataStoreConfigurator.java | 16 +
.../subsystem/api/storage/DataStoreDriver.java | 35 +
.../subsystem/api/storage/DataStoreEndPoint.java | 26 +
.../api/storage/DataStoreEndPointSelector.java | 7 +
.../api/storage/DataStoreExtendedAttribute.java | 5 +
.../subsystem/api/storage/DataStoreLifeCycle.java | 13 +
.../platform/subsystem/api/storage/FileSystem.java | 32 +
.../platform/subsystem/api/storage/Snapshot.java | 23 +
.../subsystem/api/storage/SnapshotProfile.java | 26 +
.../subsystem/api/storage/SnapshotStrategy.java | 5 +
.../subsystem/api/storage/StorageEvent.java | 25 +
.../subsystem/api/storage/StorageProvider.java | 20 +
.../subsystem/api/storage/StorageSubSystem.java | 13 +
.../subsystem/api/storage/TemplateProfile.java | 287 +++++
.../subsystem/api/storage/TemplateStrategy.java | 13 +
.../subsystem/api/storage/VolumeProfile.java | 34 +
.../subsystem/api/storage/VolumeStrategy.java | 16 +
engine/components-api/pom.xml | 47 +
engine/compute/pom.xml | 52 +
.../cloudstack/compute/ComputeOrchestrator.java | 37 +
.../compute/ComputeOrchestratorImpl.java | 41 +
engine/network/pom.xml | 52 +
.../cloudstack/network/NetworkOrchestrator.java | 40 +
engine/orchestration/pom.xml | 52 +
.../platform/orchestration/CloudOrchestrator.java | 82 ++
.../cloudstack/platform/planning/Concierge.java | 36 +
engine/pom.xml | 44 +
engine/schema/pom.xml | 52 +
engine/storage/pom.xml | 85 ++
.../org/apache/cloudstack/storage/BaseType.java | 40 +
.../org/apache/cloudstack/storage/EndPoint.java | 8 +
.../cloudstack/storage/HypervisorHostEndPoint.java | 55 +
.../cloudstack/storage/StorageOrchestrator.java | 59 +
.../storage/StorageOrchestratorImpl.java | 315 +++++
.../cloudstack/storage/StorageProviderManager.java | 11 +
.../storage/StorageProviderManagerImpl.java | 55 +
.../apache/cloudstack/storage/VolumeBackupRef.java | 66 +
.../storage/backup/BackupMotionService.java | 23 +
.../cloudstack/storage/backup/BackupService.java | 24 +
.../storage/command/CreateVolumeAnswer.java | 36 +
.../storage/command/CreateVolumeCommand.java | 42 +
.../storage/datastore/DataStoreStatus.java | 29 +
.../storage/datastore/DefaultDataStore.java | 229 ++++
.../datastore/DefaultPrimaryDataStoreImpl.java | 118 ++
.../storage/datastore/PrimaryDataStore.java | 34 +
.../storage/datastore/PrimaryDataStoreInfo.java | 31 +
.../datastore/PrimaryDataStoreInfoImpl.java | 68 ++
.../storage/datastore/db/DataStoreVO.java | 258 ++++
.../storage/datastore/db/PrimaryDataStoreDao.java | 106 ++
.../datastore/db/PrimaryDataStoreDaoImpl.java | 377 ++++++
.../datastore/db/PrimaryDataStoreProviderDao.java | 25 +
.../db/PrimaryDataStoreProviderDaoImpl.java | 28 +
.../datastore/db/PrimaryDataStoreProviderVO.java | 38 +
.../driver/DefaultPrimaryDataStoreDriverImpl.java | 65 +
.../datastore/driver/PrimaryDataStoreDriver.java | 11 +
.../DefaultPrimaryDataStoreLifeCycleImpl.java | 70 ++
.../lifecycle/PrimaryDataStoreLifeCycle.java | 31 +
.../DefaultPrimaryDataStoreManagerImpl.java | 55 +
.../datastore/manager/PrimaryDataStoreManager.java | 27 +
.../DefaultPrimaryDatastoreProviderImpl.java | 44 +
.../provider/PrimaryDataStoreProvider.java | 9 +
.../provider/PrimaryDataStoreProviderManager.java | 5 +
.../PrimaryDataStoreProviderManagerImpl.java | 32 +
.../storage/datastore/type/DataStoreType.java | 23 +
.../cloudstack/storage/datastore/type/ISCSI.java | 31 +
.../storage/datastore/type/NetworkFileSystem.java | 31 +
.../storage/datastore/type/SharedMount.java | 29 +
.../storage/driver/AbstractStorageDriver.java | 76 ++
.../storage/driver/DefaultNfsSecondaryDriver.java | 90 ++
.../storage/driver/XenServerStorageDriver.java | 81 ++
.../cloudstack/storage/image/ImageManager.java | 32 +
.../cloudstack/storage/image/ImageManagerImpl.java | 167 +++
.../storage/image/ImageMotionService.java | 24 +
.../storage/image/ImageOrchestrator.java | 26 +
.../storage/image/ImageOrchestratorImpl.java | 78 ++
.../cloudstack/storage/image/ImageService.java | 30 +
.../cloudstack/storage/image/ImageServiceImpl.java | 84 ++
.../apache/cloudstack/storage/image/Template.java | 36 +
.../storage/image/db/ImageDaoStoreDao.java | 25 +
.../storage/image/db/ImageDaoStoreDaoImpl.java | 25 +
.../cloudstack/storage/image/db/ImageDataDao.java | 71 ++
.../storage/image/db/ImageDataDaoImpl.java | 925 +++++++++++++++
.../image/db/ImageDataStoreProviderDao.java | 25 +
.../image/db/ImageDataStoreProviderDaoImpl.java | 26 +
.../storage/image/db/ImageDataStoreProviderVO.java | 23 +
.../storage/image/db/ImageDataStoreVO.java | 60 +
.../cloudstack/storage/image/db/ImageDataVO.java | 381 ++++++
.../storage/image/downloader/ImageDownloader.java | 25 +
.../storage/image/driver/ImageDataStoreDriver.java | 28 +
.../image/driver/ImageDataStoreDriverImpl.java | 51 +
.../cloudstack/storage/image/format/BAREMETAL.java | 31 +
.../cloudstack/storage/image/format/ISO.java | 31 +
.../storage/image/format/ImageFormat.java | 23 +
.../storage/image/format/ImageFormatHelper.java | 44 +
.../cloudstack/storage/image/format/OVA.java | 31 +
.../cloudstack/storage/image/format/QCOW2.java | 31 +
.../cloudstack/storage/image/format/Unknown.java | 32 +
.../cloudstack/storage/image/format/VHD.java | 29 +
.../image/manager/ImageDataStoreManager.java | 25 +
.../image/manager/ImageDataStoreManagerImpl.java | 41 +
.../image/provider/ImageDataStoreProvider.java | 25 +
.../provider/ImageDataStoreProviderManager.java | 23 +
.../ImageDataStoreProviderManagerImpl.java | 37 +
.../storage/image/store/ImageDataStore.java | 31 +
.../storage/image/store/ImageDataStoreImpl.java | 83 ++
.../lifecycle/DefaultNfsSecondaryLifeCycle.java | 54 +
.../DefaultPrimaryDataStoreLifeCycle.java | 123 ++
.../storage/manager/BackupStorageManager.java | 39 +
.../storage/manager/BackupStorageManagerImpl.java | 66 +
.../storage/manager/PrimaryDataStoreManager.java | 42 +
.../manager/PrimaryDataStoreManagerImpl.java | 142 +++
.../storage/manager/SecondaryStorageManager.java | 34 +
.../manager/SecondaryStorageManagerImpl.java | 56 +
.../DefaultNfsSecondaryStorageProvider.java | 131 ++
.../provider/DefaultPrimaryStorageProvider.java | 144 +++
.../storage/provider/HttpImageStoreProvider.java | 91 ++
.../provider/S3SecondaryStorageProvider.java | 91 ++
.../provider/SwiftSecondaryStorageProvider.java | 91 ++
.../storage/snapshot/SnapshotService.java | 24 +
.../storage/strategy/DefaultTemplateStratey.java | 191 +++
.../storage/strategy/DefaultVolumeStrategy.java | 90 ++
.../storage/strategy/XenBackupStrategy.java | 11 +
.../storage/strategy/XenSnapshotStrategy.java | 11 +
.../apache/cloudstack/storage/volume/Volume.java | 101 ++
.../cloudstack/storage/volume/VolumeEvent.java | 34 +
.../cloudstack/storage/volume/VolumeInfo.java | 76 ++
.../cloudstack/storage/volume/VolumeManager.java | 33 +
.../storage/volume/VolumeManagerImpl.java | 70 ++
.../storage/volume/VolumeMotionService.java | 23 +
.../cloudstack/storage/volume/VolumeService.java | 67 ++
.../storage/volume/VolumeServiceImpl.java | 79 ++
.../cloudstack/storage/volume/VolumeState.java | 73 ++
.../cloudstack/storage/volume/db/VolumeDao.java | 82 ++
.../storage/volume/db/VolumeDaoImpl.java | 427 +++++++
.../cloudstack/storage/volume/db/VolumeVO.java | 425 +++++++
.../cloudstack/storage/volume/disktype/QCOW2.java | 10 +
.../storage/volume/disktype/Unknown.java | 7 +
.../cloudstack/storage/volume/disktype/VHD.java | 10 +
.../cloudstack/storage/volume/disktype/VMDK.java | 10 +
.../storage/volume/disktype/VolumeDiskType.java | 4 +
.../volume/disktype/VolumeDiskTypeBase.java | 34 +
.../volume/disktype/VolumeDiskTypeHelper.java | 29 +
.../cloudstack/storage/volume/type/DataDisk.java | 10 +
.../apache/cloudstack/storage/volume/type/Iso.java | 10 +
.../cloudstack/storage/volume/type/RootDisk.java | 10 +
.../cloudstack/storage/volume/type/Unknown.java | 8 +
.../cloudstack/storage/volume/type/VolumeType.java | 22 +
.../storage/volume/type/VolumeTypeBase.java | 31 +
.../storage/volume/type/VolumeTypeHelper.java | 28 +
.../apache/cloudstack/storage/test/AllTests.java | 29 +
.../apache/cloudstack/storage/test/AopTest.java | 14 +
.../cloudstack/storage/test/AopTestAdvice.java | 20 +
.../storage/test/StorageFactoryBean.java | 42 +
.../cloudstack/storage/test/storageContext.xml | 67 ++
.../cloudstack/storage/test/volumeServiceTest.java | 128 ++
186 files changed, 11592 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/api/pom.xml
----------------------------------------------------------------------
diff --git a/engine/api/pom.xml b/engine/api/pom.xml
new file mode 100644
index 0000000..88b3b38
--- /dev/null
+++ b/engine/api/pom.xml
@@ -0,0 +1,42 @@
+<!--
+ 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>cloud-engine-api</artifactId>
+ <name>Apache CloudStack Cloud Engine API</name>
+ <parent>
+ <groupId>org.apache.cloudstack</groupId>
+ <artifactId>cloud-engine</artifactId>
+ <version>4.1.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.cloudstack</groupId>
+ <artifactId>cloud-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+ <build>
+ <defaultGoal>install</defaultGoal>
+ <sourceDirectory>src</sourceDirectory>
+ <testSourceDirectory>test</testSourceDirectory>
+ </build>
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/api/src/org/apache/cloudstack/platform/Rules.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/platform/Rules.java b/engine/api/src/org/apache/cloudstack/platform/Rules.java
new file mode 100755
index 0000000..61e0c3c
--- /dev/null
+++ b/engine/api/src/org/apache/cloudstack/platform/Rules.java
@@ -0,0 +1,85 @@
+/*
+ * 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 org.apache.cloudstack.platform;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.cloud.utils.StringUtils;
+
+/**
+ * Rules specifies all rules about developing and using CloudStack Orchestration
+ * Platforms APIs. This class is not actually used in CloudStack Orchestration
+ * Platform but must be read by all who wants to use and develop against
+ * CloudStack Orchestration Platform.
+ *
+ * Make sure to make changes here when there are changes to how the APIs should
+ * be used and developed.
+ *
+ * Changes to this class must be approved by the maintainer of this project.
+ *
+ */
+public class Rules {
+ public static List<String> whenUsing() {
+ List<String> rules = new ArrayList<String>();
+ rules.add("Always be prepared to handle RuntimeExceptions.");
+ return rules;
+ }
+
+ public static List<String> whenWritingNewApis() {
+ List<String> rules = new ArrayList<String>();
+ rules.add("You may think you're the greatest developer in the " +
+ "world but every change to the API must be reviewed and approved. ");
+ rules.add("Every API must have unit tests written against it. And not it's unit tests");
+ rules.add("");
+
+
+ return rules;
+ }
+
+ private static void printRule(String rule) {
+ System.out.print("API Rule: ");
+ String skip = "";
+ int brk = 0;
+ while (true) {
+ int stop = StringUtils.formatForOutput(rule, brk, 75 - skip.length(), ' ');
+ if (stop < 0) {
+ break;
+ }
+ System.out.print(skip);
+ skip = " ";
+ System.out.println(rule.substring(brk, stop).trim());
+ brk = stop;
+ }
+ }
+
+ public static void main(String[] args) {
+ System.out.println("When developing against the CloudStack Orchestration Platform, you must following the following rules:");
+ for (String rule : whenUsing()) {
+ printRule(rule);
+ }
+ System.out.println("");
+ System.out.println("When writing APIs, you must follow these rules:");
+ for (String rule : whenWritingNewApis()) {
+ printRule(rule);
+ }
+ }
+
+}
+
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/api/src/org/apache/cloudstack/platform/cloud/entity/api/BackupEntity.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/platform/cloud/entity/api/BackupEntity.java b/engine/api/src/org/apache/cloudstack/platform/cloud/entity/api/BackupEntity.java
new file mode 100755
index 0000000..9bf39a8
--- /dev/null
+++ b/engine/api/src/org/apache/cloudstack/platform/cloud/entity/api/BackupEntity.java
@@ -0,0 +1,29 @@
+/*
+ * 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 org.apache.cloudstack.platform.cloud.entity.api;
+
+import org.apache.cloudstack.platform.entity.api.CloudStackEntity;
+
+/**
+ * @author ahuang
+ *
+ */
+public interface BackupEntity extends CloudStackEntity {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/api/src/org/apache/cloudstack/platform/cloud/entity/api/EdgeService.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/platform/cloud/entity/api/EdgeService.java b/engine/api/src/org/apache/cloudstack/platform/cloud/entity/api/EdgeService.java
new file mode 100755
index 0000000..8dceb74
--- /dev/null
+++ b/engine/api/src/org/apache/cloudstack/platform/cloud/entity/api/EdgeService.java
@@ -0,0 +1,23 @@
+/*
+ * 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 org.apache.cloudstack.platform.cloud.entity.api;
+
+public interface EdgeService {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/api/src/org/apache/cloudstack/platform/cloud/entity/api/NetworkEntity.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/platform/cloud/entity/api/NetworkEntity.java b/engine/api/src/org/apache/cloudstack/platform/cloud/entity/api/NetworkEntity.java
new file mode 100755
index 0000000..12d32a2
--- /dev/null
+++ b/engine/api/src/org/apache/cloudstack/platform/cloud/entity/api/NetworkEntity.java
@@ -0,0 +1,39 @@
+/*
+ * 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 org.apache.cloudstack.platform.cloud.entity.api;
+
+import java.util.List;
+
+import org.apache.cloudstack.platform.entity.api.CloudStackEntity;
+
+import com.cloud.network.Network;
+
+public interface NetworkEntity extends CloudStackEntity, Network {
+ void routeTo(NetworkEntity network);
+
+ List<EdgeService> listEdgeServicesTo();
+
+ List<String> listVirtualMachineUuids();
+
+ List<VirtualMachineEntity> listVirtualMachines();
+
+ List<NicEntity> listNics();
+
+ void addIpRange();
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/api/src/org/apache/cloudstack/platform/cloud/entity/api/NicEntity.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/platform/cloud/entity/api/NicEntity.java b/engine/api/src/org/apache/cloudstack/platform/cloud/entity/api/NicEntity.java
new file mode 100755
index 0000000..4da66cc
--- /dev/null
+++ b/engine/api/src/org/apache/cloudstack/platform/cloud/entity/api/NicEntity.java
@@ -0,0 +1,29 @@
+/*
+ * 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 org.apache.cloudstack.platform.cloud.entity.api;
+
+import org.apache.cloudstack.platform.entity.api.CloudStackEntity;
+
+/**
+ * @author ahuang
+ *
+ */
+public interface NicEntity extends CloudStackEntity {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/api/src/org/apache/cloudstack/platform/cloud/entity/api/SnapshotEntity.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/platform/cloud/entity/api/SnapshotEntity.java b/engine/api/src/org/apache/cloudstack/platform/cloud/entity/api/SnapshotEntity.java
new file mode 100755
index 0000000..efe9b1c
--- /dev/null
+++ b/engine/api/src/org/apache/cloudstack/platform/cloud/entity/api/SnapshotEntity.java
@@ -0,0 +1,49 @@
+/*
+ * 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 org.apache.cloudstack.platform.cloud.entity.api;
+
+import org.apache.cloudstack.platform.entity.api.CloudStackEntity;
+
+import com.cloud.storage.Snapshot;
+
+public interface SnapshotEntity extends CloudStackEntity, Snapshot {
+ /**
+ * Make a reservation for backing up this snapshot
+ * @param expiration time in seconds to expire the reservation
+ * @return reservation token
+ */
+ String reserveForBackup(int expiration);
+
+ /**
+ * Perform the backup according to the reservation token
+ * @param reservationToken token returned by reserveForBackup
+ */
+ void backup(String reservationToken);
+
+ /**
+ * restore this snapshot to this vm.
+ * @param vm
+ */
+ void restore(String vm);
+
+ /**
+ * Destroy this snapshot.
+ */
+ void destroy();
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/api/src/org/apache/cloudstack/platform/cloud/entity/api/TemplateEntity.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/platform/cloud/entity/api/TemplateEntity.java b/engine/api/src/org/apache/cloudstack/platform/cloud/entity/api/TemplateEntity.java
new file mode 100755
index 0000000..75623cc
--- /dev/null
+++ b/engine/api/src/org/apache/cloudstack/platform/cloud/entity/api/TemplateEntity.java
@@ -0,0 +1,27 @@
+/*
+ * 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 org.apache.cloudstack.platform.cloud.entity.api;
+
+import org.apache.cloudstack.platform.entity.api.CloudStackEntity;
+
+import com.cloud.template.VirtualMachineTemplate;
+
+public interface TemplateEntity extends CloudStackEntity, VirtualMachineTemplate {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/api/src/org/apache/cloudstack/platform/cloud/entity/api/VirtualMachineEntity.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/platform/cloud/entity/api/VirtualMachineEntity.java b/engine/api/src/org/apache/cloudstack/platform/cloud/entity/api/VirtualMachineEntity.java
new file mode 100755
index 0000000..0e1d3d9
--- /dev/null
+++ b/engine/api/src/org/apache/cloudstack/platform/cloud/entity/api/VirtualMachineEntity.java
@@ -0,0 +1,148 @@
+/*
+ * 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 org.apache.cloudstack.platform.cloud.entity.api;
+
+import java.util.List;
+
+import org.apache.cloudstack.platform.entity.api.CloudStackEntity;
+
+import com.cloud.deploy.DeployDestination;
+import com.cloud.deploy.DeploymentPlanner.ExcludeList;
+import com.cloud.vm.VirtualMachine;
+
+/**
+ * VirtualMachineEntity represents a Virtual Machine in Cloud Orchestration
+ * Platform.
+ *
+ */
+public interface VirtualMachineEntity extends VirtualMachine, CloudStackEntity {
+
+ /**
+ * @return List of uuids for volumes attached to this virtual machine.
+ */
+ List<String> listVolumeUuids();
+
+ /**
+ * @return List of volumes attached to this virtual machine.
+ */
+ List<VolumeEntity> listVolumes();
+
+ /**
+ * @return List of uuids for nics attached to this virtual machine.
+ */
+ List<String> listNicUuids();
+
+ /**
+ * @return List of nics attached to this virtual machine.
+ */
+ List<NicEntity> listNics();
+
+ /**
+ * @return the template this virtual machine is based off.
+ */
+ TemplateEntity getTemplate();
+
+ /**
+ * @return the list of tags associated with the virtual machine
+ */
+ List<String> listTags();
+
+ void addTag();
+
+ void delTag();
+
+ /**
+ * Start the virtual machine with a given deploy destination
+ * @param plannerToUse the Deployment Planner that should be used
+ * @param dest destination to which to deploy the machine
+ * @param exclude list of areas to exclude
+ * @return a reservation id
+ */
+ String reserve(String plannerToUse, DeployDestination dest, ExcludeList exclude);
+
+ /**
+ * Migrate this VM to a certain destination.
+ *
+ * @param reservationId reservation id from reserve call.
+ */
+ void migrateTo(String reservationId);
+
+ /**
+ * Deploy this virtual machine according to the reservation from before.
+ * @param reservationId reservation id from reserve call.
+ *
+ */
+ void deploy(String reservationId);
+
+ /**
+ * Stop the virtual machine
+ *
+ */
+ void stop();
+
+ /**
+ * Cleans up after any botched starts. CloudStack Orchestration Platform
+ * will attempt a best effort to actually shutdown any resource but
+ * even if it cannot, it releases the resource from its database.
+ */
+ void cleanup();
+
+ /**
+ * Destroys the VM.
+ */
+ void destroy();
+
+ /**
+ * Duplicate this VM in the database so that it will start new
+ * @param externalId
+ * @return a new VirtualMachineEntity
+ */
+ VirtualMachineEntity duplicate(String externalId);
+
+ /**
+ * Take a VM snapshot
+ */
+ SnapshotEntity takeSnapshotOf();
+
+ /**
+ * Attach volume to this VM
+ * @param volume volume to attach
+ * @param deviceId deviceId to use
+ */
+ void attach(VolumeEntity volume, short deviceId);
+
+ /**
+ * Detach the volume from this VM
+ * @param volume volume to detach
+ */
+ void detach(VolumeEntity volume);
+
+ /**
+ * Connect the VM to a network
+ * @param network network to attach
+ * @param deviceId device id to use when a nic is created
+ */
+ void connectTo(NetworkEntity network, short nicId);
+
+ /**
+ * Disconnect the VM from this network
+ * @param netowrk network to disconnect from
+ */
+ void disconnectFrom(NetworkEntity netowrk, short nicId);
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/api/src/org/apache/cloudstack/platform/cloud/entity/api/VolumeEntity.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/platform/cloud/entity/api/VolumeEntity.java b/engine/api/src/org/apache/cloudstack/platform/cloud/entity/api/VolumeEntity.java
new file mode 100755
index 0000000..d7e5f38
--- /dev/null
+++ b/engine/api/src/org/apache/cloudstack/platform/cloud/entity/api/VolumeEntity.java
@@ -0,0 +1,74 @@
+/*
+ * 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 org.apache.cloudstack.platform.cloud.entity.api;
+
+import org.apache.cloudstack.platform.entity.api.CloudStackEntity;
+
+import com.cloud.storage.Volume;
+
+public interface VolumeEntity extends CloudStackEntity, Volume {
+
+ /**
+ * Take a snapshot of the volume
+ */
+ SnapshotEntity takeSnapshotOf(boolean full);
+
+ /**
+ * Make a reservation to do storage migration
+ *
+ * @param expirationTime time in seconds the reservation is cancelled
+ * @return reservation token
+ */
+ String reserveForMigration(long expirationTime);
+
+ /**
+ * Migrate using a reservation.
+ * @param reservationToken reservation token
+ */
+ void migrate(String reservationToken);
+
+ /**
+ * Setup for a copy of this volume.
+ * @return destination to copy to
+ */
+ VolumeEntity setupForCopy();
+
+ /**
+ * Perform the copy
+ * @param dest copy to this volume
+ */
+ void copy(VolumeEntity dest);
+
+ /**
+ * Attach to the vm
+ * @param vm vm to attach to
+ * @param deviceId device id to use
+ */
+ void attachTo(String vm, long deviceId);
+
+ /**
+ * Detach from the vm
+ */
+ void detachFrom();
+
+ /**
+ * Destroy the volume
+ */
+ void destroy();
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/api/src/org/apache/cloudstack/platform/datacenter/entity/api/ClusterEntity.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/platform/datacenter/entity/api/ClusterEntity.java b/engine/api/src/org/apache/cloudstack/platform/datacenter/entity/api/ClusterEntity.java
new file mode 100755
index 0000000..8378909
--- /dev/null
+++ b/engine/api/src/org/apache/cloudstack/platform/datacenter/entity/api/ClusterEntity.java
@@ -0,0 +1,25 @@
+/*
+ * 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 org.apache.cloudstack.platform.datacenter.entity.api;
+
+import com.cloud.org.Cluster;
+
+public interface ClusterEntity extends DataCenterResourceEntity, Cluster, OrganizationScope {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/api/src/org/apache/cloudstack/platform/datacenter/entity/api/DataCenterResourceEntity.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/platform/datacenter/entity/api/DataCenterResourceEntity.java b/engine/api/src/org/apache/cloudstack/platform/datacenter/entity/api/DataCenterResourceEntity.java
new file mode 100755
index 0000000..5ca27c5
--- /dev/null
+++ b/engine/api/src/org/apache/cloudstack/platform/datacenter/entity/api/DataCenterResourceEntity.java
@@ -0,0 +1,83 @@
+/*
+ * 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 org.apache.cloudstack.platform.datacenter.entity.api;
+
+import org.apache.cloudstack.platform.entity.api.CloudStackEntity;
+
+import com.cloud.utils.fsm.StateMachine2;
+import com.cloud.utils.fsm.StateObject;
+
+/**
+ * This interface specifies the states and operations all physical
+ * and virtual resources in the data center must implement.
+ */
+public interface DataCenterResourceEntity extends CloudStackEntity, StateObject<DataCenterResourceEntity.State> {
+
+ /**
+ * This is the state machine for how CloudStack should interact with
+ *
+ */
+ public enum State {
+ Disabled("The resource is disabled so CloudStack should not use it. This is the initial state of all resources added to CloudStack."),
+ Enabled("The resource is now enabled for CloudStack to use."),
+ Deactivated("The resource is disactivated so CloudStack should not use it for new resource needs.");
+
+ String _description;
+
+ private State(String description) {
+ _description = description;
+ }
+
+ public enum Event {
+ EnableRequest,
+ DisableRequest,
+ DeactivateRequest,
+ ActivatedRequest
+ }
+
+ protected static final StateMachine2<State, Event, DataCenterResourceEntity> s_fsm = new StateMachine2<State, Event, DataCenterResourceEntity>();
+ static {
+ s_fsm.addTransition(Disabled, Event.EnableRequest, Enabled);
+ s_fsm.addTransition(Enabled, Event.DisableRequest, Disabled);
+ s_fsm.addTransition(Enabled, Event.DeactivateRequest, Deactivated);
+ s_fsm.addTransition(Deactivated, Event.ActivatedRequest, Enabled);
+ }
+
+ }
+ /**
+ * Prepare the resource to take new on new demands.
+ */
+ boolean enable();
+
+ /**
+ * Disables the resource. Cleanup. Prepare for the resource to be removed.
+ */
+ boolean disable();
+
+ /**
+ * Do not use the resource for new demands.
+ */
+ boolean deactivate();
+
+ /**
+ * Reactivates a deactivated resource.
+ */
+ boolean reactivate();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/api/src/org/apache/cloudstack/platform/datacenter/entity/api/OrganizationScope.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/platform/datacenter/entity/api/OrganizationScope.java b/engine/api/src/org/apache/cloudstack/platform/datacenter/entity/api/OrganizationScope.java
new file mode 100755
index 0000000..0fa6497
--- /dev/null
+++ b/engine/api/src/org/apache/cloudstack/platform/datacenter/entity/api/OrganizationScope.java
@@ -0,0 +1,23 @@
+/*
+ * 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 org.apache.cloudstack.platform.datacenter.entity.api;
+
+public interface OrganizationScope {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/api/src/org/apache/cloudstack/platform/datacenter/entity/api/PodEntity.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/platform/datacenter/entity/api/PodEntity.java b/engine/api/src/org/apache/cloudstack/platform/datacenter/entity/api/PodEntity.java
new file mode 100755
index 0000000..e474300
--- /dev/null
+++ b/engine/api/src/org/apache/cloudstack/platform/datacenter/entity/api/PodEntity.java
@@ -0,0 +1,30 @@
+/*
+ * 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 org.apache.cloudstack.platform.datacenter.entity.api;
+
+import java.util.List;
+
+import com.cloud.dc.Pod;
+import com.cloud.org.Cluster;
+
+public interface PodEntity extends DataCenterResourceEntity, Pod {
+
+ List<Cluster> listClusters();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/api/src/org/apache/cloudstack/platform/datacenter/entity/api/StorageEntity.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/platform/datacenter/entity/api/StorageEntity.java b/engine/api/src/org/apache/cloudstack/platform/datacenter/entity/api/StorageEntity.java
new file mode 100755
index 0000000..2d22232
--- /dev/null
+++ b/engine/api/src/org/apache/cloudstack/platform/datacenter/entity/api/StorageEntity.java
@@ -0,0 +1,24 @@
+/*
+ * 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 org.apache.cloudstack.platform.datacenter.entity.api;
+
+import com.cloud.storage.StoragePool;
+
+public interface StorageEntity extends DataCenterResourceEntity, StoragePool {
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/api/src/org/apache/cloudstack/platform/datacenter/entity/api/ZoneEntity.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/platform/datacenter/entity/api/ZoneEntity.java b/engine/api/src/org/apache/cloudstack/platform/datacenter/entity/api/ZoneEntity.java
new file mode 100755
index 0000000..48940fa
--- /dev/null
+++ b/engine/api/src/org/apache/cloudstack/platform/datacenter/entity/api/ZoneEntity.java
@@ -0,0 +1,30 @@
+/*
+ * 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 org.apache.cloudstack.platform.datacenter.entity.api;
+
+import java.util.List;
+
+import com.cloud.dc.DataCenter;
+
+/**
+ * Describes a zone and operations that can be done in a zone.
+ */
+public interface ZoneEntity extends DataCenterResourceEntity, DataCenter {
+ List<PodEntity> listPods();
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/api/src/org/apache/cloudstack/platform/entity/api/CloudStackEntity.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/platform/entity/api/CloudStackEntity.java b/engine/api/src/org/apache/cloudstack/platform/entity/api/CloudStackEntity.java
new file mode 100755
index 0000000..1aa70b6
--- /dev/null
+++ b/engine/api/src/org/apache/cloudstack/platform/entity/api/CloudStackEntity.java
@@ -0,0 +1,96 @@
+/*
+ * 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 org.apache.cloudstack.platform.entity.api;
+
+import java.lang.reflect.Method;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * All entities returned by the Cloud Orchestration Platform must implement
+ * this interface. CloudValueEntity is an immutable representation of
+ * an entity exposed by Cloud Orchestration Platform. For each object, it
+ * defines two ids: uuid, generated by CloudStack Orchestration Platform, and
+ * an external id that is set by the caller when the entity is created. All
+ * ids must be unique for that entity. CloudValueEntity also can be converted
+ * to a CloudActionableEntity which contains actions the object can perform.
+ */
+public interface CloudStackEntity {
+ /**
+ * @return the uuid of the object.
+ */
+ String getUuid();
+
+ /**
+ * @return the id which is often the database id.
+ */
+ long getId();
+
+ /**
+ * @return external id set by the caller
+ */
+ String getExternalId();
+
+ /**
+ * @return current state for the entity
+ */
+ String getCurrentState();
+
+ /**
+ * @return desired state for the entity
+ */
+ String getDesiredState();
+
+ /**
+ * Get the time the entity was created
+ */
+ Date getCreatedTime();
+
+ /**
+ * Get the time the entity was last updated
+ */
+ Date getLastUpdatedTime();
+
+ /**
+ * @return reference to the owner of this entity
+ */
+ String getOwner();
+
+ /**
+ * @return details stored for this entity when created.
+ */
+ Map<String, String> getDetails(String source);
+
+ /**
+ * @return a list of sources that have added to the details.
+ */
+ List<String> getDetailSources();
+
+ void addDetail(String source, String name, String value);
+
+ void delDetail(String source, String name, String value);
+
+ void updateDetail(String source, String name, String value);
+
+ /**
+ * @return list of actions that can be performed on the object in its current state
+ */
+ List<Method> getApplicableActions();
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/api/src/org/apache/cloudstack/platform/exception/InsufficientCapacityException.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/platform/exception/InsufficientCapacityException.java b/engine/api/src/org/apache/cloudstack/platform/exception/InsufficientCapacityException.java
new file mode 100755
index 0000000..d2f9112
--- /dev/null
+++ b/engine/api/src/org/apache/cloudstack/platform/exception/InsufficientCapacityException.java
@@ -0,0 +1,24 @@
+/*
+ * 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 org.apache.cloudstack.platform.exception;
+
+public class InsufficientCapacityException {
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/api/src/org/apache/cloudstack/platform/service/api/DirectoryService.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/platform/service/api/DirectoryService.java b/engine/api/src/org/apache/cloudstack/platform/service/api/DirectoryService.java
new file mode 100755
index 0000000..e789613
--- /dev/null
+++ b/engine/api/src/org/apache/cloudstack/platform/service/api/DirectoryService.java
@@ -0,0 +1,34 @@
+/*
+ * 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 org.apache.cloudstack.platform.service.api;
+
+import java.net.URI;
+import java.util.List;
+
+import com.cloud.utils.component.PluggableService;
+
+public interface DirectoryService {
+ void registerService(String serviceName, URI endpoint);
+ void unregisterService(String serviceName, URI endpoint);
+ List<URI> getEndPoints(String serviceName);
+ URI getLoadBalancedEndPoint(String serviceName);
+
+ List<PluggableService> listServices();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/api/src/org/apache/cloudstack/platform/service/api/EntityService.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/platform/service/api/EntityService.java b/engine/api/src/org/apache/cloudstack/platform/service/api/EntityService.java
new file mode 100755
index 0000000..6983d28
--- /dev/null
+++ b/engine/api/src/org/apache/cloudstack/platform/service/api/EntityService.java
@@ -0,0 +1,45 @@
+/*
+ * 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 org.apache.cloudstack.platform.service.api;
+
+import java.util.List;
+
+import com.cloud.network.Network;
+import com.cloud.storage.Volume;
+import com.cloud.vm.VirtualMachine;
+
+/**
+ * Service to retrieve CloudStack entities
+ * very likely to change
+ */
+public interface EntityService {
+ List<String> listVirtualMachines();
+ List<String> listVolumes();
+ List<String> listNetworks();
+ List<String> listNics();
+ List<String> listSnapshots();
+ List<String> listTemplates();
+ List<String> listStoragePools();
+ List<String> listHosts();
+
+ VirtualMachine getVirtualMachine(String vm);
+ Volume getVolume(String volume);
+ Network getNetwork(String network);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/api/src/org/apache/cloudstack/platform/service/api/OperationsServices.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/platform/service/api/OperationsServices.java b/engine/api/src/org/apache/cloudstack/platform/service/api/OperationsServices.java
new file mode 100755
index 0000000..5cf7bc6
--- /dev/null
+++ b/engine/api/src/org/apache/cloudstack/platform/service/api/OperationsServices.java
@@ -0,0 +1,57 @@
+/*
+ * 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 org.apache.cloudstack.platform.service.api;
+
+import java.net.URL;
+import java.util.List;
+
+import com.cloud.alert.Alert;
+import com.cloud.async.AsyncJob;
+
+public interface OperationsServices {
+ List<AsyncJob> listJobs();
+
+ List<AsyncJob> listJobsInProgress();
+
+ List<AsyncJob> listJobsCompleted();
+
+ List<AsyncJob> listJobsCompleted(Long from);
+
+ List<AsyncJob> listJobsInWaiting();
+
+ void cancelJob(String job);
+
+ List<Alert> listAlerts();
+
+ Alert getAlert(String uuid);
+
+ void cancelAlert(String alert);
+
+ void registerForAlerts();
+
+ String registerForEventNotifications(String type, String topic, URL url);
+
+ boolean deregisterForEventNotifications(String notificationId);
+
+ /**
+ * @return the list of event topics someone can register for
+ */
+ List<String> listEventTopics();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/api/src/org/apache/cloudstack/platform/service/api/OrchestrationService.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/platform/service/api/OrchestrationService.java b/engine/api/src/org/apache/cloudstack/platform/service/api/OrchestrationService.java
new file mode 100755
index 0000000..87c2fe0
--- /dev/null
+++ b/engine/api/src/org/apache/cloudstack/platform/service/api/OrchestrationService.java
@@ -0,0 +1,84 @@
+/*
+ * 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 org.apache.cloudstack.platform.service.api;
+
+import java.net.URL;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.cloudstack.platform.cloud.entity.api.NetworkEntity;
+import org.apache.cloudstack.platform.cloud.entity.api.TemplateEntity;
+import org.apache.cloudstack.platform.cloud.entity.api.VirtualMachineEntity;
+import org.apache.cloudstack.platform.cloud.entity.api.VolumeEntity;
+
+import com.cloud.hypervisor.Hypervisor;
+
+public interface OrchestrationService {
+ /**
+ * creates a new virtual machine
+ *
+ * @param uuid externally unique name to reference the virtual machine
+ * @param template reference to the template
+ * @param hostName name of the host
+ * @param cpu # of cpu cores
+ * @param speed speed of the cpu core
+ * @param memory memory to allocate in bytes
+ * @param networks networks that this VM belongs in
+ * @param rootDiskTags tags for the root disk
+ * @param computeTags tags for the compute
+ * @param details extra details to store for the VM
+ * @return VirtualMachine
+ */
+ VirtualMachineEntity createVirtualMachine(String name,
+ String template,
+ String hostName,
+ int cpu,
+ int speed,
+ long memory,
+ List<String> networks,
+ List<String> rootDiskTags,
+ List<String> computeTags,
+ Map<String, String> details,
+ String owner);
+
+ VirtualMachineEntity createVirtualMachineFromScratch(String uuid,
+ String iso,
+ String os,
+ String hypervisor,
+ String hostName,
+ int cpu,
+ int speed,
+ long memory,
+ List<String> networks,
+ List<String> computeTags,
+ Map<String, String> details,
+ String owner);
+
+ NetworkEntity createNetwork(String externaId, String name, String cidr, String gateway);
+
+ void destroyNetwork(String networkUuid);
+
+ VolumeEntity createVolume();
+
+ void destroyVolume(String volumeEntity);
+
+ TemplateEntity registerTemplate(String name, URL path, String os, Hypervisor hypervisor);
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/api/src/org/apache/cloudstack/platform/service/api/ProvisioningService.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/platform/service/api/ProvisioningService.java b/engine/api/src/org/apache/cloudstack/platform/service/api/ProvisioningService.java
new file mode 100755
index 0000000..0032a25
--- /dev/null
+++ b/engine/api/src/org/apache/cloudstack/platform/service/api/ProvisioningService.java
@@ -0,0 +1,65 @@
+/*
+ * 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 org.apache.cloudstack.platform.service.api;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.cloudstack.platform.datacenter.entity.api.ZoneEntity;
+
+import com.cloud.dc.DataCenter;
+import com.cloud.dc.Pod;
+import com.cloud.host.Host;
+import com.cloud.host.Status;
+import com.cloud.storage.StoragePool;
+
+
+/**
+ * ProvisioningService registers and deregisters physical and virtual
+ * resources that the management server can use.
+ */
+public interface ProvisioningService {
+
+ String registerStorage(String name, List<String> tags, Map<String, String> details);
+ ZoneEntity registerZone(String name, List<String> tags, Map<String, String> details);
+ String registerPod(String name, List<String> tags, Map<String, String> details);
+ String registerCluster(String name, List<String> tags, Map<String, String> details);
+ String registerHost(String name, List<String> tags, Map<String, String> details);
+
+
+
+ void deregisterStorage(String uuid);
+ void deregisterZone();
+ void deregisterPod();
+ void deregisterCluster();
+ void deregisterHost();
+
+ void changeState(String type, String entity, Status state);
+
+ List<Host> listHosts();
+
+ List<Pod> listPods();
+
+ List<DataCenter> listZones();
+
+
+
+ List<StoragePool> listStorage();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/hypervisor/ComputeSubsystem.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/platform/subsystem/api/hypervisor/ComputeSubsystem.java b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/hypervisor/ComputeSubsystem.java
new file mode 100644
index 0000000..b9f8a87
--- /dev/null
+++ b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/hypervisor/ComputeSubsystem.java
@@ -0,0 +1,31 @@
+/*
+ * 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 org.apache.cloudstack.platform.subsystem.api.hypervisor;
+
+
+public interface ComputeSubsystem {
+
+ void start(String vm, String reservationId);
+
+ void cancel(String reservationId);
+
+ void stop(String vm, String reservationId);
+
+ void migrate(String vm, String reservationId);
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/network/NetworkServiceProvider.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/platform/subsystem/api/network/NetworkServiceProvider.java b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/network/NetworkServiceProvider.java
new file mode 100755
index 0000000..a66a4f5
--- /dev/null
+++ b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/network/NetworkServiceProvider.java
@@ -0,0 +1,47 @@
+/*
+ * 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 org.apache.cloudstack.platform.subsystem.api.network;
+
+public interface NetworkServiceProvider {
+ /**
+ * Plug your network elements into this network
+ * @param network
+ * @param reservationId
+ */
+ void plugInto(String network, String reservationId);
+
+ /**
+ * Unplug your network elements from this network
+ * @param network
+ * @param reservationId
+ */
+ void unplugFrom(String network, String reservationId);
+
+ /**
+ * Cancel a previous work
+ * @param reservationId
+ */
+ void cancel(String reservationId);
+
+ void provideServiceTo(String vm, String network, String reservationId);
+
+ void removeServiceFrom(String vm, String network, String reservationId);
+
+ void cleanUp(String network, String reservationId);
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/network/NetworkSubsystem.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/platform/subsystem/api/network/NetworkSubsystem.java b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/network/NetworkSubsystem.java
new file mode 100755
index 0000000..6a37382
--- /dev/null
+++ b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/network/NetworkSubsystem.java
@@ -0,0 +1,35 @@
+/*
+ * 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 org.apache.cloudstack.platform.subsystem.api.network;
+
+public interface NetworkSubsystem {
+ String create();
+
+ String start(String network, String reservationId);
+
+ void shutdown(String nework, String reservationId);
+
+ void prepare(String vm, String network, String reservationId);
+
+ void release(String vm, String network, String reservationId);
+
+ void cancel(String reservationId);
+
+ void destroy(String network, String reservationId);
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/BackupStrategy.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/BackupStrategy.java b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/BackupStrategy.java
new file mode 100644
index 0000000..b5aecd7
--- /dev/null
+++ b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/BackupStrategy.java
@@ -0,0 +1,5 @@
+package org.apache.cloudstack.platform.subsystem.api.storage;
+
+public interface BackupStrategy {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataMigrationSubSystem.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataMigrationSubSystem.java b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataMigrationSubSystem.java
new file mode 100755
index 0000000..edb15a6
--- /dev/null
+++ b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataMigrationSubSystem.java
@@ -0,0 +1,29 @@
+/*
+ * 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 org.apache.cloudstack.platform.subsystem.api.storage;
+
+import java.net.URI;
+
+import com.cloud.org.Grouping;
+
+public interface DataMigrationSubSystem {
+
+ Class<? extends Grouping> getScopeCoverage();
+ void migrate(URI source, URI dest, String reservationId);
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataObject.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataObject.java b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataObject.java
new file mode 100644
index 0000000..c861bc4
--- /dev/null
+++ b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataObject.java
@@ -0,0 +1,42 @@
+/*
+ * 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 org.apache.cloudstack.platform.subsystem.api.storage;
+
+import java.util.List;
+
+import org.apache.cloudstack.platform.subsystem.api.storage.DataStore.DataStoreRef;
+
+/*
+ * Logic entity
+ */
+public interface DataObject {
+ String getURI();
+ String getUUID();
+ DataStoreRef getStoreRef();
+ long getSize();
+ //volume/snapshot/template
+ String getType();
+ //db id
+ Long getId();
+ DataObject getParent();
+ void setParent(DataObject obj);
+ List<DataObject> getChidren();
+ boolean lock();
+ boolean unlock();
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataObjectBackupStorageOperationState.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataObjectBackupStorageOperationState.java b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataObjectBackupStorageOperationState.java
new file mode 100644
index 0000000..a565036
--- /dev/null
+++ b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataObjectBackupStorageOperationState.java
@@ -0,0 +1,58 @@
+/*
+ * 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 org.apache.cloudstack.platform.subsystem.api.storage;
+
+import com.cloud.utils.fsm.StateMachine;
+
+public enum DataObjectBackupStorageOperationState {
+ Copying,
+ Deleting,
+ Ready,
+ NonOperational;
+
+ public enum Event {
+ Initial("Init state machine"),
+ CopyingRequested("Copy operation is requested"),
+ DeleteRequested("Delete operation is requested"),
+ OperationSuccess("Operation successed"),
+ OperationFailed("Operation failed");
+
+ private final String _msg;
+
+ private Event(String msg) {
+ _msg = msg;
+ }
+ }
+
+ public DataObjectBackupStorageOperationState getNextState(Event a) {
+ return s_fsm.getNextState(this, a);
+ }
+
+ protected static final StateMachine<DataObjectBackupStorageOperationState, Event> s_fsm = new StateMachine<DataObjectBackupStorageOperationState, Event>();
+ static {
+ s_fsm.addTransition(null, Event.Initial, DataObjectBackupStorageOperationState.Ready);
+ s_fsm.addTransition(DataObjectBackupStorageOperationState.Ready, Event.CopyingRequested, DataObjectBackupStorageOperationState.Copying);
+ s_fsm.addTransition(DataObjectBackupStorageOperationState.Copying, Event.CopyingRequested, DataObjectBackupStorageOperationState.Copying);
+ s_fsm.addTransition(DataObjectBackupStorageOperationState.Copying, Event.OperationFailed, DataObjectBackupStorageOperationState.Ready);
+ s_fsm.addTransition(DataObjectBackupStorageOperationState.Copying, Event.OperationSuccess, DataObjectBackupStorageOperationState.Ready);
+ s_fsm.addTransition(DataObjectBackupStorageOperationState.Ready, Event.DeleteRequested, DataObjectBackupStorageOperationState.Deleting);
+ s_fsm.addTransition(DataObjectBackupStorageOperationState.Deleting, Event.OperationFailed, DataObjectBackupStorageOperationState.Ready);
+ s_fsm.addTransition(DataObjectBackupStorageOperationState.Deleting, Event.OperationSuccess, DataObjectBackupStorageOperationState.NonOperational);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataStore.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataStore.java b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataStore.java
new file mode 100644
index 0000000..0d0f082
--- /dev/null
+++ b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataStore.java
@@ -0,0 +1,76 @@
+/*
+ * 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 org.apache.cloudstack.platform.subsystem.api.storage;
+
+import com.cloud.agent.api.to.StorageFilerTO;
+import com.cloud.storage.Snapshot;
+import com.cloud.storage.Storage.StoragePoolType;
+import com.cloud.storage.Volume;
+import com.cloud.template.VirtualMachineTemplate;
+
+public interface DataStore {
+ public class DataStoreRef {
+
+ }
+
+ public class DataStoreDriverRef {
+
+ }
+
+ public enum StoreType {
+ Primary,
+ Image,
+ Backup;
+ }
+ public class StoreScope {
+ public long zoneId;
+ private long clusterId;
+ private long hostId;
+ }
+
+ String getURI();
+ String getUUID();
+ long getCluterId();
+ long getPodId();
+ long getZoneId();
+ String getPath();
+ StoreType getType();
+ StoragePoolType getPoolType();
+ StoreScope getScope();
+ boolean isSharedStorage();
+ Long getId();
+ DataStoreDriver getDataStoreDriver();
+ StorageProvider getProvider();
+ DataStoreEndPointSelector getEndPointSelector();
+ FileSystem getFileSystem();
+ VolumeStrategy getVolumeStrategy();
+ SnapshotStrategy getSnapshotStrategy();
+ BackupStrategy getBackupStrategy();
+ TemplateStrategy getTemplateStrategy();
+ DataStoreLifeCycle getLifeCycle();
+
+ VolumeProfile prepareVolume(Volume volume, DataStore destStore);
+ SnapshotProfile prepareSnapshot(Snapshot snapshot, DataStore destStore);
+ TemplateProfile prepareTemplate(long templateId, DataStore destStore);
+ boolean contains(Volume volume);
+ boolean contains(Snapshot snapshot);
+ boolean contains(TemplateProfile template);
+ TemplateProfile get(TemplateProfile template);
+ StorageFilerTO getTO();
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataStoreConfigurator.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataStoreConfigurator.java b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataStoreConfigurator.java
new file mode 100644
index 0000000..8d80d8d
--- /dev/null
+++ b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataStoreConfigurator.java
@@ -0,0 +1,16 @@
+package org.apache.cloudstack.platform.subsystem.api.storage;
+
+import java.net.URI;
+import java.util.List;
+import java.util.Map;
+
+import com.cloud.storage.StoragePool;
+
+public interface DataStoreConfigurator {
+ String getProtocol();
+ StoragePool getStoragePool(Map<String, String> configs);
+ List<String> getConfigNames();
+ Map<String, String> getConfigs(URI uri, Map<String, String> extras);
+ boolean validate(Map<String, String> configs);
+ DataStore getDataStore(StoragePool pool);
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataStoreDriver.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataStoreDriver.java b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataStoreDriver.java
new file mode 100644
index 0000000..258f0a1
--- /dev/null
+++ b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataStoreDriver.java
@@ -0,0 +1,35 @@
+/*
+ * 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 org.apache.cloudstack.platform.subsystem.api.storage;
+
+import com.cloud.agent.api.Answer;
+import com.cloud.agent.api.Command;
+
+public interface DataStoreDriver {
+ String getDriverType();
+ TemplateProfile install(TemplateProfile tp, DataStoreEndPoint ep);
+ TemplateProfile register(TemplateProfile tp, DataStoreEndPoint ep);
+ DataObject create(DataObject obj);
+ DataObject copy(DataObject src, DataStore dest);
+ DataObject copy(DataObject src, DataObject dest);
+ DataObject move(DataObject src, DataObject dest);
+ VolumeProfile createVolumeFromTemplate(VolumeProfile vol, TemplateProfile tp, DataStoreEndPoint dp);
+ Answer sendMessage(DataStoreEndPoint dsep, Command cmd);
+ boolean delete(DataObject obj);
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataStoreEndPoint.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataStoreEndPoint.java b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataStoreEndPoint.java
new file mode 100644
index 0000000..8029424
--- /dev/null
+++ b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataStoreEndPoint.java
@@ -0,0 +1,26 @@
+package org.apache.cloudstack.platform.subsystem.api.storage;
+
+import com.cloud.agent.api.Answer;
+import com.cloud.agent.api.Command;
+
+public class DataStoreEndPoint {
+ protected long hostId;
+ protected String privIp;
+
+ public DataStoreEndPoint(long host, String ip) {
+ hostId = host;
+ privIp = ip;
+ }
+
+ public long getHostId() {
+ return hostId;
+ }
+
+ public String getPrivateIp() {
+ return privIp;
+ }
+
+ public Answer sendCommand(Command cmd) {
+ return new Answer(cmd);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataStoreEndPointSelector.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataStoreEndPointSelector.java b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataStoreEndPointSelector.java
new file mode 100644
index 0000000..30b597c
--- /dev/null
+++ b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataStoreEndPointSelector.java
@@ -0,0 +1,7 @@
+package org.apache.cloudstack.platform.subsystem.api.storage;
+
+import java.util.List;
+
+public interface DataStoreEndPointSelector {
+ List<DataStoreEndPoint> getEndPoints(StorageEvent event);
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataStoreExtendedAttribute.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataStoreExtendedAttribute.java b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataStoreExtendedAttribute.java
new file mode 100644
index 0000000..55af9d9
--- /dev/null
+++ b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataStoreExtendedAttribute.java
@@ -0,0 +1,5 @@
+package org.apache.cloudstack.platform.subsystem.api.storage;
+
+public interface DataStoreExtendedAttribute {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataStoreLifeCycle.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataStoreLifeCycle.java b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataStoreLifeCycle.java
new file mode 100644
index 0000000..46be5f5
--- /dev/null
+++ b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataStoreLifeCycle.java
@@ -0,0 +1,13 @@
+package org.apache.cloudstack.platform.subsystem.api.storage;
+
+public interface DataStoreLifeCycle {
+ public enum DataStoreEvent {
+ HOSTUP,
+ HOSTDOWN,
+ }
+ void add();
+ void delete();
+ void enable();
+ void disable();
+ void processEvent(DataStoreEvent event, Object... objs);
+}