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(); public Map<String, String> getDetails();
boolean canPlugNics();
} }

View File

@ -36,45 +36,45 @@ import com.cloud.network.router.VirtualRouter;
public class DomainRouterVO extends VMInstanceVO implements VirtualRouter { public class DomainRouterVO extends VMInstanceVO implements VirtualRouter {
@Column(name="element_id") @Column(name="element_id")
private long elementId; private long elementId;
@Column(name="public_ip_address") @Column(name="public_ip_address")
private String publicIpAddress; private String publicIpAddress;
@Column(name="public_mac_address") @Column(name="public_mac_address")
private String publicMacAddress; private String publicMacAddress;
@Column(name="public_netmask") @Column(name="public_netmask")
private String publicNetmask; private String publicNetmask;
@Column(name="is_redundant_router") @Column(name="is_redundant_router")
boolean isRedundantRouter; boolean isRedundantRouter;
@Column(name="priority") @Column(name="priority")
int priority; int priority;
@Column(name="is_priority_bumpup") @Column(name="is_priority_bumpup")
boolean isPriorityBumpUp; boolean isPriorityBumpUp;
@Column(name="redundant_state") @Column(name="redundant_state")
@Enumerated(EnumType.STRING) @Enumerated(EnumType.STRING)
private RedundantState redundantState; private RedundantState redundantState;
@Column(name="stop_pending") @Column(name="stop_pending")
boolean stopPending; boolean stopPending;
@Column(name="role") @Column(name="role")
@Enumerated(EnumType.STRING) @Enumerated(EnumType.STRING)
private Role role = Role.VIRTUAL_ROUTER; private Role role = Role.VIRTUAL_ROUTER;
@Column(name="template_version") @Column(name="template_version")
private String templateVersion; private String templateVersion;
@Column(name="scripts_version") @Column(name="scripts_version")
private String scriptsVersion; private String scriptsVersion;
@Column(name="vpc_id") @Column(name="vpc_id")
private Long vpcId; private Long vpcId;
public DomainRouterVO(long id, public DomainRouterVO(long id,
long serviceOfferingId, long serviceOfferingId,
long elementId, long elementId,
@ -99,7 +99,7 @@ public class DomainRouterVO extends VMInstanceVO implements VirtualRouter {
this.stopPending = stopPending; this.stopPending = stopPending;
this.vpcId = vpcId; this.vpcId = vpcId;
} }
public DomainRouterVO(long id, public DomainRouterVO(long id,
long serviceOfferingId, long serviceOfferingId,
long elementId, long elementId,
@ -146,94 +146,94 @@ public class DomainRouterVO extends VMInstanceVO implements VirtualRouter {
public long getDataCenterIdToDeployIn() { public long getDataCenterIdToDeployIn() {
return dataCenterIdToDeployIn; return dataCenterIdToDeployIn;
} }
public String getPublicNetmask() { public String getPublicNetmask() {
return publicNetmask; return publicNetmask;
} }
public String getPublicMacAddress() { public String getPublicMacAddress() {
return publicMacAddress; return publicMacAddress;
} }
protected DomainRouterVO() { protected DomainRouterVO() {
super(); super();
} }
@Override @Override
public String getPublicIpAddress() { public String getPublicIpAddress() {
return publicIpAddress; return publicIpAddress;
} }
@Override
public Role getRole() {
return role;
}
public void setRole(Role role) {
this.role = role;
}
@Override
public boolean getIsRedundantRouter() {
return this.isRedundantRouter;
}
public void setIsRedundantRouter(boolean isRedundantRouter) {
this.isRedundantRouter = isRedundantRouter;
}
@Override
public long getServiceOfferingId() {
return serviceOfferingId;
}
public int getPriority() {
return this.priority;
}
public void setPriority(int priority) {
this.priority = priority;
}
@Override
public RedundantState getRedundantState() {
return this.redundantState;
}
public void setRedundantState(RedundantState redundantState) {
this.redundantState = redundantState;
}
public boolean getIsPriorityBumpUp() {
return this.isPriorityBumpUp;
}
public void setIsPriorityBumpUp(boolean isPriorityBumpUp) {
this.isPriorityBumpUp = isPriorityBumpUp;
}
@Override @Override
public boolean isStopPending() { public Role getRole() {
return this.stopPending; return role;
} }
public void setRole(Role role) {
this.role = role;
}
@Override @Override
public void setStopPending(boolean stopPending) { public boolean getIsRedundantRouter() {
this.stopPending = stopPending; return this.isRedundantRouter;
} }
public void setIsRedundantRouter(boolean isRedundantRouter) {
this.isRedundantRouter = isRedundantRouter;
}
@Override
public long getServiceOfferingId() {
return serviceOfferingId;
}
public int getPriority() {
return this.priority;
}
public void setPriority(int priority) {
this.priority = priority;
}
@Override
public RedundantState getRedundantState() {
return this.redundantState;
}
public void setRedundantState(RedundantState redundantState) {
this.redundantState = redundantState;
}
public boolean getIsPriorityBumpUp() {
return this.isPriorityBumpUp;
}
public void setIsPriorityBumpUp(boolean isPriorityBumpUp) {
this.isPriorityBumpUp = isPriorityBumpUp;
}
@Override
public boolean isStopPending() {
return this.stopPending;
}
@Override
public void setStopPending(boolean stopPending) {
this.stopPending = stopPending;
}
public String getTemplateVersion() { public String getTemplateVersion() {
return this.templateVersion; return this.templateVersion;
} }
public void setTemplateVersion(String templateVersion) { public void setTemplateVersion(String templateVersion) {
this.templateVersion = templateVersion; this.templateVersion = templateVersion;
} }
public String getScriptsVersion() { public String getScriptsVersion() {
return this.scriptsVersion; return this.scriptsVersion;
} }
public void setScriptsVersion(String scriptsVersion) { public void setScriptsVersion(String scriptsVersion) {
this.scriptsVersion = scriptsVersion; this.scriptsVersion = scriptsVersion;
} }
@ -242,9 +242,5 @@ public class DomainRouterVO extends VMInstanceVO implements VirtualRouter {
public Long getVpcId() { public Long getVpcId() {
return vpcId; return vpcId;
} }
@Override
public boolean canPlugNics() {
return true;
}
} }

View File

@ -48,21 +48,21 @@ import com.cloud.vm.VirtualMachine.State;
@Inheritance(strategy=InheritanceType.JOINED) @Inheritance(strategy=InheritanceType.JOINED)
@DiscriminatorColumn(name="type", discriminatorType=DiscriminatorType.STRING, length=32) @DiscriminatorColumn(name="type", discriminatorType=DiscriminatorType.STRING, length=32)
public class VMInstanceVO implements VirtualMachine, FiniteStateObject<State, VirtualMachine.Event> { public class VMInstanceVO implements VirtualMachine, FiniteStateObject<State, VirtualMachine.Event> {
@Id @Id
@TableGenerator(name="vm_instance_sq", table="sequence", pkColumnName="name", valueColumnName="value", pkColumnValue="vm_instance_seq", allocationSize=1) @TableGenerator(name="vm_instance_sq", table="sequence", pkColumnName="name", valueColumnName="value", pkColumnValue="vm_instance_seq", allocationSize=1)
@Column(name="id", updatable=false, nullable = false) @Column(name="id", updatable=false, nullable = false)
protected long id; protected long id;
@Column(name="name", updatable=false, nullable=false, length=255) @Column(name="name", updatable=false, nullable=false, length=255)
protected String hostName = null; protected String hostName = null;
@Encrypt @Encrypt
@Column(name="vnc_password", updatable=true, nullable=false, length=255) @Column(name="vnc_password", updatable=true, nullable=false, length=255)
protected String vncPassword; protected String vncPassword;
@Column(name="proxy_id", updatable=true, nullable=true) @Column(name="proxy_id", updatable=true, nullable=true)
protected Long proxyId; protected Long proxyId;
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
@Column(name="proxy_assign_time", updatable=true, nullable=true) @Column(name="proxy_assign_time", updatable=true, nullable=true)
protected Date proxyAssignTime; protected Date proxyAssignTime;
@ -78,20 +78,20 @@ public class VMInstanceVO implements VirtualMachine, FiniteStateObject<State, Vi
protected State state = null; protected State state = null;
@Column(name="private_ip_address", updatable=true) @Column(name="private_ip_address", updatable=true)
protected String privateIpAddress; protected String privateIpAddress;
@Column(name="instance_name", updatable=true, nullable=false) @Column(name="instance_name", updatable=true, nullable=false)
protected String instanceName; protected String instanceName;
@Column(name="vm_template_id", updatable=true, nullable=true, length=17) @Column(name="vm_template_id", updatable=true, nullable=true, length=17)
protected Long templateId = new Long(-1); protected Long templateId = new Long(-1);
@Column(name="guest_os_id", nullable=false, length=17) @Column(name="guest_os_id", nullable=false, length=17)
protected long guestOSId; protected long guestOSId;
@Column(name="host_id", updatable=true, nullable=true) @Column(name="host_id", updatable=true, nullable=true)
protected Long hostId; protected Long hostId;
@Column(name="last_host_id", updatable=true, nullable=true) @Column(name="last_host_id", updatable=true, nullable=true)
protected Long lastHostId; protected Long lastHostId;
@ -116,51 +116,60 @@ public class VMInstanceVO implements VirtualMachine, FiniteStateObject<State, Vi
@Column(name="update_count", updatable = true, nullable=false) @Column(name="update_count", updatable = true, nullable=false)
protected long updated; // This field should be updated everytime the state is updated. There's no set method in the vo object because it is done with in the dao code. protected long updated; // This field should be updated everytime the state is updated. There's no set method in the vo object because it is done with in the dao code.
@Column(name=GenericDao.CREATED_COLUMN) @Column(name=GenericDao.CREATED_COLUMN)
protected Date created; protected Date created;
@Column(name=GenericDao.REMOVED_COLUMN) @Column(name=GenericDao.REMOVED_COLUMN)
protected Date removed; protected Date removed;
@Column(name="update_time", updatable=true) @Column(name="update_time", updatable=true)
@Temporal(value=TemporalType.TIMESTAMP) @Temporal(value=TemporalType.TIMESTAMP)
protected Date updateTime; protected Date updateTime;
@Column(name="domain_id") @Column(name="domain_id")
protected long domainId; protected long domainId;
@Column(name="account_id") @Column(name="account_id")
protected long accountId; protected long accountId;
@Column(name="service_offering_id") @Column(name="service_offering_id")
protected long serviceOfferingId; protected long serviceOfferingId;
@Column(name="reservation_id") @Column(name="reservation_id")
protected String reservationId; protected String reservationId;
@Column(name="hypervisor_type") @Column(name="hypervisor_type")
@Enumerated(value=EnumType.STRING) @Enumerated(value=EnumType.STRING)
protected HypervisorType hypervisorType; protected HypervisorType hypervisorType;
@Column(name="ram")
protected long ram;
@Column(name="cpu")
protected int cpu;
@Column(name="tags")
protected String tags;
@Transient @Transient
Map<String, String> details; Map<String, String> details;
@Column(name="uuid") @Column(name="uuid")
protected String uuid = UUID.randomUUID().toString(); protected String uuid = UUID.randomUUID().toString();
; ;
public VMInstanceVO(long id, public VMInstanceVO(long id,
long serviceOfferingId, long serviceOfferingId,
String name, String name,
String instanceName, String instanceName,
Type type, Type type,
Long vmTemplateId, Long vmTemplateId,
HypervisorType hypervisorType, HypervisorType hypervisorType,
long guestOSId, long guestOSId,
long domainId, long domainId,
long accountId, long accountId,
boolean haEnabled) { boolean haEnabled) {
this.id = id; this.id = id;
this.hostName = name != null ? name : this.uuid; this.hostName = name != null ? name : this.uuid;
if (vmTemplateId != null) { if (vmTemplateId != null) {
@ -191,177 +200,177 @@ public class VMInstanceVO implements VirtualMachine, FiniteStateObject<State, Vi
long accountId, long accountId,
boolean haEnabled, boolean haEnabled,
boolean limitResourceUse) { boolean limitResourceUse) {
this(id, serviceOfferingId, name, instanceName, type, vmTemplateId, hypervisorType, guestOSId, domainId, accountId, haEnabled); this(id, serviceOfferingId, name, instanceName, type, vmTemplateId, hypervisorType, guestOSId, domainId, accountId, haEnabled);
this.limitCpuUse = limitResourceUse; this.limitCpuUse = limitResourceUse;
} }
protected VMInstanceVO() { protected VMInstanceVO() {
} }
public Date getRemoved() { public Date getRemoved() {
return removed; return removed;
} }
@Override @Override
public long getDomainId() { public long getDomainId() {
return domainId; return domainId;
} }
@Override @Override
public long getAccountId() { public long getAccountId() {
return accountId; return accountId;
} }
@Override @Override
public Type getType() { public Type getType() {
return type; return type;
} }
public long getUpdated() {
return updated;
}
@Override
public long getId() {
return id;
}
@Override
public String getUuid() {
return uuid;
}
public void setUuid(String uuid) { public long getUpdated() {
this.uuid = uuid; return updated;
} }
@Override @Override
public long getId() {
return id;
}
@Override
public String getUuid() {
return uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
@Override
public HypervisorType getHypervisorType() { public HypervisorType getHypervisorType() {
return hypervisorType; return hypervisorType;
} }
@Override @Override
public Date getCreated() { public Date getCreated() {
return created; return created;
} }
public Date getUpdateTime() { public Date getUpdateTime() {
return updateTime; return updateTime;
} }
@Override @Override
public long getDataCenterIdToDeployIn() { public long getDataCenterIdToDeployIn() {
return dataCenterIdToDeployIn; return dataCenterIdToDeployIn;
} }
@Override @Override
public String getHostName() { public String getHostName() {
return hostName; return hostName;
} }
@Override @Override
public String getInstanceName() { public String getInstanceName() {
return instanceName; return instanceName;
} }
@Override @Override
public State getState() { public State getState() {
return state; return state;
} }
// don't use this directly, use VM state machine instead, this method is added for migration tool only // don't use this directly, use VM state machine instead, this method is added for migration tool only
@Override @Override
public void setState(State state) { public void setState(State state) {
this.state = state; this.state = state;
} }
@Override @Override
public String getPrivateIpAddress() { public String getPrivateIpAddress() {
return privateIpAddress; return privateIpAddress;
} }
public void setPrivateIpAddress(String address) { public void setPrivateIpAddress(String address) {
privateIpAddress = address; privateIpAddress = address;
} }
public void setVncPassword(String vncPassword) { public void setVncPassword(String vncPassword) {
this.vncPassword = vncPassword; this.vncPassword = vncPassword;
} }
@Override @Override
public String getVncPassword() { public String getVncPassword() {
return vncPassword; return vncPassword;
} }
@Override @Override
public long getServiceOfferingId() { public long getServiceOfferingId() {
return serviceOfferingId; return serviceOfferingId;
} }
public Long getProxyId() { public Long getProxyId() {
return proxyId; return proxyId;
} }
public void setProxyId(Long proxyId) { public void setProxyId(Long proxyId) {
this.proxyId = proxyId; this.proxyId = proxyId;
} }
public Date getProxyAssignTime() { public Date getProxyAssignTime() {
return this.proxyAssignTime; return this.proxyAssignTime;
} }
public void setProxyAssignTime(Date time) { public void setProxyAssignTime(Date time) {
this.proxyAssignTime = time; this.proxyAssignTime = time;
} }
@Override @Override
public long getTemplateId() { public long getTemplateId() {
if (templateId == null) { if (templateId == null) {
return -1; return -1;
} else { } else {
return templateId; return templateId;
} }
} }
public void setTemplateId(Long templateId) {
this.templateId = templateId;
}
@Override public void setTemplateId(Long templateId) {
this.templateId = templateId;
}
@Override
public long getGuestOSId() { public long getGuestOSId() {
return guestOSId; return guestOSId;
} }
public void setGuestOSId(long guestOSId) {
this.guestOSId = guestOSId;
}
public void incrUpdated() { public void setGuestOSId(long guestOSId) {
updated++; this.guestOSId = guestOSId;
} }
public void decrUpdated() { public void incrUpdated() {
updated--; updated++;
} }
public void decrUpdated() {
updated--;
}
@Override
public Long getHostId() {
return hostId;
}
@Override
public Long getLastHostId() {
return lastHostId;
}
@Override
public Long getHostId() {
return hostId;
}
@Override
public Long getLastHostId() {
return lastHostId;
}
public void setLastHostId(Long lastHostId) { public void setLastHostId(Long lastHostId) {
this.lastHostId = lastHostId; this.lastHostId = lastHostId;
} }
public void setHostId(Long hostId) { public void setHostId(Long hostId) {
this.hostId = hostId; this.hostId = hostId;
} }
@Override @Override
public boolean isHaEnabled() { public boolean isHaEnabled() {
return haEnabled; return haEnabled;
@ -373,7 +382,7 @@ public class VMInstanceVO implements VirtualMachine, FiniteStateObject<State, Vi
} }
public void setLimitCpuUse(boolean value) { public void setLimitCpuUse(boolean value) {
limitCpuUse = value; limitCpuUse = value;
} }
@Override @Override
@ -385,7 +394,7 @@ public class VMInstanceVO implements VirtualMachine, FiniteStateObject<State, Vi
public Long getPodIdToDeployIn() { public Long getPodIdToDeployIn() {
return podIdToDeployIn; return podIdToDeployIn;
} }
public void setPodId(long podId) { public void setPodId(long podId) {
this.podIdToDeployIn = podId; this.podIdToDeployIn = podId;
} }
@ -397,78 +406,73 @@ public class VMInstanceVO implements VirtualMachine, FiniteStateObject<State, Vi
public void setDataCenterId(long dataCenterId) { public void setDataCenterId(long dataCenterId) {
this.dataCenterIdToDeployIn = dataCenterId; this.dataCenterIdToDeployIn = dataCenterId;
} }
public boolean isRemoved() { public boolean isRemoved() {
return removed != null; return removed != null;
} }
public void setHaEnabled(boolean value) { public void setHaEnabled(boolean value) {
haEnabled = value; haEnabled = value;
} }
public void setReservationId(String reservationId) { public void setReservationId(String reservationId) {
this.reservationId = reservationId; this.reservationId = reservationId;
} }
public String getReservationId() { public String getReservationId() {
return this.reservationId; return this.reservationId;
} }
@Override @Override
public Map<String, String> getDetails() { public Map<String, String> getDetails() {
return details; return details;
} }
public void setDetail(String name, String value) { public void setDetail(String name, String value) {
assert (details != null) : "Did you forget to load the details?"; assert (details != null) : "Did you forget to load the details?";
details.put(name, value); details.put(name, value);
} }
public void setDetails(Map<String, String> details) { public void setDetails(Map<String, String> details) {
this.details = details; this.details = details;
} }
transient String toString; transient String toString;
@Override @Override
public String toString() { public String toString() {
if (toString == null) { if (toString == null) {
toString = new StringBuilder("VM[").append(type.toString()).append("|").append(hostName).append("]").toString(); toString = new StringBuilder("VM[").append(type.toString()).append("|").append(hostName).append("]").toString();
} }
return toString; return toString;
} }
@Override @Override
public int hashCode() { public int hashCode() {
final int prime = 31; final int prime = 31;
int result = 1; int result = 1;
result = prime * result + (int) (id ^ (id >>> 32)); result = prime * result + (int) (id ^ (id >>> 32));
return result; return result;
} }
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
VMInstanceVO other = (VMInstanceVO) obj;
if (id != other.id)
return false;
return true;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
VMInstanceVO other = (VMInstanceVO) obj;
if (id != other.id)
return false;
return true;
}
public void setServiceOfferingId(long serviceOfferingId) { public void setServiceOfferingId(long serviceOfferingId) {
this.serviceOfferingId = serviceOfferingId; 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.List;
import java.util.Map; 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.exception.InsufficientCapacityException;
import com.cloud.hypervisor.Hypervisor; import com.cloud.hypervisor.Hypervisor;
import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.vm.VirtualMachine;
public interface OrchestrationService { public interface OrchestrationService {
/** /**
@ -43,7 +44,7 @@ public interface OrchestrationService {
* @param details extra details to store for the VM * @param details extra details to store for the VM
* @return VirtualMachine * @return VirtualMachine
*/ */
VirtualMachine create(String name, VirtualMachineEntity create(String name,
String template, String template,
String hostName, String hostName,
int cpu, int cpu,
@ -55,7 +56,7 @@ public interface OrchestrationService {
Map<String, String> details, Map<String, String> details,
String owner); String owner);
VirtualMachine createFromScratch(String uuid, VirtualMachineEntity createFromScratch(String uuid,
String iso, String iso,
String os, String os,
String hypervisor, String hypervisor,
@ -77,8 +78,6 @@ public interface OrchestrationService {
*/ */
String reserve(String vm, String planner, Long until) throws InsufficientCapacityException; String reserve(String vm, String planner, Long until) throws InsufficientCapacityException;
String cancel(String reservationId);
/** /**
* Deploy the reservation * Deploy the reservation
* @param reservationId reservation id during the deployment * @param reservationId reservation id during the deployment
@ -87,29 +86,13 @@ public interface OrchestrationService {
*/ */
String deploy(String reservationId); 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 joinNetwork(String network1, String network2);
void attachVolume(String vm, String vol);
void createNetwork(); void createNetwork();
void destroyNetwork(); void destroyNetwork();
void createVolume(); VolumeEntity createVolume();
void registerTemplate(String name, URL path, String os, Hypervisor hypervisor); void registerTemplate(String name, URL path, String os, Hypervisor hypervisor);
} }

View File

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

View File

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

View File

@ -1,11 +1,12 @@
eclipse.preferences.version=1 eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 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.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.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=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.List;
import java.util.Map; import java.util.Map;
import org.apache.cloudstack.framework.ipc.Publisher; import org.apache.cloudstack.platform.cloud.entity.api.VirtualMachineEntity;
import org.apache.cloudstack.platform.planning.Concierge; import org.apache.cloudstack.platform.cloud.entity.api.VolumeEntity;
import org.apache.cloudstack.platform.service.api.OrchestrationService; import org.apache.cloudstack.platform.service.api.OrchestrationService;
import com.cloud.exception.InsufficientCapacityException; import com.cloud.exception.InsufficientCapacityException;
import com.cloud.hypervisor.Hypervisor; import com.cloud.hypervisor.Hypervisor;
import com.cloud.vm.VirtualMachine;
public class CloudOrchestrator implements OrchestrationService { public class CloudOrchestrator implements OrchestrationService {
int _retryCount = 5;
Concierge _concierge = null; // These are injected
Publisher _publisher = null;
@Override public VirtualMachineEntity create(String name, String template, String hostName, int cpu, int speed, long memory, List<String> networks, List<String> rootDiskTags, List<String> computeTags,
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) { 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; return null;
} }
@Override
public String reserve(String vm, String planner, Long until) throws InsufficientCapacityException { 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 // TODO Auto-generated method stub
return null; return null;
} }
@Override public String deploy(String reservationId) {
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 // TODO Auto-generated method stub
return null; return null;
} }
@Override
public void destroy(String vm) {
// TODO Auto-generated method stub
}
@Override
public void joinNetwork(String network1, String network2) { public void joinNetwork(String network1, String network2) {
// TODO Auto-generated method stub // 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() { public void createNetwork() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
} }
@Override
public void destroyNetwork() { public void destroyNetwork() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
} }
@Override public VolumeEntity createVolume() {
public void createVolume() {
// TODO Auto-generated method stub // 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) { public void registerTemplate(String name, URL path, String os, Hypervisor hypervisor) {
// TODO Auto-generated method stub // TODO Auto-generated method stub

View File

@ -131,7 +131,7 @@ public class DatabaseUpgradeChecker implements SystemIntegrityChecker {
_upgradeMap.put("2.2.8", new DbUpgrade[] { new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(), _upgradeMap.put("2.2.8", new DbUpgrade[] { new Upgrade228to229(), new Upgrade229to2210(), new Upgrade2210to2211(),
new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30() new Upgrade2211to2212(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30()
, new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40() }); , new Upgrade30to301(), new Upgrade301to302(), new Upgrade302to40() });
_upgradeMap.put("2.2.9", new DbUpgrade[] { new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(), _upgradeMap.put("2.2.9", new DbUpgrade[] { new Upgrade229to2210(), new Upgrade2210to2211(), new Upgrade2211to2212(),
new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(), new Upgrade2212to2213(), new Upgrade2213to2214(), new Upgrade2214to30(), new Upgrade30to301(),
@ -335,8 +335,8 @@ public class DatabaseUpgradeChecker implements SystemIntegrityChecker {
} }
if ( currentVersion == null ) if ( currentVersion == null )
return; return;
s_logger.info("DB version = " + dbVersion + " Code Version = " + currentVersion); s_logger.info("DB version = " + dbVersion + " Code Version = " + currentVersion);
if (Version.compare(Version.trimToPatch(dbVersion), Version.trimToPatch(currentVersion)) > 0) { if (Version.compare(Version.trimToPatch(dbVersion), Version.trimToPatch(currentVersion)) > 0) {