diff --git a/framework/events/.classpath b/framework/events/.classpath new file mode 100755 index 00000000000..fb5011632c0 --- /dev/null +++ b/framework/events/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/framework/events/.project b/framework/events/.project new file mode 100755 index 00000000000..677cea5251f --- /dev/null +++ b/framework/events/.project @@ -0,0 +1,17 @@ + + + framework-events + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/framework/ipc/.classpath b/framework/ipc/.classpath new file mode 100755 index 00000000000..fb565a588d8 --- /dev/null +++ b/framework/ipc/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/framework/ipc/.project b/framework/ipc/.project new file mode 100755 index 00000000000..11b896884b9 --- /dev/null +++ b/framework/ipc/.project @@ -0,0 +1,17 @@ + + + framework-ipc + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/framework/ipc/.settings/org.eclipse.jdt.core.prefs b/framework/ipc/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 00000000000..7341ab1683c --- /dev/null +++ b/framework/ipc/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.7 diff --git a/framework/ipc/src/org/apache/cloudstack/framework/container/ServerContainer.java b/framework/ipc/src/org/apache/cloudstack/framework/container/ServerContainer.java new file mode 100755 index 00000000000..04ec03178a8 --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/container/ServerContainer.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.framework.container; + +/** + * Container of different processes so it doesn't have to deal with message + * to Java call. + */ +public interface ServerContainer { + +} diff --git a/framework/ipc/src/org/apache/cloudstack/framework/ipc/Ipc.java b/framework/ipc/src/org/apache/cloudstack/framework/ipc/Ipc.java new file mode 100755 index 00000000000..31903c5d043 --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/ipc/Ipc.java @@ -0,0 +1,33 @@ +/* + * 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.framework.ipc; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Marks a method as an ipc mechanism + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.METHOD) +public @interface Ipc { + String topic(); +} diff --git a/framework/ipc/src/org/apache/cloudstack/framework/ipc/IpcIntercepter.java b/framework/ipc/src/org/apache/cloudstack/framework/ipc/IpcIntercepter.java new file mode 100755 index 00000000000..82c2a473a11 --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/ipc/IpcIntercepter.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.framework.ipc; + +public class IpcIntercepter { + +} diff --git a/framework/ipc/src/org/apache/cloudstack/framework/ipc/IpcParam.java b/framework/ipc/src/org/apache/cloudstack/framework/ipc/IpcParam.java new file mode 100755 index 00000000000..9bb811db5b9 --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/ipc/IpcParam.java @@ -0,0 +1,22 @@ +/* + * 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.framework.ipc; + +public @interface IpcParam { +} diff --git a/framework/ipc/src/org/apache/cloudstack/framework/ipc/Message.java b/framework/ipc/src/org/apache/cloudstack/framework/ipc/Message.java new file mode 100755 index 00000000000..cb5a043f61d --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/ipc/Message.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.framework.ipc; + +import java.util.Map; + +public interface Message { + String getTopic(); + Map getContent(); +} diff --git a/framework/ipc/src/org/apache/cloudstack/framework/ipc/MessageSystem.java b/framework/ipc/src/org/apache/cloudstack/framework/ipc/MessageSystem.java new file mode 100755 index 00000000000..e5685f55980 --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/ipc/MessageSystem.java @@ -0,0 +1,43 @@ +/* + * 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.framework.ipc; + +public interface MessageSystem { + /** + * Creates the publisher + * @param name of the publisher + * @return publisher + */ + Publisher createPublisher(String name); + + /** + * Creates the subscriber + * @param name of the subscriber + * @return subscriber + */ + Subscriber createSubscriber(String name); + + /** + * registers the subscriber + * @param subscriber subscriber + * @param topic topic to listen to + * @return subscriber + */ + boolean registerSubscriber(Subscriber subscriber, String topic); +} diff --git a/framework/ipc/src/org/apache/cloudstack/framework/ipc/Publisher.java b/framework/ipc/src/org/apache/cloudstack/framework/ipc/Publisher.java new file mode 100755 index 00000000000..4afabd45321 --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/ipc/Publisher.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.framework.ipc; + +import java.util.Map; + +/** + * Publish the Event + * + */ +public interface Publisher { + /** + * Publish a topic + * + * @param topic topic being published + * @param content content published + * @return true if the topic has been picked up; false if not. + */ + boolean publish(String topic, Map content); + + /** + * @return the name of this publisher + */ + String getName(); + +} diff --git a/framework/ipc/src/org/apache/cloudstack/framework/ipc/Subscriber.java b/framework/ipc/src/org/apache/cloudstack/framework/ipc/Subscriber.java new file mode 100755 index 00000000000..56e58266eac --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/ipc/Subscriber.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.framework.ipc; + +/** + * Event subscriber interface + * + */ +public interface Subscriber { + + /** + * Message received + */ + Message receive(); + + /** + * @return the name of the subscriber + */ + String getName(); + +} diff --git a/framework/jobs/.classpath b/framework/jobs/.classpath new file mode 100755 index 00000000000..fb565a588d8 --- /dev/null +++ b/framework/jobs/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/framework/jobs/.project b/framework/jobs/.project new file mode 100755 index 00000000000..edada9c5a7f --- /dev/null +++ b/framework/jobs/.project @@ -0,0 +1,17 @@ + + + framework-jobs + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/framework/jobs/.settings/org.eclipse.jdt.core.prefs b/framework/jobs/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 00000000000..7341ab1683c --- /dev/null +++ b/framework/jobs/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.7 diff --git a/framework/jobs/src/org/apache/cloudstack/framework/job/Job.java b/framework/jobs/src/org/apache/cloudstack/framework/job/Job.java new file mode 100755 index 00000000000..6d284450689 --- /dev/null +++ b/framework/jobs/src/org/apache/cloudstack/framework/job/Job.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.framework.job; + +public @interface Job { + + +} diff --git a/framework/jobs/src/org/apache/cloudstack/framework/job/JobInterceptor.java b/framework/jobs/src/org/apache/cloudstack/framework/job/JobInterceptor.java new file mode 100755 index 00000000000..6265f8ddccf --- /dev/null +++ b/framework/jobs/src/org/apache/cloudstack/framework/job/JobInterceptor.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.framework.job; + +/** + * @author ahuang + * + */ +public class JobInterceptor { + +} diff --git a/platform/api/.classpath b/platform/api/.classpath new file mode 100755 index 00000000000..1275c985df6 --- /dev/null +++ b/platform/api/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/platform/api/.project b/platform/api/.project new file mode 100755 index 00000000000..6515efe79b0 --- /dev/null +++ b/platform/api/.project @@ -0,0 +1,17 @@ + + + platform-api + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/platform/api/src/org/apache/cloudstack/platform/service/api/DirectoryService.java b/platform/api/src/org/apache/cloudstack/platform/service/api/DirectoryService.java new file mode 100755 index 00000000000..b724a8656ed --- /dev/null +++ b/platform/api/src/org/apache/cloudstack/platform/service/api/DirectoryService.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.service.api; + +import java.net.URI; +import java.util.List; + +public interface DirectoryService { + void registerService(String serviceName, URI endpoint); + void unregisterService(String serviceName, URI endpoint); + List getEndPoints(String serviceName); + URI getLoadBalancedEndPoint(String serviceName); +} diff --git a/platform/api/src/org/apache/cloudstack/platform/service/api/EntityService.java b/platform/api/src/org/apache/cloudstack/platform/service/api/EntityService.java new file mode 100755 index 00000000000..6983d28ec16 --- /dev/null +++ b/platform/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 listVirtualMachines(); + List listVolumes(); + List listNetworks(); + List listNics(); + List listSnapshots(); + List listTemplates(); + List listStoragePools(); + List listHosts(); + + VirtualMachine getVirtualMachine(String vm); + Volume getVolume(String volume); + Network getNetwork(String network); + +} diff --git a/platform/api/src/org/apache/cloudstack/platform/service/api/JobsManagementService.java b/platform/api/src/org/apache/cloudstack/platform/service/api/JobsManagementService.java new file mode 100755 index 00000000000..ed1c4c005ac --- /dev/null +++ b/platform/api/src/org/apache/cloudstack/platform/service/api/JobsManagementService.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.service.api; + +import java.util.List; + +import com.cloud.async.AsyncJob; + +public interface JobsManagementService { + List listJobs(); + + List listJobsInProgress(); + + List listJobsCompleted(Long from); + + List listJobsInWaiting(); + + void cancelJob(String job); +} diff --git a/platform/api/src/org/apache/cloudstack/platform/service/api/ManagementService.java b/platform/api/src/org/apache/cloudstack/platform/service/api/ManagementService.java new file mode 100755 index 00000000000..128aed0acd1 --- /dev/null +++ b/platform/api/src/org/apache/cloudstack/platform/service/api/ManagementService.java @@ -0,0 +1,64 @@ +/* + * 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 com.cloud.dc.DataCenter; +import com.cloud.dc.Pod; +import com.cloud.host.Host; +import com.cloud.host.Status; +import com.cloud.storage.StoragePool; + + +/** + * ManagementService specifies the management aspects of the + * Orchestration Platform. + */ +public interface ManagementService { + + /** + * Registers a storage to use + * @param uuid + * @return + */ + String registerStorage(String name, List tags, Map details); + String registerZone(String name, List tags, Map details); + String registerPod(String name, List tags, Map details); + String registerCluster(String name, List tags, Map details); + String registerHost(String name, List tags, Map details); + + void deregisterStorage(String uuid); + void deregisterZone(); + void deregisterPod(); + void deregisterCluster(); + void deregisterHost(); + + void changeState(String type, String entity, Status state); + + List listHosts(); + + List listPods(); + + List listZones(); + + List listStorage(); + +} diff --git a/platform/api/src/org/apache/cloudstack/platform/service/api/OrchestrationService.java b/platform/api/src/org/apache/cloudstack/platform/service/api/OrchestrationService.java new file mode 100755 index 00000000000..1eb0474ea6f --- /dev/null +++ b/platform/api/src/org/apache/cloudstack/platform/service/api/OrchestrationService.java @@ -0,0 +1,127 @@ +/* + * 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 com.cloud.exception.InsufficientCapacityException; +import com.cloud.hypervisor.Hypervisor; +import com.cloud.vm.VirtualMachine; + +public interface OrchestrationService { + /** + * Reserves 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 + */ + VirtualMachine create(String uuid, + String template, + String hostName, + int cpu, + int speed, + long memory, + List networks, + List rootDiskTags, + List computeTags, + Map details, + String owner); + + VirtualMachine createFromScratch(String uuid, + String iso, + String os, + String hypervisor, + String hostName, + int cpu, + int speed, + long memory, + List networks, + List computeTags, + Map details, + String owner); + + /** + * Make reservations for a VM + * @param vm uuid of the VM + * @param planner DeploymentPlanner to use + * @param until time specified in seconds before reservation expires. null means to reserve forever. + * @return reservation id + */ + String reserve(String vm, String planner, Long until) throws InsufficientCapacityException; + + String cancel(String reservationId); + + /** + * Deploy the reservation + * @param reservationId reservation id during the deployment + * @return job Id + * @throws CloudRuntimeException if error + */ + @Job(callback=) + String deploy(String reservationId); + + /** + * Stops the vm + * @param vm vm + * @throws CloudRuntimeException if error + */ + String stop(String vm); + + /** + * destroys the vm + * @param vm vm + * @throws CloudRuntimeException if error + */ + void destroy(String vm); + + void joinNetwork(String network1, String network2); + + void attachNetwork(String network, String vm); + + void detachNetwork(String network, String vm); + + void attachVolume(String vm, String vol); + + void createNetwork(); + + void destroyNetwork(); + + void createVolume(); + + void destroyVolume(); + + void snapshotVirtualMachine(String vm); + + void snapshotVolume(String volume); + + void backup(String snapshot); + + void registerTemplate(String name, URL path, String os, Hypervisor hypervisor); +} diff --git a/platform/api/src/org/apache/cloudstack/platform/subsystem/api/hypervisor/ComputeSubsystem.java b/platform/api/src/org/apache/cloudstack/platform/subsystem/api/hypervisor/ComputeSubsystem.java new file mode 100644 index 00000000000..03d19c0e05d --- /dev/null +++ b/platform/api/src/org/apache/cloudstack/platform/subsystem/api/hypervisor/ComputeSubsystem.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.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); +} diff --git a/platform/api/src/org/apache/cloudstack/platform/subsystem/api/network/NetworkServiceProvider.java b/platform/api/src/org/apache/cloudstack/platform/subsystem/api/network/NetworkServiceProvider.java new file mode 100755 index 00000000000..a66a4f54db5 --- /dev/null +++ b/platform/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); +} diff --git a/platform/api/src/org/apache/cloudstack/platform/subsystem/api/network/NetworkSubsystem.java b/platform/api/src/org/apache/cloudstack/platform/subsystem/api/network/NetworkSubsystem.java new file mode 100755 index 00000000000..7e28ed3b848 --- /dev/null +++ b/platform/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 createNetwork(); + + 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); +} diff --git a/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataMigrationSubSystem.java b/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataMigrationSubSystem.java new file mode 100755 index 00000000000..30185b7835f --- /dev/null +++ b/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/DataMigrationSubSystem.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 DataMigrationSubSystem { + void migrate(String volume, String storagePool, String reservationId); +} diff --git a/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/StorageSubSystem.java b/platform/api/src/org/apache/cloudstack/platform/subsystem/api/storage/StorageSubSystem.java new file mode 100755 index 00000000000..e12ff797ad4 --- /dev/null +++ b/platform/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 getScope(); + + URI grantAccess(String vol, String reservationId); + URI RemoveAccess(String vol, String reservationId); +} diff --git a/platform/compute/.classpath b/platform/compute/.classpath new file mode 100755 index 00000000000..9cfdd7f7059 --- /dev/null +++ b/platform/compute/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/platform/compute/.project b/platform/compute/.project new file mode 100755 index 00000000000..763fcb6ca25 --- /dev/null +++ b/platform/compute/.project @@ -0,0 +1,17 @@ + + + platform-compute + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/platform/compute/src/org/apache/cloudstack/compute/ComputeOrchestrator.java b/platform/compute/src/org/apache/cloudstack/compute/ComputeOrchestrator.java new file mode 100755 index 00000000000..21813ab043b --- /dev/null +++ b/platform/compute/src/org/apache/cloudstack/compute/ComputeOrchestrator.java @@ -0,0 +1,38 @@ +/* + * 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 org.apache.cloudstack.framework.ipc.Ipc; +import org.apache.cloudstack.framework.ipc.IpcParam; + +public interface ComputeOrchestrator { + /** + * start the vm + * @param vm vm + * @param reservationId + */ + @Ipc(topic="cs.compute.start") + void start(@IpcParam String vm, @IpcParam String reservationId); + + @Ipc(topic="cs.compute.cancel") + void cancel(@IpcParam String reservationId); + + @Ipc(topic="cs.compute.stop") + void stop(@IpcParam String vm, @IpcParam String reservationId); +} diff --git a/platform/compute/src/org/apache/cloudstack/compute/ComputeOrchestratorImpl.java b/platform/compute/src/org/apache/cloudstack/compute/ComputeOrchestratorImpl.java new file mode 100755 index 00000000000..5030feb22f8 --- /dev/null +++ b/platform/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 + } +} diff --git a/platform/network/.classpath b/platform/network/.classpath new file mode 100755 index 00000000000..fb5011632c0 --- /dev/null +++ b/platform/network/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/platform/network/.project b/platform/network/.project new file mode 100755 index 00000000000..875ec885fbe --- /dev/null +++ b/platform/network/.project @@ -0,0 +1,17 @@ + + + platform-network + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/platform/network/src/org/apache/cloudstack/network/NetworkOrchestrator.java b/platform/network/src/org/apache/cloudstack/network/NetworkOrchestrator.java new file mode 100755 index 00000000000..82756ac8391 --- /dev/null +++ b/platform/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); +} diff --git a/platform/orchestration/.classpath b/platform/orchestration/.classpath new file mode 100755 index 00000000000..3028798ad9a --- /dev/null +++ b/platform/orchestration/.classpath @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/platform/orchestration/.project b/platform/orchestration/.project new file mode 100755 index 00000000000..fe968bce1d7 --- /dev/null +++ b/platform/orchestration/.project @@ -0,0 +1,17 @@ + + + platform-orchestration + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/platform/orchestration/.settings/org.eclipse.jdt.core.prefs b/platform/orchestration/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 00000000000..7341ab1683c --- /dev/null +++ b/platform/orchestration/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.7 diff --git a/platform/orchestration/src/org/apache/cloudstack/platform/orchestration/CloudOrchestrator.java b/platform/orchestration/src/org/apache/cloudstack/platform/orchestration/CloudOrchestrator.java new file mode 100755 index 00000000000..405289dbc8c --- /dev/null +++ b/platform/orchestration/src/org/apache/cloudstack/platform/orchestration/CloudOrchestrator.java @@ -0,0 +1,164 @@ +/* + * 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.framework.ipc.Publisher; +import org.apache.cloudstack.platform.planning.Concierge; +import org.apache.cloudstack.platform.service.api.OrchestrationService; + +import com.cloud.exception.InsufficientCapacityException; +import com.cloud.hypervisor.Hypervisor; +import com.cloud.vm.VirtualMachine; + +public class CloudOrchestrator implements OrchestrationService { + int _retryCount = 5; + Concierge _concierge = null; // These are injected + Publisher _publisher = null; + + @Override + public VirtualMachine create(String uuid, String template, String hostName, int cpu, int speed, long memory, List networks, List rootDiskTags, List computeTags, Map details, + String owner) { + // creates a virtual machine and relevant work in database + return null; + } + + @Override + public VirtualMachine createFromScratch(String uuid, String iso, String os, String hypervisor, String hostName, int cpu, int speed, long memory, List networks, List computeTags, + Map details, String owner) { + // creates a virtual machine and relevant work in database + return null; + } + + @Override + public String reserve(String vm, String planner, Long until) throws InsufficientCapacityException { + return _concierge.reserve(vm, planner); + } + + @Override + public String cancel(String reservationId) { + // TODO Auto-generated method stub + return null; + } + + @Override + public String deploy(String reservationId, String callback) { + for (int i = 0; i < _retryCount; i++) { + try { + // Retrieves the reservation + // Signals Network and Storage to prepare + // Signals Compute + _concierge.claim(reservationId); + } catch (Exception e) { + // Cancel reservations. + } + _concierge.reserveAnother(reservationId); + } + return null; + } + + @Override + public String stop(String vm) { + + // TODO Auto-generated method stub + return null; + } + + @Override + public void destroy(String vm) { + // TODO Auto-generated method stub + + } + + @Override + public void joinNetwork(String network1, String network2) { + // TODO Auto-generated method stub + + } + + @Override + public void attachNetwork(String network, String vm) { + // TODO Auto-generated method stub + + } + + @Override + public void detachNetwork(String network, String vm) { + // TODO Auto-generated method stub + + } + + @Override + public void attachVolume(String vm, String vol) { + // TODO Auto-generated method stub + + } + + @Override + public void createNetwork() { + // TODO Auto-generated method stub + + } + + @Override + public void destroyNetwork() { + // TODO Auto-generated method stub + + } + + @Override + public void createVolume() { + // TODO Auto-generated method stub + + } + + @Override + public void destroyVolume() { + // TODO Auto-generated method stub + + } + + @Override + public void snapshotVirtualMachine(String vm) { + // TODO Auto-generated method stub + + } + + @Override + public void snapshotVolume(String volume) { + // TODO Auto-generated method stub + + } + + @Override + public void backup(String snapshot) { + // TODO Auto-generated method stub + + } + + @Override + public void registerTemplate(String name, URL path, String os, Hypervisor hypervisor) { + // TODO Auto-generated method stub + + } + +} diff --git a/platform/planning/.classpath b/platform/planning/.classpath new file mode 100755 index 00000000000..0fc1f1eb4d8 --- /dev/null +++ b/platform/planning/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/platform/planning/.project b/platform/planning/.project new file mode 100755 index 00000000000..c228af29670 --- /dev/null +++ b/platform/planning/.project @@ -0,0 +1,17 @@ + + + platform-planning + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/platform/planning/src/org/apache/cloudstack/platform/planning/Concierge.java b/platform/planning/src/org/apache/cloudstack/platform/planning/Concierge.java new file mode 100755 index 00000000000..97dfb2bbfe6 --- /dev/null +++ b/platform/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); + +} diff --git a/platform/storage/.classpath b/platform/storage/.classpath new file mode 100755 index 00000000000..fb5011632c0 --- /dev/null +++ b/platform/storage/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/platform/storage/.project b/platform/storage/.project new file mode 100755 index 00000000000..ba98bbb7755 --- /dev/null +++ b/platform/storage/.project @@ -0,0 +1,17 @@ + + + platform-storage + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/platform/storage/src/org/apache/cloudstack/storage/StorageOrchestrator.java b/platform/storage/src/org/apache/cloudstack/storage/StorageOrchestrator.java new file mode 100755 index 00000000000..dc5d7013968 --- /dev/null +++ b/platform/storage/src/org/apache/cloudstack/storage/StorageOrchestrator.java @@ -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. + */ +package org.apache.cloudstack.storage; + +import java.util.List; + +public interface StorageOrchestrator { + + /** + * Prepares all storage ready for a VM to start + * @param vm + * @param reservationId + */ + void prepare(String vm, String reservationId); + + /** + * Releases all storage that were used for a VM shutdown + * @param vm + * @param disks + * @param reservationId + */ + void release(String vm, String reservationId); + + /** + * Destroy all disks + * @param disks + * @param reservationId + */ + void destroy(List disks, String reservationId); + + /** + * Cancel a reservation + * @param reservationId reservation to + */ + void cancel(String reservationId); +}