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
[6/18] Added engine
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/FileSystem.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/FileSystem.java b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/FileSystem.java
new file mode 100644
index 0000000..213829d
--- /dev/null
+++ b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/FileSystem.java
@@ -0,0 +1,32 @@
+/*
+ * 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;
+
+public interface FileSystem {
+ DataObject create(DataObject obj);
+ DataObject copy(DataObject Obj, DataStore destStore);
+ DataObject copy(DataObject obj, DataObject destObj);
+ DataObject move(DataObject srcObj, DataObject destObj);
+ boolean delete(DataObject obj);
+ long getStats(DataObject obj);
+ String getFileType();
+ boolean isWritable(DataObject obj);
+ boolean contains(DataObject obj);
+ DataObject ioctl(DataObject obj, Object... objects);
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/Snapshot.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/Snapshot.java b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/Snapshot.java
new file mode 100644
index 0000000..5702e4c
--- /dev/null
+++ b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/Snapshot.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.subsystem.api.storage;
+
+public interface Snapshot extends DataObject {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/SnapshotProfile.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/SnapshotProfile.java b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/SnapshotProfile.java
new file mode 100644
index 0000000..bf07cec
--- /dev/null
+++ b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/SnapshotProfile.java
@@ -0,0 +1,26 @@
+/*
+ * 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;
+
+public class SnapshotProfile {
+ private String _uri;
+ public String getURI() {
+ return _uri;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/SnapshotStrategy.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/SnapshotStrategy.java b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/SnapshotStrategy.java
new file mode 100644
index 0000000..f627f5a
--- /dev/null
+++ b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/SnapshotStrategy.java
@@ -0,0 +1,5 @@
+package org.apache.cloudstack.platform.subsystem.api.storage;
+
+public interface SnapshotStrategy {
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/StorageEvent.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/StorageEvent.java b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/StorageEvent.java
new file mode 100644
index 0000000..34cfb2a
--- /dev/null
+++ b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/StorageEvent.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.subsystem.api.storage;
+
+public enum StorageEvent {
+ DownloadTemplateToPrimary,
+ RegisterTemplate,
+ CreateVolumeFromTemplate;
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/StorageProvider.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/StorageProvider.java b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/StorageProvider.java
new file mode 100644
index 0000000..7bc7e30
--- /dev/null
+++ b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/StorageProvider.java
@@ -0,0 +1,20 @@
+package org.apache.cloudstack.platform.subsystem.api.storage;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.cloudstack.platform.subsystem.api.storage.DataStore.StoreType;
+
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
+import com.cloud.storage.StoragePool;
+import com.cloud.utils.component.Adapter;
+
+public interface StorageProvider extends Adapter {
+ List<HypervisorType> supportedHypervisors();
+ String getProviderName();
+ List<StoreType> supportedStoreTypes();
+ void configure(Map<String, String> storeProviderInfo);
+ DataStore addDataStore(StoragePool sp, String uri, Map<String, String> params);
+ DataStore getDataStore(StoragePool pool);
+ Map<HypervisorType, Map<String,DataStoreConfigurator>> getDataStoreConfigs();
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/StorageSubSystem.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/StorageSubSystem.java b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/StorageSubSystem.java
new file mode 100755
index 0000000..e12ff79
--- /dev/null
+++ b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/StorageSubSystem.java
@@ -0,0 +1,13 @@
+package org.apache.cloudstack.platform.subsystem.api.storage;
+
+import java.net.URI;
+
+import com.cloud.org.Grouping;
+
+public interface StorageSubSystem {
+ String getType();
+ Class<? extends Grouping> getScope();
+
+ URI grantAccess(String vol, String reservationId);
+ URI RemoveAccess(String vol, String reservationId);
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/TemplateProfile.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/TemplateProfile.java b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/TemplateProfile.java
new file mode 100755
index 0000000..11c7e64
--- /dev/null
+++ b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/TemplateProfile.java
@@ -0,0 +1,287 @@
+// 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.Map;
+
+import com.cloud.hypervisor.Hypervisor.HypervisorType;
+import com.cloud.storage.Storage.ImageFormat;
+import com.cloud.template.VirtualMachineTemplate;
+
+public class TemplateProfile {
+ Long userId;
+ String name;
+ String displayText;
+ Integer bits;
+ Boolean passwordEnabled;
+ Boolean sshKeyEnbaled;
+ Boolean requiresHvm;
+ String url;
+ Boolean isPublic;
+ Boolean featured;
+ Boolean isExtractable;
+ ImageFormat format;
+ Long guestOsId;
+ Long zoneId;
+ HypervisorType hypervisorType;
+ String accountName;
+ Long domainId;
+ Long accountId;
+ String chksum;
+ Boolean bootable;
+ Long templateId;
+ VirtualMachineTemplate template;
+ String templateTag;
+ Map details;
+
+ public TemplateProfile(Long templateId, Long userId, String name, String displayText, Integer bits, Boolean passwordEnabled, Boolean requiresHvm,
+ String url, Boolean isPublic, Boolean featured, Boolean isExtractable, ImageFormat format, Long guestOsId, Long zoneId,
+ HypervisorType hypervisorType, String accountName, Long domainId, Long accountId, String chksum, Boolean bootable, Map details, Boolean sshKeyEnabled) {
+ this.templateId = templateId;
+ this.userId = userId;
+ this.name = name;
+ this.displayText = displayText;
+ this.bits = bits;
+ this.passwordEnabled = passwordEnabled;
+ this.requiresHvm = requiresHvm;
+ this.url = url;
+ this.isPublic = isPublic;
+ this.featured = featured;
+ this.isExtractable = isExtractable;
+ this.format = format;
+ this.guestOsId = guestOsId;
+ this.zoneId = zoneId;
+ this.hypervisorType = hypervisorType;
+ this.accountName = accountName;
+ this.domainId = domainId;
+ this.accountId = accountId;
+ this.chksum = chksum;
+ this.bootable = bootable;
+ this.details = details;
+ this.sshKeyEnbaled = sshKeyEnabled;
+ }
+
+ public TemplateProfile(Long userId, VirtualMachineTemplate template, Long zoneId) {
+ this.userId = userId;
+ this.template = template;
+ this.zoneId = zoneId;
+ }
+
+ public TemplateProfile(Long templateId, Long userId, String name, String displayText, Integer bits, Boolean passwordEnabled, Boolean requiresHvm,
+ String url, Boolean isPublic, Boolean featured, Boolean isExtractable, ImageFormat format, Long guestOsId, Long zoneId,
+ HypervisorType hypervisorType, String accountName, Long domainId, Long accountId, String chksum, Boolean bootable, String templateTag, Map details, Boolean sshKeyEnabled) {
+ this(templateId, userId, name, displayText, bits, passwordEnabled, requiresHvm, url, isPublic, featured, isExtractable, format, guestOsId, zoneId,
+ hypervisorType, accountName, domainId, accountId, chksum, bootable, details, sshKeyEnabled);
+ this.templateTag = templateTag;
+ }
+
+ public Long getTemplateId() {
+ return templateId;
+ }
+ public void setTemplateId(Long id) {
+ this.templateId = id;
+ }
+
+ public Long getUserId() {
+ return userId;
+ }
+ public void setUserId(Long userId) {
+ this.userId = userId;
+ }
+
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDisplayText() {
+ return displayText;
+ }
+ public void setDisplayText(String text) {
+ this.displayText = text;
+ }
+
+ public Integer getBits() {
+ return bits;
+ }
+ public void setBits(Integer bits) {
+ this.bits = bits;
+ }
+
+ public Boolean getPasswordEnabled() {
+ return passwordEnabled;
+ }
+ public void setPasswordEnabled(Boolean enabled) {
+ this.passwordEnabled = enabled;
+ }
+
+ public Boolean getRequiresHVM() {
+ return requiresHvm;
+ }
+ public void setRequiresHVM(Boolean hvm) {
+ this.requiresHvm = hvm;
+ }
+
+ public String getUrl() {
+ return url;
+ }
+ public void setUrl(String url) {
+ this.url = url;
+ }
+
+ public Boolean getIsPublic() {
+ return isPublic;
+ }
+ public void setIsPublic(Boolean is) {
+ this.isPublic = is;
+ }
+
+ public Boolean getFeatured() {
+ return featured;
+ }
+ public void setFeatured(Boolean featured) {
+ this.featured = featured;
+ }
+
+ public Boolean getIsExtractable() {
+ return isExtractable;
+ }
+ public void setIsExtractable(Boolean is) {
+ this.isExtractable = is;
+ }
+
+ public ImageFormat getFormat() {
+ return format;
+ }
+ public void setFormat(ImageFormat format) {
+ this.format = format;
+ }
+
+ public Long getGuestOsId() {
+ return guestOsId;
+ }
+ public void setGuestOsId(Long id) {
+ this.guestOsId = id;
+ }
+
+ public Long getZoneId() {
+ return zoneId;
+ }
+ public void setZoneId(Long id) {
+ this.zoneId = id;
+ }
+
+ public HypervisorType getHypervisorType() {
+ return hypervisorType;
+ }
+ public void setHypervisorType(HypervisorType type) {
+ this.hypervisorType = type;
+ }
+
+ public Long getDomainId() {
+ return domainId;
+ }
+ public void setDomainId(Long id) {
+ this.domainId = id;
+ }
+
+ public Long getAccountId() {
+ return accountId;
+ }
+ public void setAccountId(Long id) {
+ this.accountId = id;
+ }
+
+ public String getCheckSum() {
+ return chksum;
+ }
+ public void setCheckSum(String chksum) {
+ this.chksum = chksum;
+ }
+
+ public Boolean getBootable() {
+ return this.bootable;
+ }
+ public void setBootable(Boolean bootable) {
+ this.bootable = bootable;
+ }
+
+ public VirtualMachineTemplate getTemplate() {
+ return template;
+ }
+ public void setTemplate(VirtualMachineTemplate template) {
+ this.template = template;
+ }
+
+ public String getTemplateTag() {
+ return templateTag;
+ }
+
+ public void setTemplateTag(String templateTag) {
+ this.templateTag = templateTag;
+ }
+
+ public Map getDetails() {
+ return this.details;
+ }
+
+ public void setDetails(Map details) {
+ this.details = details;
+ }
+
+ public void setSshKeyEnabled(Boolean enabled) {
+ this.sshKeyEnbaled = enabled;
+ }
+
+ public Boolean getSshKeyEnabled() {
+ return this.sshKeyEnbaled;
+ }
+
+ public String getImageStorageUri() {
+ return null;
+ }
+
+ public void setLocalPath(String path) {
+
+ }
+
+ public String getLocalPath() {
+ return null;
+ }
+
+ public String getJobId() {
+ return null;
+ }
+
+ public void setTemplatePoolRefId(long id) {
+
+ }
+
+ public long getId() {
+ return 0;
+ }
+
+ public long getTemplatePoolRefId() {
+ return 0;
+ }
+
+ public long getSize() {
+ return 0;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/TemplateStrategy.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/TemplateStrategy.java b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/TemplateStrategy.java
new file mode 100644
index 0000000..61ea40a
--- /dev/null
+++ b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/TemplateStrategy.java
@@ -0,0 +1,13 @@
+package org.apache.cloudstack.platform.subsystem.api.storage;
+
+import com.cloud.agent.api.storage.DownloadCommand.Proxy;
+
+public interface TemplateStrategy {
+ TemplateProfile install(TemplateProfile tp);
+ TemplateProfile get(long templateId);
+ TemplateProfile register(TemplateProfile tp);
+ boolean canRegister(long templateId);
+ int getDownloadWait();
+ long getMaxTemplateSizeInBytes();
+ Proxy getHttpProxy();
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/VolumeProfile.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/VolumeProfile.java b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/VolumeProfile.java
new file mode 100644
index 0000000..236ebf5
--- /dev/null
+++ b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/VolumeProfile.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.subsystem.api.storage;
+
+public class VolumeProfile {
+ private String _uri;
+ public String getURI() {
+ return _uri;
+ }
+
+ public String getPath() {
+ return null;
+ }
+
+ public long getSize() {
+ return 0;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/VolumeStrategy.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/VolumeStrategy.java b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/VolumeStrategy.java
new file mode 100644
index 0000000..207bbba
--- /dev/null
+++ b/engine/api/src/org/apache/cloudstack/platform/subsystem/api/storage/VolumeStrategy.java
@@ -0,0 +1,16 @@
+package org.apache.cloudstack.platform.subsystem.api.storage;
+
+
+import com.cloud.storage.Volume;
+
+public interface VolumeStrategy {
+ Volume createVolume(Volume vol);
+ Volume createDataVolume(Volume vol);
+ Volume copyVolumeFromBackup(VolumeProfile srcVol, Volume destVol);
+ Volume createVolumeFromSnapshot(SnapshotProfile snapshot, Volume vol);
+ Volume createVolumeFromTemplate(TemplateProfile template, Volume vol);
+ Volume migrateVolume(Volume srcVol, Volume destVol, DataStore destStore);
+ Volume createVolumeFromBaseTemplate(Volume destVol, TemplateProfile tp);
+ boolean deleteVolume(Volume vol);
+ VolumeProfile get(long volumeId);
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/components-api/pom.xml
----------------------------------------------------------------------
diff --git a/engine/components-api/pom.xml b/engine/components-api/pom.xml
new file mode 100644
index 0000000..a4f8a44
--- /dev/null
+++ b/engine/components-api/pom.xml
@@ -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.
+-->
+<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-components-api</artifactId>
+ <name>Apache CloudStack Cloud Engine Internal Components 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-engine-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cloudstack</groupId>
+ <artifactId>cloud-framework-ipc</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/compute/pom.xml
----------------------------------------------------------------------
diff --git a/engine/compute/pom.xml b/engine/compute/pom.xml
new file mode 100644
index 0000000..8fb3ab4
--- /dev/null
+++ b/engine/compute/pom.xml
@@ -0,0 +1,52 @@
+<!--
+ 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-compute</artifactId>
+ <name>Apache CloudStack Cloud Engine Compute Component</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-engine-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cloudstack</groupId>
+ <artifactId>cloud-framework-ipc</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cloudstack</groupId>
+ <artifactId>cloud-engine-components-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/compute/src/org/apache/cloudstack/compute/ComputeOrchestrator.java
----------------------------------------------------------------------
diff --git a/engine/compute/src/org/apache/cloudstack/compute/ComputeOrchestrator.java b/engine/compute/src/org/apache/cloudstack/compute/ComputeOrchestrator.java
new file mode 100755
index 0000000..8c1c91b
--- /dev/null
+++ b/engine/compute/src/org/apache/cloudstack/compute/ComputeOrchestrator.java
@@ -0,0 +1,37 @@
+/*
+ * 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.compute;
+
+import java.util.logging.Handler;
+
+public interface ComputeOrchestrator {
+ /**
+ * start the vm
+ * @param vm vm
+ * @param reservationId
+ */
+ @Ipc(topic="cs.compute.start", response="cs.compute.start.response")
+ void start(@IpcParam String vm, @IpcParam String reservationId, Handler handler);
+
+ @Ipc(topic="cs.compute.cancel")
+ void cancel(@IpcParam String reservationId);
+
+ @Ipc(topic="cs.compute.stop")
+ void stop(@IpcParam String vm, @IpcParam String reservationId);
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/compute/src/org/apache/cloudstack/compute/ComputeOrchestratorImpl.java
----------------------------------------------------------------------
diff --git a/engine/compute/src/org/apache/cloudstack/compute/ComputeOrchestratorImpl.java b/engine/compute/src/org/apache/cloudstack/compute/ComputeOrchestratorImpl.java
new file mode 100755
index 0000000..5030feb
--- /dev/null
+++ b/engine/compute/src/org/apache/cloudstack/compute/ComputeOrchestratorImpl.java
@@ -0,0 +1,41 @@
+/*
+ * 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.compute;
+
+
+public class ComputeOrchestratorImpl implements ComputeOrchestrator {
+
+ @Override
+ public void start(String vm, String reservationId) {
+ // Retrieve the VM
+ // Locate the HypervisorGuru based on the VM type
+ // Call HypervisorGuru to start the VM
+ }
+
+ @Override
+ public void cancel(String reservationId) {
+ }
+
+ @Override
+ public void stop(String vm, String reservationId) {
+ // Retrieve the VM
+ // Locate the HypervisorGuru based on the VM type
+ // Call HypervisorGuru to stop the VM
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/network/pom.xml
----------------------------------------------------------------------
diff --git a/engine/network/pom.xml b/engine/network/pom.xml
new file mode 100644
index 0000000..f0680bc
--- /dev/null
+++ b/engine/network/pom.xml
@@ -0,0 +1,52 @@
+<!--
+ 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-network</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-engine-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <depdency>
+ <groupId>org.apache.cloudstack</groupId>
+ <artifactId>cloud-engine-components-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cloudstack</groupId>
+ <artifactId>cloud-framework-ipc</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/network/src/org/apache/cloudstack/network/NetworkOrchestrator.java
----------------------------------------------------------------------
diff --git a/engine/network/src/org/apache/cloudstack/network/NetworkOrchestrator.java b/engine/network/src/org/apache/cloudstack/network/NetworkOrchestrator.java
new file mode 100755
index 0000000..82756ac
--- /dev/null
+++ b/engine/network/src/org/apache/cloudstack/network/NetworkOrchestrator.java
@@ -0,0 +1,40 @@
+/*
+ * 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.network;
+
+public interface NetworkOrchestrator {
+
+ /**
+ * Prepares for a VM to join a network
+ * @param vm vm
+ * @param reservationId reservation id
+ */
+ void prepare(String vm, String reservationId);
+
+ /**
+ * Release all reservation
+ */
+ void release(String vm, String reservationId);
+
+ /**
+ * Cancel a previous reservation
+ * @param reservationId
+ */
+ void cancel(String reservationId);
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/orchestration/pom.xml
----------------------------------------------------------------------
diff --git a/engine/orchestration/pom.xml b/engine/orchestration/pom.xml
new file mode 100755
index 0000000..2f03547
--- /dev/null
+++ b/engine/orchestration/pom.xml
@@ -0,0 +1,52 @@
+<!--
+ 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-orchestration</artifactId>
+ <name>Apache CloudStack Cloud Engine Orchestration Component</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-engine-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cloudstack</groupId>
+ <artifactId>cloud-framework-ipc</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cloudstack</groupId>
+ <artifactId>cloud-engine-components-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/orchestration/src/org/apache/cloudstack/platform/orchestration/CloudOrchestrator.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/platform/orchestration/CloudOrchestrator.java b/engine/orchestration/src/org/apache/cloudstack/platform/orchestration/CloudOrchestrator.java
new file mode 100755
index 0000000..34154ad
--- /dev/null
+++ b/engine/orchestration/src/org/apache/cloudstack/platform/orchestration/CloudOrchestrator.java
@@ -0,0 +1,82 @@
+/*
+ * 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.orchestration;
+
+import java.net.URL;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.cloudstack.platform.cloud.entity.api.VirtualMachineEntity;
+import org.apache.cloudstack.platform.cloud.entity.api.VolumeEntity;
+import org.apache.cloudstack.platform.service.api.OrchestrationService;
+
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.hypervisor.Hypervisor;
+
+
+public class CloudOrchestrator implements OrchestrationService {
+
+ public VirtualMachineEntity create(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) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public VirtualMachineEntity createFromScratch(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) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String reserve(String vm, String planner, Long until) throws InsufficientCapacityException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String deploy(String reservationId) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void joinNetwork(String network1, String network2) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void createNetwork() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void destroyNetwork() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public VolumeEntity createVolume() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void registerTemplate(String name, URL path, String os, Hypervisor hypervisor) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/planning/src/org/apache/cloudstack/platform/planning/Concierge.java
----------------------------------------------------------------------
diff --git a/engine/planning/src/org/apache/cloudstack/platform/planning/Concierge.java b/engine/planning/src/org/apache/cloudstack/platform/planning/Concierge.java
new file mode 100755
index 0000000..97dfb2b
--- /dev/null
+++ b/engine/planning/src/org/apache/cloudstack/platform/planning/Concierge.java
@@ -0,0 +1,36 @@
+/*
+ * 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.planning;
+
+import org.apache.cloudstack.framework.ipc.Ipc;
+
+public interface Concierge {
+ @Ipc(topic="cs.concierge.reserve")
+ String reserve(String vm, String planner, Long until);
+
+ @Ipc(topic="cs.concierge.cancel")
+ String cancel(String reservationId);
+
+ @Ipc(topic="cs.concierge.claim")
+ String claim(String reservationId);
+
+ @Ipc(topic="cs.concierge.reserveAnother")
+ String reserveAnother(String reservationId);
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/pom.xml
----------------------------------------------------------------------
diff --git a/engine/pom.xml b/engine/pom.xml
new file mode 100644
index 0000000..ba8b738
--- /dev/null
+++ b/engine/pom.xml
@@ -0,0 +1,44 @@
+<!--
+ 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</artifactId>
+ <name>Apache CloudStack Cloud Engine</name>
+ <packaging>pom</packaging>
+ <parent>
+ <groupId>org.apache.cloudstack</groupId>
+ <artifactId>cloudstack</artifactId>
+ <version>4.1.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <build>
+ <defaultGoal>install</defaultGoal>
+ <sourceDirectory>src</sourceDirectory>
+ <testSourceDirectory>test</testSourceDirectory>
+ </build>
+ <modules>
+ <module>api</module>
+ <module>compute</module>
+ <module>orchestration</module>
+ <module>storage</module>
+ <module>components-api</module>
+ <module>schema</module>
+ <module>network</module>
+ </modules>
+</project>
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/schema/pom.xml
----------------------------------------------------------------------
diff --git a/engine/schema/pom.xml b/engine/schema/pom.xml
new file mode 100644
index 0000000..3e38a84
--- /dev/null
+++ b/engine/schema/pom.xml
@@ -0,0 +1,52 @@
+<!--
+ 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-schema</artifactId>
+ <name>Apache CloudStack Cloud Engine Schema Component</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-engine-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cloudstack</groupId>
+ <artifactId>cloud-framework-ipc</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cloudstack</groupId>
+ <artifactId>cloud-engine-components-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/storage/pom.xml
----------------------------------------------------------------------
diff --git a/engine/storage/pom.xml b/engine/storage/pom.xml
new file mode 100644
index 0000000..f922a21
--- /dev/null
+++ b/engine/storage/pom.xml
@@ -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. -->
+<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-storage</artifactId>
+ <name>Apache CloudStack Engine Storage Component</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>
+ <dependency>
+ <groupId>org.apache.cloudstack</groupId>
+ <artifactId>cloud-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cloudstack</groupId>
+ <artifactId>cloud-server</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cloudstack</groupId>
+ <artifactId>cloud-engine-components-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cloudstack</groupId>
+ <artifactId>cloud-engine-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openjpa</groupId>
+ <artifactId>openjpa</artifactId>
+ <version>2.2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>mysql</groupId>
+ <artifactId>mysql-connector-java</artifactId>
+ <version>${cs.mysql.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-all</artifactId>
+ <version>1.9.5</version>
+ </dependency>
+ <dependency>
+ <groupId>org.aspectj</groupId>
+ <artifactId>aspectjrt</artifactId>
+ <version>1.7.1</version>
+</dependency>
+<dependency>
+ <groupId>org.aspectj</groupId>
+ <artifactId>aspectjweaver</artifactId>
+ <version>1.7.1</version>
+</dependency>
+<dependency>
+ <groupId>javax.inject</groupId>
+ <artifactId>javax.inject</artifactId>
+ <version>1</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/storage/src/org/apache/cloudstack/storage/BaseType.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/BaseType.java b/engine/storage/src/org/apache/cloudstack/storage/BaseType.java
new file mode 100644
index 0000000..12acc7d
--- /dev/null
+++ b/engine/storage/src/org/apache/cloudstack/storage/BaseType.java
@@ -0,0 +1,40 @@
+/*
+ * 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.storage;
+
+public abstract class BaseType {
+ public boolean equals(Object that) {
+ if (this == that) {
+ return true;
+ }
+ if (that instanceof String) {
+ if (this.toString().equalsIgnoreCase((String)that)) {
+ return true;
+ }
+ } else if (that instanceof BaseType) {
+ BaseType th = (BaseType)that;
+ if (this.toString().equalsIgnoreCase(th.toString())) {
+ return true;
+ }
+ } else {
+ return false;
+ }
+ return false;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/storage/src/org/apache/cloudstack/storage/EndPoint.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/EndPoint.java b/engine/storage/src/org/apache/cloudstack/storage/EndPoint.java
new file mode 100644
index 0000000..0a3dfa2
--- /dev/null
+++ b/engine/storage/src/org/apache/cloudstack/storage/EndPoint.java
@@ -0,0 +1,8 @@
+package org.apache.cloudstack.storage;
+
+import com.cloud.agent.api.Answer;
+import com.cloud.agent.api.Command;
+
+public interface EndPoint {
+ public Answer sendMessage(Command cmd);
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/storage/src/org/apache/cloudstack/storage/HypervisorHostEndPoint.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/HypervisorHostEndPoint.java b/engine/storage/src/org/apache/cloudstack/storage/HypervisorHostEndPoint.java
new file mode 100644
index 0000000..8bd51c7
--- /dev/null
+++ b/engine/storage/src/org/apache/cloudstack/storage/HypervisorHostEndPoint.java
@@ -0,0 +1,55 @@
+/*
+ * 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.storage;
+
+import javax.inject.Inject;
+
+import org.apache.log4j.Logger;
+
+import com.cloud.agent.AgentManager;
+import com.cloud.agent.api.Answer;
+import com.cloud.agent.api.Command;
+import com.cloud.exception.AgentUnavailableException;
+import com.cloud.exception.OperationTimedoutException;
+
+public class HypervisorHostEndPoint implements EndPoint {
+ private static final Logger s_logger = Logger.getLogger(HypervisorHostEndPoint.class);
+ private long hostId;
+ @Inject
+ AgentManager agentMgr;
+ public HypervisorHostEndPoint(long hostId) {
+ this.hostId = hostId;
+ }
+
+ @Override
+ public Answer sendMessage(Command cmd) {
+ Answer answer = null;
+ try {
+ answer = agentMgr.send(hostId, cmd);
+ } catch (AgentUnavailableException e) {
+ s_logger.debug("Unable to send command:" + cmd + ", due to: " + e.toString());
+ } catch (OperationTimedoutException e) {
+ s_logger.debug("Unable to send command:" + cmd + ", due to: " + e.toString());
+ } catch (Exception e) {
+ s_logger.debug("Unable to send command:" + cmd + ", due to: " + e.toString());
+ }
+ return answer;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/storage/src/org/apache/cloudstack/storage/StorageOrchestrator.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/StorageOrchestrator.java b/engine/storage/src/org/apache/cloudstack/storage/StorageOrchestrator.java
new file mode 100755
index 0000000..691c413
--- /dev/null
+++ b/engine/storage/src/org/apache/cloudstack/storage/StorageOrchestrator.java
@@ -0,0 +1,59 @@
+/*
+ * 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.storage;
+
+import java.util.List;
+
+import com.cloud.deploy.DeploymentPlan;
+
+public interface StorageOrchestrator {
+
+ /**
+ * Prepares all storage ready for a VM to start
+ * @param vm
+ * @param reservationId
+ */
+ void prepare(long vmId, DeploymentPlan plan, String reservationId);
+
+ /**
+ * Releases all storage that were used for a VM shutdown
+ * @param vm
+ * @param disks
+ * @param reservationId
+ */
+ void release(long vmId, String reservationId);
+
+ /**
+ * Destroy all disks
+ * @param disks
+ * @param reservationId
+ */
+ void destroy(List<Long> disks, String reservationId);
+
+ /**
+ * Cancel a reservation
+ * @param reservationId reservation to
+ */
+ void cancel(String reservationId);
+
+ /**
+ * If attaching a volume in allocated state to a running vm, need to create this volume
+ */
+ void prepareAttachDiskToVM(long diskId, long vmId, String reservationId);
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/storage/src/org/apache/cloudstack/storage/StorageOrchestratorImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/StorageOrchestratorImpl.java b/engine/storage/src/org/apache/cloudstack/storage/StorageOrchestratorImpl.java
new file mode 100644
index 0000000..7c88cae
--- /dev/null
+++ b/engine/storage/src/org/apache/cloudstack/storage/StorageOrchestratorImpl.java
@@ -0,0 +1,315 @@
+/*
+ * 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.storage;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.cloudstack.platform.subsystem.api.storage.DataObjectBackupStorageOperationState;
+import org.apache.cloudstack.platform.subsystem.api.storage.DataStore;
+import org.apache.cloudstack.platform.subsystem.api.storage.StorageProvider;
+import org.apache.cloudstack.platform.subsystem.api.storage.TemplateProfile;
+import org.apache.cloudstack.platform.subsystem.api.storage.VolumeProfile;
+import org.apache.cloudstack.platform.subsystem.api.storage.VolumeStrategy;
+import org.apache.cloudstack.storage.image.ImageManager;
+import org.apache.cloudstack.storage.manager.BackupStorageManager;
+import org.apache.cloudstack.storage.manager.SecondaryStorageManager;
+import org.apache.cloudstack.storage.volume.VolumeManager;
+import org.apache.log4j.Logger;
+
+import com.cloud.deploy.DeploymentPlan;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.offering.DiskOffering;
+import com.cloud.storage.DiskOfferingVO;
+import com.cloud.storage.StoragePool;
+import com.cloud.storage.Volume;
+import com.cloud.storage.VolumeVO;
+import com.cloud.storage.dao.DiskOfferingDao;
+import com.cloud.storage.dao.StoragePoolDao;
+import com.cloud.storage.dao.VMTemplateDao;
+import com.cloud.storage.dao.VolumeDao;
+import com.cloud.storage.dao.VolumeHostDao;
+import com.cloud.template.VirtualMachineTemplate;
+import com.cloud.utils.component.Inject;
+import com.cloud.utils.db.DB;
+import com.cloud.utils.db.Transaction;
+import com.cloud.utils.exception.CloudRuntimeException;
+import com.cloud.utils.fsm.NoTransitionException;
+import com.cloud.vm.VirtualMachine;
+import com.cloud.vm.dao.VMInstanceDao;
+
+public class StorageOrchestratorImpl implements StorageOrchestrator {
+ private static final Logger s_logger = Logger.getLogger(StorageOrchestratorImpl.class);
+ @Inject
+ StoragePoolDao _storagePoolDao;
+ @Inject
+ StorageProviderManager _spManager;
+ @Inject
+ VolumeDao _volumeDao;
+ @Inject
+ VMInstanceDao _vmDao;
+ @Inject
+ DiskOfferingDao _diskOfferingDao;
+ @Inject
+ VolumeHostDao _volumeHostDao;
+ @Inject
+ StorageProviderManager _storageProviderMgr;
+ @Inject
+ VolumeManager _volumeMgr;
+ @Inject
+ SecondaryStorageManager _secondaryStorageMgr;
+ @Inject
+ ImageManager _templateMgr;
+ @Inject
+ VMTemplateDao _templateDao;
+
+ @DB
+ protected Volume copyVolumeFromBackupStorage(VolumeVO volume, DataStore destStore, String reservationId) throws NoTransitionException {
+ DataStore ds = _secondaryStorageMgr.getStore(volume);
+ if (!ds.contains(volume)) {
+ throw new CloudRuntimeException("volume: " + volume + "doesn't exist on backup storage");
+ }
+
+ VolumeProfile vp = ds.prepareVolume(volume, destStore);
+
+ VolumeStrategy vs = destStore.getVolumeStrategy();
+
+ Transaction txn = Transaction.currentTxn();
+ volume.setReservationId(reservationId);
+ _volumeMgr.processEvent(volume, Volume.Event.CopyRequested);
+ VolumeVO destVolume = _volumeMgr.allocateDuplicateVolume(volume);
+ destVolume = _volumeMgr.processEvent(destVolume, Volume.Event.CreateRequested);
+ txn.commit();
+
+ vs.copyVolumeFromBackup(vp, destVolume);
+
+ txn.start();
+ volume = _volumeMgr.processEvent(volume, Volume.Event.OperationSucceeded);
+ destVolume = _volumeMgr.processEvent(destVolume, Volume.Event.OperationSucceeded);
+ txn.commit();
+
+ return destVolume;
+ }
+
+ @DB
+ protected Volume migrateVolume(VolumeVO volume, DataStore srcStore, DataStore destStore, String reservationId) throws NoTransitionException {
+ Transaction txn = Transaction.currentTxn();
+ txn.start();
+ volume.setReservationId(reservationId);
+ volume = _volumeMgr.processEvent(volume, Volume.Event.MigrationRequested);
+ Volume destVolume = _volumeMgr.allocateDuplicateVolume(volume);
+ destVolume = _volumeMgr.processEvent(destVolume, Volume.Event.CreateRequested);
+ txn.commit();
+
+ VolumeStrategy vs = srcStore.getVolumeStrategy();
+ vs.migrateVolume(volume, destVolume, destStore);
+
+ txn.start();
+ volume = _volumeMgr.processEvent(volume, Volume.Event.OperationSucceeded);
+ destVolume = _volumeMgr.processEvent(destVolume, Volume.Event.OperationSucceeded);
+ txn.commit();
+
+ volume = _volumeMgr.processEvent(volume, Volume.Event.DestroyRequested);
+
+ vs.deleteVolume(volume);
+
+ _volumeMgr.processEvent(volume, Volume.Event.OperationSucceeded);
+ return destVolume;
+ }
+
+ @DB
+ protected Volume recreateVolume(VolumeVO srcVolume, DataStore destStore, String reservationId) throws NoTransitionException {
+ Transaction txn = Transaction.currentTxn();
+ txn.start();
+ srcVolume.setReservationId(reservationId);
+ srcVolume = _volumeMgr.processEvent(srcVolume, Volume.Event.CopyRequested);
+ Volume destVolume = _volumeMgr.allocateDuplicateVolume(srcVolume);
+ destVolume = _volumeMgr.processEvent(destVolume, Volume.Event.CreateRequested);
+ txn.commit();
+
+ DataStore srcStore = _storageProviderMgr.getDataStore(srcVolume.getPoolId());
+ VolumeStrategy vs = srcStore.getVolumeStrategy();
+
+ vs.migrateVolume(srcVolume, destVolume, destStore);
+
+ txn.start();
+ srcVolume = _volumeMgr.processEvent(srcVolume, Volume.Event.OperationSucceeded);
+ destVolume = _volumeMgr.processEvent(destVolume, Volume.Event.OperationSucceeded);
+ txn.commit();
+
+ srcVolume = _volumeMgr.processEvent(srcVolume, Volume.Event.DestroyRequested);
+
+ vs.deleteVolume(srcVolume);
+
+ _volumeMgr.processEvent(srcVolume, Volume.Event.OperationSucceeded);
+
+ return destVolume;
+ }
+
+ protected Volume createVolumeOnStorage(Volume volume, DataStore destStore, String reservationId) throws NoTransitionException {
+ VolumeStrategy vs = destStore.getVolumeStrategy();
+ volume.setReservationId(reservationId);
+ volume = _volumeMgr.processEvent(volume, Volume.Event.CreateRequested);
+
+ if (volume.getTemplateId() != null) {
+ DataStore ds = _secondaryStorageMgr.getImageStore(destStore);
+ TemplateProfile tp = ds.prepareTemplate(volume.getTemplateId(), destStore);
+ if (!destStore.contains(tp)) {
+ tp = _templateMgr.AssociateTemplateStoragePool(tp, destStore);
+ tp = destStore.getTemplateStrategy().install(tp);
+ } else {
+ tp = destStore.getTemplateStrategy().get(tp.getId());
+ }
+ volume = vs.createVolumeFromBaseTemplate(volume, tp);
+ } else {
+ volume = vs.createDataVolume(volume);
+ }
+
+ volume = _volumeMgr.processEvent(volume, Volume.Event.OperationSucceeded);
+ return volume;
+ }
+
+ @DB
+ protected void prepareVolumes(List<VolumeVO> vols, Long destPoolId, String reservationId) throws NoTransitionException {
+ DataStore destStore = null;
+ if (destPoolId != null) {
+ destStore = _storageProviderMgr.getDataStore(destPoolId);
+ }
+
+ for (VolumeVO volume : vols) {
+ if (volume.getPoolId() == null && destStore == null) {
+ throw new CloudRuntimeException("Volume has no pool associate and also no storage pool assigned in DeployDestination, Unable to create.");
+ }
+ if (destStore == null) {
+ continue;
+ }
+
+ DataStore srcStore = _storageProviderMgr.getDataStore(volume.getPoolId());
+ boolean needToCreateVolume = false;
+ boolean needToRecreateVolume = false;
+ boolean needToMigrateVolume = false;
+ boolean needToCopyFromSec = false;
+
+ Volume.State state = volume.getState();
+ if (state == Volume.State.Allocated) {
+ needToCreateVolume = true;
+ } else if (state == Volume.State.UploadOp) {
+ needToCopyFromSec = true;
+ } else if (destStore.getId() != srcStore.getId()) {
+ if (s_logger.isDebugEnabled()) {
+ s_logger.debug("Mismatch in storage pool " + destStore.getId() + " assigned by deploymentPlanner and the one associated with volume " + volume);
+ }
+
+ if (volume.isRecreatable()) {
+ needToRecreateVolume = true;
+ } else {
+ if (Volume.Type.ROOT == volume.getVolumeType()) {
+ needToMigrateVolume = true;
+ } else {
+ if (destStore.getCluterId() != srcStore.getCluterId()) {
+ needToMigrateVolume = true;
+ } else if (!srcStore.isSharedStorage() && srcStore.getId() != destStore.getId()) {
+ needToMigrateVolume = true;
+ } else {
+ continue;
+ }
+ }
+ }
+ } else {
+ continue;
+ }
+
+
+ if (needToCreateVolume) {
+ createVolumeOnStorage(volume, destStore, reservationId);
+ } else if (needToMigrateVolume) {
+ migrateVolume(volume, srcStore, destStore, reservationId);
+ } else if (needToCopyFromSec) {
+ copyVolumeFromBackupStorage(volume, destStore, reservationId);
+ } else if (needToRecreateVolume) {
+ recreateVolume(volume, destStore, reservationId);
+ }
+ }
+ }
+
+ public void prepare(long vmId, DeploymentPlan plan, String reservationId) {
+ VirtualMachine vm = _vmDao.findById(vmId);
+
+
+ List<VolumeVO> vols = _volumeDao.findUsableVolumesForInstance(vm.getId());
+ if (s_logger.isDebugEnabled()) {
+ s_logger.debug("Prepare " + vols.size() + " volumes for " + vm.getInstanceName());
+ }
+
+ try {
+ prepareVolumes(vols, plan.getPoolId(), reservationId);
+ } catch (NoTransitionException e) {
+ s_logger.debug("Failed to prepare volume: " + e.toString());
+ }
+ }
+
+
+ public void release(long vmId, String reservationId) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void destroy(List<Long> disks, String reservationId) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void cancel(String reservationId) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void prepareAttachDiskToVM(long diskId, long vmId, String reservationId) {
+ VirtualMachine vm = _vmDao.findById(vmId);
+
+ if (vm == null || vm.getState() != VirtualMachine.State.Running) {
+ return;
+ }
+
+ VolumeVO volume = _volumeDao.findById(diskId);
+ if (volume.getInstanceId() != null) {
+ if (volume.getInstanceId() != vmId) {
+ throw new InvalidParameterValueException("Volume " + volume + "already attached to " + volume.getInstanceId());
+ } else {
+ return;
+ }
+ }
+
+ List<VolumeVO> vols = new ArrayList<VolumeVO>();
+ vols.add(volume);
+
+ List<VolumeVO> rootDisks = _volumeDao.findByInstanceAndType(vmId, Volume.Type.ROOT);
+ VolumeVO rootDisk = rootDisks.get(0);
+ try {
+ prepareVolumes(vols, rootDisk.getPoolId(), reservationId);
+ } catch (NoTransitionException e) {
+ s_logger.debug("Failed to prepare volume: " + volume + ", due to" + e.toString());
+ throw new CloudRuntimeException(e.toString());
+ }
+
+ volume = _volumeDao.findById(diskId);
+ volume.setInstanceId(vmId);
+ _volumeDao.update(volume.getId(), volume);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/storage/src/org/apache/cloudstack/storage/StorageProviderManager.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/StorageProviderManager.java b/engine/storage/src/org/apache/cloudstack/storage/StorageProviderManager.java
new file mode 100644
index 0000000..e7b03a7
--- /dev/null
+++ b/engine/storage/src/org/apache/cloudstack/storage/StorageProviderManager.java
@@ -0,0 +1,11 @@
+package org.apache.cloudstack.storage;
+
+import org.apache.cloudstack.platform.subsystem.api.storage.DataStore;
+import org.apache.cloudstack.platform.subsystem.api.storage.StorageProvider;
+
+public interface StorageProviderManager {
+ StorageProvider getProvider(String uuid);
+ StorageProvider getProvider(long poolId);
+ StorageProvider getBackupStorageProvider(long zoneId);
+ DataStore getDataStore(long poolId);
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/storage/src/org/apache/cloudstack/storage/StorageProviderManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/StorageProviderManagerImpl.java b/engine/storage/src/org/apache/cloudstack/storage/StorageProviderManagerImpl.java
new file mode 100644
index 0000000..6bfdf1d
--- /dev/null
+++ b/engine/storage/src/org/apache/cloudstack/storage/StorageProviderManagerImpl.java
@@ -0,0 +1,55 @@
+package org.apache.cloudstack.storage;
+
+import java.util.Map;
+
+import javax.naming.ConfigurationException;
+
+import org.apache.cloudstack.platform.subsystem.api.storage.DataStore;
+import org.apache.cloudstack.platform.subsystem.api.storage.StorageProvider;
+
+import com.cloud.utils.component.Manager;
+
+public class StorageProviderManagerImpl implements StorageProviderManager, Manager {
+
+ public StorageProvider getProvider(String uuid) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public boolean configure(String name, Map<String, Object> params)
+ throws ConfigurationException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public boolean start() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public boolean stop() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public String getName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public StorageProvider getProvider(long poolId) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public StorageProvider getBackupStorageProvider(long zoneId) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public DataStore getDataStore(long poolId) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/storage/src/org/apache/cloudstack/storage/VolumeBackupRef.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/VolumeBackupRef.java b/engine/storage/src/org/apache/cloudstack/storage/VolumeBackupRef.java
new file mode 100644
index 0000000..64402d3
--- /dev/null
+++ b/engine/storage/src/org/apache/cloudstack/storage/VolumeBackupRef.java
@@ -0,0 +1,66 @@
+/*
+ * 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.storage;
+
+import java.util.Date;
+
+import org.apache.cloudstack.platform.subsystem.api.storage.DataObjectBackupStorageOperationState;
+
+import com.cloud.storage.Storage;
+import com.cloud.storage.VMTemplateStorageResourceAssoc;
+import com.cloud.storage.Storage.ImageFormat;
+import com.cloud.storage.VMTemplateStorageResourceAssoc.Status;
+
+public interface VolumeBackupRef {
+ public DataObjectBackupStorageOperationState getOperationState();
+
+ public String getInstallPath();
+
+ public long getHostId();
+
+ public long getVolumeId();
+
+ public long getZoneId();
+
+ public int getDownloadPercent();
+
+ public long getVolumeSize();
+
+ public Storage.ImageFormat getFormat();
+
+ public String getDownloadUrl();
+
+ public boolean getDestroyed();
+
+ public long getPhysicalSize();
+
+ public long getSize();
+
+ public String getLocalDownloadPath();
+
+ public String getChecksum();
+
+ public Status getDownloadState();
+
+ public Date getLastUpdated();
+
+ public Date getCreated();
+
+ public long getId();
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/storage/src/org/apache/cloudstack/storage/backup/BackupMotionService.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/backup/BackupMotionService.java b/engine/storage/src/org/apache/cloudstack/storage/backup/BackupMotionService.java
new file mode 100644
index 0000000..5105e25
--- /dev/null
+++ b/engine/storage/src/org/apache/cloudstack/storage/backup/BackupMotionService.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.storage.backup;
+
+public interface BackupMotionService {
+ boolean copySnapshot(String snapshotUri, String destSnapshotUri);
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/storage/src/org/apache/cloudstack/storage/backup/BackupService.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/backup/BackupService.java b/engine/storage/src/org/apache/cloudstack/storage/backup/BackupService.java
new file mode 100644
index 0000000..198247d
--- /dev/null
+++ b/engine/storage/src/org/apache/cloudstack/storage/backup/BackupService.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.storage.backup;
+
+public interface BackupService {
+ String grantAccessSnapshot(long snapshotId, long endpointId);
+ boolean revokeAccessSnapshot(long snapshotId, long endpointId);
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/storage/src/org/apache/cloudstack/storage/command/CreateVolumeAnswer.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/command/CreateVolumeAnswer.java b/engine/storage/src/org/apache/cloudstack/storage/command/CreateVolumeAnswer.java
new file mode 100644
index 0000000..e75307c
--- /dev/null
+++ b/engine/storage/src/org/apache/cloudstack/storage/command/CreateVolumeAnswer.java
@@ -0,0 +1,36 @@
+/*
+ * 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.storage.command;
+
+import com.cloud.agent.api.Answer;
+
+public class CreateVolumeAnswer extends Answer {
+ private String volumeUuid;
+ protected CreateVolumeAnswer() {
+ super();
+ }
+
+ public CreateVolumeAnswer(String volumeUuid) {
+ this.volumeUuid = volumeUuid;
+ }
+
+ public String getVolumeUuid() {
+ return this.volumeUuid;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/storage/src/org/apache/cloudstack/storage/command/CreateVolumeCommand.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/command/CreateVolumeCommand.java b/engine/storage/src/org/apache/cloudstack/storage/command/CreateVolumeCommand.java
new file mode 100644
index 0000000..243e016
--- /dev/null
+++ b/engine/storage/src/org/apache/cloudstack/storage/command/CreateVolumeCommand.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.storage.command;
+
+import org.apache.cloudstack.storage.volume.VolumeInfo;
+
+import com.cloud.agent.api.Command;
+
+public class CreateVolumeCommand extends Command {
+ protected VolumeInfo volumeInfo;
+ public CreateVolumeCommand(VolumeInfo volumeInfo) {
+ super();
+ this.volumeInfo = volumeInfo;
+ }
+
+ protected CreateVolumeCommand() {
+ super();
+ }
+
+ @Override
+ public boolean executeInSequence() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a6df8a5b/engine/storage/src/org/apache/cloudstack/storage/datastore/DataStoreStatus.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/DataStoreStatus.java b/engine/storage/src/org/apache/cloudstack/storage/datastore/DataStoreStatus.java
new file mode 100644
index 0000000..65f46b1
--- /dev/null
+++ b/engine/storage/src/org/apache/cloudstack/storage/datastore/DataStoreStatus.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.storage.datastore;
+
+public enum DataStoreStatus {
+ Creating,
+ Up,
+ PrepareForMaintenance,
+ ErrorInMaintenance,
+ CancelMaintenance,
+ Maintenance,
+ Removed;
+}