This commit is contained in:
Alex Huang 2012-08-23 17:47:36 -07:00
parent d06d6dae72
commit 07d00ebbfa
47 changed files with 1372 additions and 0 deletions

6
framework/events/.classpath Executable file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>

17
framework/events/.project Executable file
View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>framework-events</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

6
framework/ipc/.classpath Executable file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="output" path="bin"/>
</classpath>

17
framework/ipc/.project Executable file
View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>framework-ipc</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -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

View File

@ -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 {
}

View File

@ -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();
}

View File

@ -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 {
}

View File

@ -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 {
}

View File

@ -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<String, Object> getContent();
}

View File

@ -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);
}

View File

@ -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<String, Object> content);
/**
* @return the name of this publisher
*/
String getName();
}

View File

@ -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();
}

6
framework/jobs/.classpath Executable file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="output" path="bin"/>
</classpath>

17
framework/jobs/.project Executable file
View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>framework-jobs</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -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

View File

@ -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 {
}

View File

@ -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 {
}

8
platform/api/.classpath Executable file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/api"/>
<classpathentry combineaccessrules="false" kind="src" path="/server"/>
<classpathentry kind="output" path="bin"/>
</classpath>

17
platform/api/.project Executable file
View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>platform-api</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -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<URI> getEndPoints(String serviceName);
URI getLoadBalancedEndPoint(String serviceName);
}

View File

@ -0,0 +1,45 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.cloudstack.platform.service.api;
import java.util.List;
import com.cloud.network.Network;
import com.cloud.storage.Volume;
import com.cloud.vm.VirtualMachine;
/**
* Service to retrieve CloudStack entities
* very likely to change
*/
public interface EntityService {
List<String> listVirtualMachines();
List<String> listVolumes();
List<String> listNetworks();
List<String> listNics();
List<String> listSnapshots();
List<String> listTemplates();
List<String> listStoragePools();
List<String> listHosts();
VirtualMachine getVirtualMachine(String vm);
Volume getVolume(String volume);
Network getNetwork(String network);
}

View File

@ -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<AsyncJob> listJobs();
List<AsyncJob> listJobsInProgress();
List<AsyncJob> listJobsCompleted(Long from);
List<AsyncJob> listJobsInWaiting();
void cancelJob(String job);
}

View File

@ -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<String> tags, Map<String, String> details);
String registerZone(String name, List<String> tags, Map<String, String> details);
String registerPod(String name, List<String> tags, Map<String, String> details);
String registerCluster(String name, List<String> tags, Map<String, String> details);
String registerHost(String name, List<String> tags, Map<String, String> details);
void deregisterStorage(String uuid);
void deregisterZone();
void deregisterPod();
void deregisterCluster();
void deregisterHost();
void changeState(String type, String entity, Status state);
List<Host> listHosts();
List<Pod> listPods();
List<DataCenter> listZones();
List<StoragePool> listStorage();
}

View File

@ -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<String> networks,
List<String> rootDiskTags,
List<String> computeTags,
Map<String, String> details,
String owner);
VirtualMachine 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);
/**
* 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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

7
platform/compute/.classpath Executable file
View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/framework-ipc"/>
<classpathentry kind="output" path="bin"/>
</classpath>

17
platform/compute/.project Executable file
View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>platform-compute</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -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);
}

View File

@ -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
}
}

6
platform/network/.classpath Executable file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>

17
platform/network/.project Executable file
View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>platform-network</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -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);
}

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry combineaccessrules="false" kind="src" path="/api"/>
<classpathentry combineaccessrules="false" kind="src" path="/platform-api"/>
<classpathentry combineaccessrules="false" kind="src" path="/platform-planning"/>
<classpathentry combineaccessrules="false" kind="src" path="/framework-ipc"/>
<classpathentry kind="output" path="bin"/>
</classpath>

17
platform/orchestration/.project Executable file
View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>platform-orchestration</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -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

View File

@ -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<String> networks, List<String> rootDiskTags, List<String> computeTags, Map<String, String> 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<String> networks, List<String> computeTags,
Map<String, String> 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
}
}

8
platform/planning/.classpath Executable file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/api"/>
<classpathentry combineaccessrules="false" kind="src" path="/framework-ipc"/>
<classpathentry kind="output" path="bin"/>
</classpath>

17
platform/planning/.project Executable file
View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>platform-planning</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -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);
}

6
platform/storage/.classpath Executable file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>

17
platform/storage/.project Executable file
View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>platform-storage</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -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<String> disks, String reservationId);
/**
* Cancel a reservation
* @param reservationId reservation to
*/
void cancel(String reservationId);
}