latest changes

This commit is contained in:
Alex Huang 2012-09-13 11:31:54 -07:00
parent 298d224f83
commit 06b7d80fec
11 changed files with 332 additions and 407 deletions

View File

@ -293,5 +293,4 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, S
public Map<String, String> getDetails();
boolean canPlugNics();
}

View File

@ -243,8 +243,4 @@ public class DomainRouterVO extends VMInstanceVO implements VirtualRouter {
return vpcId;
}
@Override
public boolean canPlugNics() {
return true;
}
}

View File

@ -143,6 +143,15 @@ public class VMInstanceVO implements VirtualMachine, FiniteStateObject<State, Vi
@Enumerated(value=EnumType.STRING)
protected HypervisorType hypervisorType;
@Column(name="ram")
protected long ram;
@Column(name="cpu")
protected int cpu;
@Column(name="tags")
protected String tags;
@Transient
Map<String, String> details;
@ -466,9 +475,4 @@ public class VMInstanceVO implements VirtualMachine, FiniteStateObject<State, Vi
this.serviceOfferingId = serviceOfferingId;
}
@Override
public boolean canPlugNics() {
return false;
}
}

View File

@ -22,10 +22,11 @@ import java.net.URL;
import java.util.List;
import java.util.Map;
import org.apache.cloudstack.platform.cloud.entity.api.VirtualMachineEntity;
import org.apache.cloudstack.platform.cloud.entity.api.VolumeEntity;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.hypervisor.Hypervisor;
import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.vm.VirtualMachine;
public interface OrchestrationService {
/**
@ -43,7 +44,7 @@ public interface OrchestrationService {
* @param details extra details to store for the VM
* @return VirtualMachine
*/
VirtualMachine create(String name,
VirtualMachineEntity create(String name,
String template,
String hostName,
int cpu,
@ -55,7 +56,7 @@ public interface OrchestrationService {
Map<String, String> details,
String owner);
VirtualMachine createFromScratch(String uuid,
VirtualMachineEntity createFromScratch(String uuid,
String iso,
String os,
String hypervisor,
@ -77,8 +78,6 @@ public interface OrchestrationService {
*/
String reserve(String vm, String planner, Long until) throws InsufficientCapacityException;
String cancel(String reservationId);
/**
* Deploy the reservation
* @param reservationId reservation id during the deployment
@ -87,29 +86,13 @@ public interface OrchestrationService {
*/
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 attachVolume(String vm, String vol);
void createNetwork();
void destroyNetwork();
void createVolume();
VolumeEntity createVolume();
void registerTemplate(String name, URL path, String os, Hypervisor hypervisor);
}

View File

@ -1,10 +1,18 @@
<?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 including="**/*.java" kind="src" path="src"/>
<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"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry combineaccessrules="false" kind="src" path="/cloud-framework-ipc"/>
<classpathentry combineaccessrules="false" kind="src" path="/cloud-platform-api"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View File

@ -10,8 +10,14 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -1,11 +1,12 @@
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.targetPlatform=1.5
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.compliance=1.5
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
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.5

View File

@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

6
platform/orchestration/pom.xml Executable file
View File

@ -0,0 +1,6 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-platform-orchestration</artifactId>
<version>0.0.1-SNAPSHOT</version>
</project>

View File

@ -22,140 +22,58 @@ 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.cloud.entity.api.VirtualMachineEntity;
import org.apache.cloudstack.platform.cloud.entity.api.VolumeEntity;
import org.apache.cloudstack.platform.service.api.OrchestrationService;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.hypervisor.Hypervisor;
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,
public VirtualMachineEntity create(String name, String template, String hostName, int cpu, int speed, long memory, List<String> networks, List<String> rootDiskTags, List<String> computeTags,
Map<String, String> details, String owner) {
// creates a virtual machine and relevant work in database
// TODO Auto-generated method stub
return null;
}
public VirtualMachineEntity createFromScratch(String uuid, String iso, String os, String hypervisor, String hostName, int cpu, int speed, long memory, List<String> networks, List<String> computeTags,
Map<String, String> details, String owner) {
// TODO Auto-generated method stub
return null;
}
@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) {
public String deploy(String reservationId) {
// 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() {
public VolumeEntity createVolume() {
// TODO Auto-generated method stub
return null;
}
@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