Merge branch 'master' into rbac

This commit is contained in:
Min Chen 2014-03-13 14:52:37 -07:00
commit 84a528fad6
31 changed files with 175 additions and 321 deletions

View File

@ -60,7 +60,4 @@ public interface Domain extends OwnedBy, Identity, InternalIdentity {
String getNetworkDomain(); String getNetworkDomain();
@Override
public String getUuid();
} }

View File

@ -59,7 +59,7 @@ public class ApiConstants {
public static final String CTX_ACCOUNT_ID = "ctxaccountid"; public static final String CTX_ACCOUNT_ID = "ctxaccountid";
public static final String CTX_USER_ID = "ctxuserid"; public static final String CTX_USER_ID = "ctxuserid";
public static final String CTXSTARTEVENTID = "ctxstarteventid"; public static final String CTXSTARTEVENTID = "ctxstarteventid";
public static final String CTX_START_EVENT_ID = "ctxStartEventId"; public static final String CTX_START_EVENT_ID = "ctxstarteventid";
public static final String CUSTOMIZED = "customized"; public static final String CUSTOMIZED = "customized";
public static final String CUSTOMIZED_IOPS = "customizediops"; public static final String CUSTOMIZED_IOPS = "customizediops";
public static final String CUSTOM_ID = "customid"; public static final String CUSTOM_ID = "customid";

View File

@ -24,7 +24,7 @@ import com.cloud.utils.exception.CSExceptionErrorCode;
public abstract class BaseListCmd extends BaseCmd { public abstract class BaseListCmd extends BaseCmd {
private static Long s_maxPageSize = null; private static Long s_maxPageSize = null;
public static Long s_pageSizeUnlimited = -1L; public static final Long s_pageSizeUnlimited = -1L;
// /////////////////////////////////////////////////// // ///////////////////////////////////////////////////
// ///////// BaseList API parameters ///////////////// // ///////// BaseList API parameters /////////////////

View File

@ -181,6 +181,9 @@ public class DeployVMCmd extends BaseAsyncCreateCustomIdCmd {
@Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, since = "4.3", description = "used to specify the custom parameters.") @Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, since = "4.3", description = "used to specify the custom parameters.")
private Map details; private Map details;
@Parameter(name = ApiConstants.DEPLOYMENT_PLANNER, type = CommandType.STRING, description = "Deployment planner to use for vm allocation. Available to ROOT admin only", since = "4.4", authorized = { RoleType.Admin })
private String deploymentPlanner;
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
/////////////////// Accessors /////////////////////// /////////////////// Accessors ///////////////////////
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
@ -196,6 +199,10 @@ public class DeployVMCmd extends BaseAsyncCreateCustomIdCmd {
return diskOfferingId; return diskOfferingId;
} }
public String getDeploymentPlanner() {
return deploymentPlanner;
}
public String getDisplayName() { public String getDisplayName() {
return displayName; return displayName;
} }

View File

@ -16,16 +16,17 @@
// under the License. // under the License.
package org.apache.cloudstack.api.command.user.vm; package org.apache.cloudstack.api.command.user.vm;
import org.apache.cloudstack.api.BaseAsyncVMCmd;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.apache.cloudstack.acl.IAMEntityType; import org.apache.cloudstack.acl.IAMEntityType;
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.acl.SecurityChecker.AccessType; import org.apache.cloudstack.acl.SecurityChecker.AccessType;
import org.apache.cloudstack.api.ACL; import org.apache.cloudstack.api.ACL;
import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandJobType; import org.apache.cloudstack.api.ApiCommandJobType;
import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncVMCmd;
import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ResponseObject.ResponseView; import org.apache.cloudstack.api.ResponseObject.ResponseView;
import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.ServerApiException;
@ -66,10 +67,14 @@ public class StartVMCmd extends BaseAsyncVMCmd {
since = "3.0.1") since = "3.0.1")
private Long hostId; private Long hostId;
@Parameter(name = ApiConstants.DEPLOYMENT_PLANNER, type = CommandType.STRING, description = "Deployment planner to use for vm allocation. Available to ROOT admin only", since = "4.4", authorized = { RoleType.Admin })
private String deploymentPlanner;
// /////////////////////////////////////////////////// // ///////////////////////////////////////////////////
// ///////////////// Accessors /////////////////////// // ///////////////// Accessors ///////////////////////
// /////////////////////////////////////////////////// // ///////////////////////////////////////////////////
@Override
public Long getId() { public Long getId() {
return id; return id;
} }
@ -91,6 +96,10 @@ public class StartVMCmd extends BaseAsyncVMCmd {
return "virtualmachine"; return "virtualmachine";
} }
public String getDeploymentPlanner() {
return deploymentPlanner;
}
@Override @Override
public long getEntityOwnerId() { public long getEntityOwnerId() {
UserVm vm = _responseGenerator.findUserVmById(getId()); UserVm vm = _responseGenerator.findUserVmById(getId());

View File

@ -85,7 +85,7 @@ public interface VirtualMachineManager extends Manager {
void start(String vmUuid, Map<VirtualMachineProfile.Param, Object> params); void start(String vmUuid, Map<VirtualMachineProfile.Param, Object> params);
void start(String vmUuid, Map<VirtualMachineProfile.Param, Object> params, DeploymentPlan planToDeploy); void start(String vmUuid, Map<VirtualMachineProfile.Param, Object> params, DeploymentPlan planToDeploy, DeploymentPlanner planner);
void stop(String vmUuid) throws ResourceUnavailableException; void stop(String vmUuid) throws ResourceUnavailableException;

View File

@ -30,6 +30,7 @@ import javax.xml.bind.annotation.XmlRootElement;
import org.apache.cloudstack.engine.entity.api.CloudStackEntity; import org.apache.cloudstack.engine.entity.api.CloudStackEntity;
import com.cloud.deploy.DeploymentPlan; import com.cloud.deploy.DeploymentPlan;
import com.cloud.deploy.DeploymentPlanner;
import com.cloud.deploy.DeploymentPlanner.ExcludeList; import com.cloud.deploy.DeploymentPlanner.ExcludeList;
import com.cloud.exception.AgentUnavailableException; import com.cloud.exception.AgentUnavailableException;
import com.cloud.exception.CloudException; import com.cloud.exception.CloudException;
@ -90,7 +91,7 @@ public interface VirtualMachineEntity extends CloudStackEntity {
* @param exclude list of areas to exclude * @param exclude list of areas to exclude
* @return a reservation id * @return a reservation id
*/ */
String reserve(String plannerToUse, @BeanParam DeploymentPlan plan, ExcludeList exclude, String caller) throws InsufficientCapacityException, String reserve(DeploymentPlanner plannerToUse, @BeanParam DeploymentPlan plan, ExcludeList exclude, String caller) throws InsufficientCapacityException,
ResourceUnavailableException; ResourceUnavailableException;
/** /**

View File

@ -43,8 +43,10 @@ public interface DeploymentPlanningManager extends Manager {
ExcludeList avoids, DeploymentPlanner planner) throws InsufficientServerCapacityException, AffinityConflictException; ExcludeList avoids, DeploymentPlanner planner) throws InsufficientServerCapacityException, AffinityConflictException;
String finalizeReservation(DeployDestination plannedDestination, String finalizeReservation(DeployDestination plannedDestination,
VirtualMachineProfile vmProfile, DeploymentPlan plan, ExcludeList avoids) VirtualMachineProfile vmProfile, DeploymentPlan plan, ExcludeList avoids, DeploymentPlanner planner)
throws InsufficientServerCapacityException, AffinityConflictException; throws InsufficientServerCapacityException, AffinityConflictException;
void cleanupVMReservations(); void cleanupVMReservations();
DeploymentPlanner getDeploymentPlannerByName(String plannerName);
} }

View File

@ -40,8 +40,6 @@ import javax.ejb.Local;
import javax.inject.Inject; import javax.inject.Inject;
import javax.naming.ConfigurationException; import javax.naming.ConfigurationException;
import org.apache.log4j.Logger;
import org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao; import org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao;
import org.apache.cloudstack.context.CallContext; import org.apache.cloudstack.context.CallContext;
import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService; import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
@ -70,6 +68,7 @@ import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO; import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
import org.apache.cloudstack.storage.to.VolumeObjectTO; import org.apache.cloudstack.storage.to.VolumeObjectTO;
import org.apache.cloudstack.utils.identity.ManagementServerNode; import org.apache.cloudstack.utils.identity.ManagementServerNode;
import org.apache.log4j.Logger;
import com.cloud.agent.AgentManager; import com.cloud.agent.AgentManager;
import com.cloud.agent.Listener; import com.cloud.agent.Listener;
@ -80,8 +79,8 @@ import com.cloud.agent.api.CheckVirtualMachineAnswer;
import com.cloud.agent.api.CheckVirtualMachineCommand; import com.cloud.agent.api.CheckVirtualMachineCommand;
import com.cloud.agent.api.ClusterSyncAnswer; import com.cloud.agent.api.ClusterSyncAnswer;
import com.cloud.agent.api.ClusterSyncCommand; import com.cloud.agent.api.ClusterSyncCommand;
import com.cloud.agent.api.ClusterVMMetaDataSyncCommand;
import com.cloud.agent.api.ClusterVMMetaDataSyncAnswer; import com.cloud.agent.api.ClusterVMMetaDataSyncAnswer;
import com.cloud.agent.api.ClusterVMMetaDataSyncCommand;
import com.cloud.agent.api.Command; import com.cloud.agent.api.Command;
import com.cloud.agent.api.MigrateAnswer; import com.cloud.agent.api.MigrateAnswer;
import com.cloud.agent.api.MigrateCommand; import com.cloud.agent.api.MigrateCommand;
@ -608,13 +607,13 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
@Override @Override
public void start(String vmUuid, Map<VirtualMachineProfile.Param, Object> params) { public void start(String vmUuid, Map<VirtualMachineProfile.Param, Object> params) {
start(vmUuid, params, null); start(vmUuid, params, null, null);
} }
@Override @Override
public void start(String vmUuid, Map<VirtualMachineProfile.Param, Object> params, DeploymentPlan planToDeploy) { public void start(String vmUuid, Map<VirtualMachineProfile.Param, Object> params, DeploymentPlan planToDeploy, DeploymentPlanner planner) {
try { try {
advanceStart(vmUuid, params, planToDeploy, null); advanceStart(vmUuid, params, planToDeploy, planner);
} catch (ConcurrentOperationException e) { } catch (ConcurrentOperationException e) {
throw new CloudRuntimeException("Unable to start a VM due to concurrent operation", e).add(VirtualMachine.class, vmUuid); throw new CloudRuntimeException("Unable to start a VM due to concurrent operation", e).add(VirtualMachine.class, vmUuid);
} catch (InsufficientCapacityException e) { } catch (InsufficientCapacityException e) {
@ -779,7 +778,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
_workJobDao.expunge(placeHolder.getId()); _workJobDao.expunge(placeHolder.getId());
} }
} else { } else {
Outcome<VirtualMachine> outcome = startVmThroughJobQueue(vmUuid, params, planToDeploy); Outcome<VirtualMachine> outcome = startVmThroughJobQueue(vmUuid, params, planToDeploy, planner);
try { try {
VirtualMachine vm = outcome.get(); VirtualMachine vm = outcome.get();
@ -4451,7 +4450,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
// //
public Outcome<VirtualMachine> startVmThroughJobQueue(final String vmUuid, public Outcome<VirtualMachine> startVmThroughJobQueue(final String vmUuid,
final Map<VirtualMachineProfile.Param, Object> params, final Map<VirtualMachineProfile.Param, Object> params,
final DeploymentPlan planToDeploy) { final DeploymentPlan planToDeploy, final DeploymentPlanner planner) {
final CallContext context = CallContext.current(); final CallContext context = CallContext.current();
final User callingUser = context.getCallingUser(); final User callingUser = context.getCallingUser();
@ -4488,6 +4487,9 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
// save work context info (there are some duplications) // save work context info (there are some duplications)
VmWorkStart workInfo = new VmWorkStart(callingUser.getId(), callingAccount.getId(), vm.getId(), VirtualMachineManagerImpl.VM_WORK_JOB_HANDLER); VmWorkStart workInfo = new VmWorkStart(callingUser.getId(), callingAccount.getId(), vm.getId(), VirtualMachineManagerImpl.VM_WORK_JOB_HANDLER);
workInfo.setPlan(planToDeploy); workInfo.setPlan(planToDeploy);
if (planner != null) {
workInfo.setDeploymentPlanner(planner.getName());
}
workInfo.setParams(params); workInfo.setParams(params);
workJob.setCmdInfo(VmWorkSerializer.serialize(workInfo)); workJob.setCmdInfo(VmWorkSerializer.serialize(workInfo));
@ -5123,7 +5125,7 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
} }
assert (vm != null); assert (vm != null);
orchestrateStart(vm.getUuid(), work.getParams(), work.getPlan(), null); orchestrateStart(vm.getUuid(), work.getParams(), work.getPlan(), _dpMgr.getDeploymentPlannerByName(work.getDeploymentPlanner()));
return new Pair<JobInfo.Status, String>(JobInfo.Status.SUCCEEDED, null); return new Pair<JobInfo.Status, String>(JobInfo.Status.SUCCEEDED, null);
} }

View File

@ -21,10 +21,9 @@ import java.io.Serializable;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.apache.log4j.Logger;
import org.apache.cloudstack.context.CallContext; import org.apache.cloudstack.context.CallContext;
import org.apache.cloudstack.framework.jobs.impl.JobSerializerHelper; import org.apache.cloudstack.framework.jobs.impl.JobSerializerHelper;
import org.apache.log4j.Logger;
import com.cloud.deploy.DataCenterDeployment; import com.cloud.deploy.DataCenterDeployment;
import com.cloud.deploy.DeploymentPlan; import com.cloud.deploy.DeploymentPlan;
@ -46,6 +45,7 @@ public class VmWorkStart extends VmWork {
String reservationId; String reservationId;
String journalName; String journalName;
String planner;
// use serialization friendly map // use serialization friendly map
private Map<String, String> rawParams; private Map<String, String> rawParams;
@ -91,6 +91,14 @@ public class VmWorkStart extends VmWork {
} }
} }
public void setDeploymentPlanner(String planner) {
this.planner = planner;
}
public String getDeploymentPlanner() {
return this.planner;
}
public Map<String, String> getRawParams() { public Map<String, String> getRawParams() {
return rawParams; return rawParams;
} }

View File

@ -21,6 +21,7 @@ import java.util.Map;
import org.apache.cloudstack.engine.cloud.entity.api.db.VMEntityVO; import org.apache.cloudstack.engine.cloud.entity.api.db.VMEntityVO;
import com.cloud.deploy.DeploymentPlan; import com.cloud.deploy.DeploymentPlan;
import com.cloud.deploy.DeploymentPlanner;
import com.cloud.deploy.DeploymentPlanner.ExcludeList; import com.cloud.deploy.DeploymentPlanner.ExcludeList;
import com.cloud.exception.AgentUnavailableException; import com.cloud.exception.AgentUnavailableException;
import com.cloud.exception.ConcurrentOperationException; import com.cloud.exception.ConcurrentOperationException;
@ -35,7 +36,7 @@ public interface VMEntityManager {
void saveVirtualMachine(VMEntityVO vmInstanceVO); void saveVirtualMachine(VMEntityVO vmInstanceVO);
String reserveVirtualMachine(VMEntityVO vmEntityVO, String plannerToUse, DeploymentPlan plan, ExcludeList exclude) throws InsufficientCapacityException, String reserveVirtualMachine(VMEntityVO vmEntityVO, DeploymentPlanner plannerToUse, DeploymentPlan plan, ExcludeList exclude) throws InsufficientCapacityException,
ResourceUnavailableException; ResourceUnavailableException;
void deployVirtualMachine(String reservationId, VMEntityVO vmEntityVO, String caller, Map<VirtualMachineProfile.Param, Object> params) void deployVirtualMachine(String reservationId, VMEntityVO vmEntityVO, String caller, Map<VirtualMachineProfile.Param, Object> params)

View File

@ -22,9 +22,6 @@ import java.util.UUID;
import javax.inject.Inject; import javax.inject.Inject;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
import org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao; import org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao;
import org.apache.cloudstack.engine.cloud.entity.api.db.VMEntityVO; import org.apache.cloudstack.engine.cloud.entity.api.db.VMEntityVO;
import org.apache.cloudstack.engine.cloud.entity.api.db.VMReservationVO; import org.apache.cloudstack.engine.cloud.entity.api.db.VMReservationVO;
@ -32,6 +29,8 @@ import org.apache.cloudstack.engine.cloud.entity.api.db.dao.VMEntityDao;
import org.apache.cloudstack.engine.cloud.entity.api.db.dao.VMReservationDao; import org.apache.cloudstack.engine.cloud.entity.api.db.dao.VMReservationDao;
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager; import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
import com.cloud.dc.DataCenter; import com.cloud.dc.DataCenter;
import com.cloud.deploy.DataCenterDeployment; import com.cloud.deploy.DataCenterDeployment;
@ -114,6 +113,8 @@ public class VMEntityManagerImpl implements VMEntityManager {
@Inject @Inject
protected AffinityGroupVMMapDao _affinityGroupVMMapDao; protected AffinityGroupVMMapDao _affinityGroupVMMapDao;
@Inject
DeploymentPlanningManager _planningMgr;
@Override @Override
public VMEntityVO loadVirtualMachine(String vmId) { public VMEntityVO loadVirtualMachine(String vmId) {
@ -138,7 +139,7 @@ public class VMEntityManagerImpl implements VMEntityManager {
} }
@Override @Override
public String reserveVirtualMachine(VMEntityVO vmEntityVO, String plannerToUse, DeploymentPlan planToDeploy, ExcludeList exclude) public String reserveVirtualMachine(VMEntityVO vmEntityVO, DeploymentPlanner plannerToUse, DeploymentPlan planToDeploy, ExcludeList exclude)
throws InsufficientCapacityException, ResourceUnavailableException { throws InsufficientCapacityException, ResourceUnavailableException {
//call planner and get the deployDestination. //call planner and get the deployDestination.
@ -189,13 +190,13 @@ public class VMEntityManagerImpl implements VMEntityManager {
while (true) { while (true) {
DeployDestination dest = null; DeployDestination dest = null;
try { try {
dest = _dpMgr.planDeployment(vmProfile, plan, exclude, null); dest = _dpMgr.planDeployment(vmProfile, plan, exclude, plannerToUse);
} catch (AffinityConflictException e) { } catch (AffinityConflictException e) {
throw new CloudRuntimeException("Unable to create deployment, affinity rules associted to the VM conflict"); throw new CloudRuntimeException("Unable to create deployment, affinity rules associted to the VM conflict");
} }
if (dest != null) { if (dest != null) {
String reservationId = _dpMgr.finalizeReservation(dest, vmProfile, plan, exclude); String reservationId = _dpMgr.finalizeReservation(dest, vmProfile, plan, exclude, plannerToUse);
if (reservationId != null) { if (reservationId != null) {
return reservationId; return reservationId;
} else { } else {
@ -229,7 +230,7 @@ public class VMEntityManagerImpl implements VMEntityManager {
DataCenterDeployment reservedPlan = DataCenterDeployment reservedPlan =
new DataCenterDeployment(vm.getDataCenterId(), vmReservation.getPodId(), vmReservation.getClusterId(), vmReservation.getHostId(), null, null); new DataCenterDeployment(vm.getDataCenterId(), vmReservation.getPodId(), vmReservation.getClusterId(), vmReservation.getHostId(), null, null);
try { try {
_itMgr.start(vm.getUuid(), params, reservedPlan); _itMgr.start(vm.getUuid(), params, reservedPlan, _planningMgr.getDeploymentPlannerByName(vmReservation.getDeploymentPlanner()));
} catch (Exception ex) { } catch (Exception ex) {
// Retry the deployment without using the reservation plan // Retry the deployment without using the reservation plan
DataCenterDeployment plan = new DataCenterDeployment(0, null, null, null, null, null); DataCenterDeployment plan = new DataCenterDeployment(0, null, null, null, null, null);
@ -238,11 +239,11 @@ public class VMEntityManagerImpl implements VMEntityManager {
plan.setAvoids(reservedPlan.getAvoids()); plan.setAvoids(reservedPlan.getAvoids());
} }
_itMgr.start(vm.getUuid(), params, plan); _itMgr.start(vm.getUuid(), params, plan, null);
} }
} else { } else {
// no reservation found. Let VirtualMachineManager retry // no reservation found. Let VirtualMachineManager retry
_itMgr.start(vm.getUuid(), params, null); _itMgr.start(vm.getUuid(), params, null, null);
} }
} }

View File

@ -24,10 +24,10 @@ import java.util.Map;
import javax.inject.Inject; import javax.inject.Inject;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.apache.cloudstack.engine.cloud.entity.api.db.VMEntityVO; import org.apache.cloudstack.engine.cloud.entity.api.db.VMEntityVO;
import com.cloud.deploy.DeploymentPlan; import com.cloud.deploy.DeploymentPlan;
import com.cloud.deploy.DeploymentPlanner;
import com.cloud.deploy.DeploymentPlanner.ExcludeList; import com.cloud.deploy.DeploymentPlanner.ExcludeList;
import com.cloud.exception.AgentUnavailableException; import com.cloud.exception.AgentUnavailableException;
import com.cloud.exception.ConcurrentOperationException; import com.cloud.exception.ConcurrentOperationException;
@ -195,7 +195,7 @@ public class VirtualMachineEntityImpl implements VirtualMachineEntity {
} }
@Override @Override
public String reserve(String plannerToUse, DeploymentPlan plan, ExcludeList exclude, String caller) throws InsufficientCapacityException, public String reserve(DeploymentPlanner plannerToUse, DeploymentPlan plan, ExcludeList exclude, String caller) throws InsufficientCapacityException,
ResourceUnavailableException { ResourceUnavailableException {
return manager.reserveVirtualMachine(this.vmEntityVO, plannerToUse, plan, exclude); return manager.reserveVirtualMachine(this.vmEntityVO, plannerToUse, plan, exclude);
} }

View File

@ -39,7 +39,7 @@ import com.cloud.utils.db.TransactionLegacy;
@Component @Component
@Local(value = {VmRulesetLogDao.class}) @Local(value = {VmRulesetLogDao.class})
public class VmRulesetLogDaoImpl extends GenericDaoBase<VmRulesetLogVO, Long> implements VmRulesetLogDao { public class VmRulesetLogDaoImpl extends GenericDaoBase<VmRulesetLogVO, Long> implements VmRulesetLogDao {
protected static Logger s_logger = Logger.getLogger(VmRulesetLogDaoImpl.class); protected static final Logger s_logger = Logger.getLogger(VmRulesetLogDaoImpl.class);
private SearchBuilder<VmRulesetLogVO> VmIdSearch; private SearchBuilder<VmRulesetLogVO> VmIdSearch;
private String InsertOrUpdateSQl = "INSERT INTO op_vm_ruleset_log (instance_id, created, logsequence) " private String InsertOrUpdateSQl = "INSERT INTO op_vm_ruleset_log (instance_id, created, logsequence) "
+ " VALUES(?, now(), 1) ON DUPLICATE KEY UPDATE logsequence=logsequence+1"; + " VALUES(?, now(), 1) ON DUPLICATE KEY UPDATE logsequence=logsequence+1";

View File

@ -31,6 +31,7 @@ import javax.persistence.Table;
import org.apache.cloudstack.api.Identity; import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity; import org.apache.cloudstack.api.InternalIdentity;
import com.cloud.utils.NumbersUtil;
import com.cloud.utils.db.GenericDao; import com.cloud.utils.db.GenericDao;
@Entity @Entity
@ -161,4 +162,8 @@ public class ProjectVO implements Project, Identity, InternalIdentity {
this.uuid = uuid; this.uuid = uuid;
} }
@Override
public int hashCode() {
return NumbersUtil.hash(id);
}
} }

View File

@ -66,6 +66,9 @@ public class VMReservationVO implements Identity, InternalIdentity {
@Column(name = GenericDao.REMOVED_COLUMN) @Column(name = GenericDao.REMOVED_COLUMN)
private Date removed; private Date removed;
@Column(name = "deployment_planner")
private String deploymentPlanner;
// VolumeId -> poolId // VolumeId -> poolId
@Transient @Transient
Map<Long, Long> volumeReservationMap; Map<Long, Long> volumeReservationMap;
@ -124,4 +127,12 @@ public class VMReservationVO implements Identity, InternalIdentity {
this.volumeReservationMap = volumeReservationMap; this.volumeReservationMap = volumeReservationMap;
} }
public void setDeploymentPlanner(String planner) {
this.deploymentPlanner = planner;
}
public String getDeploymentPlanner() {
return this.deploymentPlanner;
}
} }

View File

@ -29,6 +29,7 @@ import java.lang.reflect.Type;
import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.binary.Base64;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import com.cloud.utils.exception.CloudRuntimeException;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.GsonBuilder; import com.google.gson.GsonBuilder;
import com.google.gson.JsonDeserializationContext; import com.google.gson.JsonDeserializationContext;
@ -40,14 +41,12 @@ import com.google.gson.JsonPrimitive;
import com.google.gson.JsonSerializationContext; import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer; import com.google.gson.JsonSerializer;
import com.cloud.utils.exception.CloudRuntimeException;
/** /**
* Note: toPairList and appendPairList only support simple POJO objects currently * Note: toPairList and appendPairList only support simple POJO objects currently
*/ */
public class JobSerializerHelper { public class JobSerializerHelper {
private static final Logger s_logger = Logger.getLogger(JobSerializerHelper.class); private static final Logger s_logger = Logger.getLogger(JobSerializerHelper.class);
public static String token = "/"; public static final String token = "/";
private static Gson s_gson; private static Gson s_gson;
static { static {

View File

@ -30,8 +30,16 @@ import java.util.concurrent.Executors;
import javax.ejb.Local; import javax.ejb.Local;
import javax.naming.ConfigurationException; import javax.naming.ConfigurationException;
import org.apache.cloudstack.framework.events.Event;
import org.apache.cloudstack.framework.events.EventBus;
import org.apache.cloudstack.framework.events.EventBusException;
import org.apache.cloudstack.framework.events.EventSubscriber;
import org.apache.cloudstack.framework.events.EventTopic;
import org.apache.cloudstack.managed.context.ManagedContextRunnable;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import com.cloud.utils.Ternary;
import com.cloud.utils.component.ManagerBase;
import com.rabbitmq.client.AMQP; import com.rabbitmq.client.AMQP;
import com.rabbitmq.client.AlreadyClosedException; import com.rabbitmq.client.AlreadyClosedException;
import com.rabbitmq.client.Channel; import com.rabbitmq.client.Channel;
@ -43,16 +51,6 @@ import com.rabbitmq.client.MessageProperties;
import com.rabbitmq.client.ShutdownListener; import com.rabbitmq.client.ShutdownListener;
import com.rabbitmq.client.ShutdownSignalException; import com.rabbitmq.client.ShutdownSignalException;
import org.apache.cloudstack.framework.events.Event;
import org.apache.cloudstack.framework.events.EventBus;
import org.apache.cloudstack.framework.events.EventBusException;
import org.apache.cloudstack.framework.events.EventSubscriber;
import org.apache.cloudstack.framework.events.EventTopic;
import org.apache.cloudstack.managed.context.ManagedContextRunnable;
import com.cloud.utils.Ternary;
import com.cloud.utils.component.ManagerBase;
@Local(value = EventBus.class) @Local(value = EventBus.class)
public class RabbitMQEventBus extends ManagerBase implements EventBus { public class RabbitMQEventBus extends ManagerBase implements EventBus {

View File

@ -805,7 +805,7 @@ public class InternalLoadBalancerVMManagerImpl extends ManagerBase implements In
protected DomainRouterVO startInternalLbVm(DomainRouterVO internalLbVm, Account caller, long callerUserId, Map<Param, Object> params) protected DomainRouterVO startInternalLbVm(DomainRouterVO internalLbVm, Account caller, long callerUserId, Map<Param, Object> params)
throws StorageUnavailableException, InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException { throws StorageUnavailableException, InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException {
s_logger.debug("Starting Internal LB VM " + internalLbVm); s_logger.debug("Starting Internal LB VM " + internalLbVm);
_itMgr.start(internalLbVm.getUuid(), params, null); _itMgr.start(internalLbVm.getUuid(), params, null, null);
if (internalLbVm.isStopPending()) { if (internalLbVm.isStopPending()) {
s_logger.info("Clear the stop pending flag of Internal LB VM " + internalLbVm.getHostName() + " after start router successfully!"); s_logger.info("Clear the stop pending flag of Internal LB VM " + internalLbVm.getHostName() + " after start router successfully!");
internalLbVm.setStopPending(false); internalLbVm.setStopPending(false);

View File

@ -48,7 +48,6 @@ import com.cloud.offering.ServiceOffering;
import com.cloud.org.Cluster; import com.cloud.org.Cluster;
import com.cloud.resource.ResourceManager; import com.cloud.resource.ResourceManager;
import com.cloud.service.ServiceOfferingDetailsVO; import com.cloud.service.ServiceOfferingDetailsVO;
import com.cloud.service.dao.ServiceOfferingDao;
import com.cloud.service.dao.ServiceOfferingDetailsDao; import com.cloud.service.dao.ServiceOfferingDetailsDao;
import com.cloud.storage.GuestOSCategoryVO; import com.cloud.storage.GuestOSCategoryVO;
import com.cloud.storage.GuestOSVO; import com.cloud.storage.GuestOSVO;
@ -56,14 +55,9 @@ import com.cloud.storage.VMTemplateVO;
import com.cloud.storage.dao.GuestOSCategoryDao; import com.cloud.storage.dao.GuestOSCategoryDao;
import com.cloud.storage.dao.GuestOSDao; import com.cloud.storage.dao.GuestOSDao;
import com.cloud.user.Account; import com.cloud.user.Account;
import com.cloud.utils.NumbersUtil;
import com.cloud.utils.component.AdapterBase; import com.cloud.utils.component.AdapterBase;
import com.cloud.vm.VirtualMachine; import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachineProfile; import com.cloud.vm.VirtualMachineProfile;
import com.cloud.vm.dao.ConsoleProxyDao;
import com.cloud.vm.dao.DomainRouterDao;
import com.cloud.vm.dao.SecondaryStorageVmDao;
import com.cloud.vm.dao.UserVmDao;
import com.cloud.vm.dao.VMInstanceDao; import com.cloud.vm.dao.VMInstanceDao;
/** /**
@ -74,20 +68,10 @@ import com.cloud.vm.dao.VMInstanceDao;
public class FirstFitAllocator extends AdapterBase implements HostAllocator { public class FirstFitAllocator extends AdapterBase implements HostAllocator {
private static final Logger s_logger = Logger.getLogger(FirstFitAllocator.class); private static final Logger s_logger = Logger.getLogger(FirstFitAllocator.class);
@Inject @Inject
HostDao _hostDao = null; protected HostDao _hostDao = null;
@Inject @Inject
HostDetailsDao _hostDetailsDao = null; HostDetailsDao _hostDetailsDao = null;
@Inject @Inject
UserVmDao _vmDao = null;
@Inject
ServiceOfferingDao _offeringDao = null;
@Inject
DomainRouterDao _routerDao = null;
@Inject
ConsoleProxyDao _consoleProxyDao = null;
@Inject
SecondaryStorageVmDao _secStorgaeVmDao = null;
@Inject
ConfigurationDao _configDao = null; ConfigurationDao _configDao = null;
@Inject @Inject
GuestOSDao _guestOSDao = null; GuestOSDao _guestOSDao = null;
@ -96,19 +80,20 @@ public class FirstFitAllocator extends AdapterBase implements HostAllocator {
@Inject @Inject
VMInstanceDao _vmInstanceDao = null; VMInstanceDao _vmInstanceDao = null;
@Inject @Inject
ResourceManager _resourceMgr; protected ResourceManager _resourceMgr;
@Inject @Inject
ClusterDao _clusterDao; ClusterDao _clusterDao;
@Inject @Inject
ClusterDetailsDao _clusterDetailsDao; ClusterDetailsDao _clusterDetailsDao;
@Inject @Inject
ServiceOfferingDetailsDao _serviceOfferingDetailsDao; ServiceOfferingDetailsDao _serviceOfferingDetailsDao;
float _factor = 1;
boolean _checkHvm = true;
protected String _allocationAlgorithm = "random";
@Inject @Inject
CapacityManager _capacityMgr; CapacityManager _capacityMgr;
boolean _checkHvm = true;
protected String _allocationAlgorithm = "random";
@Override @Override
public List<Host> allocateTo(VirtualMachineProfile vmProfile, DeploymentPlan plan, Type type, ExcludeList avoid, int returnUpTo) { public List<Host> allocateTo(VirtualMachineProfile vmProfile, DeploymentPlan plan, Type type, ExcludeList avoid, int returnUpTo) {
return allocateTo(vmProfile, plan, type, avoid, returnUpTo, true); return allocateTo(vmProfile, plan, type, avoid, returnUpTo, true);
@ -489,8 +474,6 @@ public class FirstFitAllocator extends AdapterBase implements HostAllocator {
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException { public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
if (_configDao != null) { if (_configDao != null) {
Map<String, String> configs = _configDao.getConfiguration(params); Map<String, String> configs = _configDao.getConfiguration(params);
String opFactor = configs.get("cpu.overprovisioning.factor");
_factor = NumbersUtil.parseFloat(opFactor, 1);
String allocationAlgorithm = configs.get("vm.allocation.algorithm"); String allocationAlgorithm = configs.get("vm.allocation.algorithm");
if (allocationAlgorithm != null) { if (allocationAlgorithm != null) {

View File

@ -42,6 +42,7 @@ public class ParamGenericValidationWorker implements DispatchWorker {
protected static final List<String> defaultParamNames = new ArrayList<String>(); protected static final List<String> defaultParamNames = new ArrayList<String>();
static { static {
defaultParamNames.add(ApiConstants.ACCOUNT_ID);
defaultParamNames.add(ApiConstants.CTX_START_EVENT_ID); defaultParamNames.add(ApiConstants.CTX_START_EVENT_ID);
defaultParamNames.add(ApiConstants.COMMAND); defaultParamNames.add(ApiConstants.COMMAND);
defaultParamNames.add(ApiConstants.CMD_EVENT_TYPE); defaultParamNames.add(ApiConstants.CMD_EVENT_TYPE);
@ -62,6 +63,8 @@ public class ParamGenericValidationWorker implements DispatchWorker {
defaultParamNames.add(ApiConstants.CTX_ACCOUNT_ID); defaultParamNames.add(ApiConstants.CTX_ACCOUNT_ID);
defaultParamNames.add(ApiConstants.CTX_START_EVENT_ID); defaultParamNames.add(ApiConstants.CTX_START_EVENT_ID);
defaultParamNames.add(ApiConstants.CTX_USER_ID); defaultParamNames.add(ApiConstants.CTX_USER_ID);
defaultParamNames.add(ApiConstants.UUID);
defaultParamNames.add(ApiConstants.ID);
defaultParamNames.add("_"); defaultParamNames.add("_");
} }

View File

@ -25,6 +25,8 @@ import javax.persistence.GenerationType;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.Table; import javax.persistence.Table;
import com.cloud.utils.NumbersUtil;
@Entity @Entity
@Table(name = "dedicated_resources") @Table(name = "dedicated_resources")
public class DedicatedResourceVO implements DedicatedResources { public class DedicatedResourceVO implements DedicatedResources {
@ -163,4 +165,9 @@ public class DedicatedResourceVO implements DedicatedResources {
return false; return false;
} }
} }
@Override
public int hashCode() {
return NumbersUtil.hash(id);
}
} }

View File

@ -31,8 +31,6 @@ import javax.ejb.Local;
import javax.inject.Inject; import javax.inject.Inject;
import javax.naming.ConfigurationException; import javax.naming.ConfigurationException;
import org.apache.log4j.Logger;
import org.apache.cloudstack.affinity.AffinityGroupProcessor; import org.apache.cloudstack.affinity.AffinityGroupProcessor;
import org.apache.cloudstack.affinity.AffinityGroupService; import org.apache.cloudstack.affinity.AffinityGroupService;
import org.apache.cloudstack.affinity.AffinityGroupVMMapVO; import org.apache.cloudstack.affinity.AffinityGroupVMMapVO;
@ -51,6 +49,7 @@ import org.apache.cloudstack.managed.context.ManagedContextTimerTask;
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO; import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
import org.apache.cloudstack.utils.identity.ManagementServerNode; import org.apache.cloudstack.utils.identity.ManagementServerNode;
import org.apache.log4j.Logger;
import com.cloud.agent.AgentManager; import com.cloud.agent.AgentManager;
import com.cloud.agent.Listener; import com.cloud.agent.Listener;
@ -284,12 +283,7 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements Deploy
plannerName = _configDao.getValue(Config.VmDeploymentPlanner.key()); plannerName = _configDao.getValue(Config.VmDeploymentPlanner.key());
} }
} }
for (DeploymentPlanner plannerInList : _planners) { planner = getDeploymentPlannerByName(plannerName);
if (plannerName.equals(plannerInList.getName())) {
planner = plannerInList;
break;
}
}
} }
int cpu_requested = offering.getCpu() * offering.getSpeed(); int cpu_requested = offering.getCpu() * offering.getSpeed();
@ -450,7 +444,6 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements Deploy
if (planner != null && planner.canHandle(vmProfile, plan, avoids)) { if (planner != null && planner.canHandle(vmProfile, plan, avoids)) {
while (true) { while (true) {
if (planner instanceof DeploymentClusterPlanner) { if (planner instanceof DeploymentClusterPlanner) {
ExcludeList plannerAvoidInput = ExcludeList plannerAvoidInput =
@ -502,6 +495,21 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements Deploy
return dest; return dest;
} }
@Override
public DeploymentPlanner getDeploymentPlannerByName(String plannerName) {
if (plannerName != null) {
for (DeploymentPlanner plannerInList : _planners) {
if (plannerName != null) {
}
if (plannerName.equalsIgnoreCase(plannerInList.getName())) {
return plannerInList;
}
}
}
return null;
}
private void checkForNonDedicatedResources(VirtualMachineProfile vmProfile, DataCenter dc, ExcludeList avoids) { private void checkForNonDedicatedResources(VirtualMachineProfile vmProfile, DataCenter dc, ExcludeList avoids) {
boolean isExplicit = false; boolean isExplicit = false;
VirtualMachine vm = vmProfile.getVirtualMachine(); VirtualMachine vm = vmProfile.getVirtualMachine();
@ -1345,7 +1353,7 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements Deploy
@DB @DB
@Override @Override
public String finalizeReservation(final DeployDestination plannedDestination, final VirtualMachineProfile vmProfile, DeploymentPlan plan, ExcludeList avoids) public String finalizeReservation(final DeployDestination plannedDestination, final VirtualMachineProfile vmProfile, DeploymentPlan plan, ExcludeList avoids, final DeploymentPlanner planner)
throws InsufficientServerCapacityException, AffinityConflictException { throws InsufficientServerCapacityException, AffinityConflictException {
final VirtualMachine vm = vmProfile.getVirtualMachine(); final VirtualMachine vm = vmProfile.getVirtualMachine();
@ -1374,6 +1382,9 @@ public class DeploymentPlanningManagerImpl extends ManagerBase implements Deploy
VMReservationVO vmReservation = VMReservationVO vmReservation =
new VMReservationVO(vm.getId(), plannedDestination.getDataCenter().getId(), plannedDestination.getPod().getId(), plannedDestination.getCluster() new VMReservationVO(vm.getId(), plannedDestination.getDataCenter().getId(), plannedDestination.getPod().getId(), plannedDestination.getCluster()
.getId(), plannedDestination.getHost().getId()); .getId(), plannedDestination.getHost().getId());
if (planner != null) {
vmReservation.setDeploymentPlanner(planner.getName());
}
Map<Long, Long> volumeReservationMap = new HashMap<Long, Long>(); Map<Long, Long> volumeReservationMap = new HashMap<Long, Long>();
if (vm.getHypervisorType() != HypervisorType.BareMetal) { if (vm.getHypervisorType() != HypervisorType.BareMetal) {

View File

@ -25,13 +25,12 @@ import javax.ejb.Local;
import javax.inject.Inject; import javax.inject.Inject;
import javax.naming.ConfigurationException; import javax.naming.ConfigurationException;
import org.apache.log4j.Logger;
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager; import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
import org.apache.cloudstack.framework.config.ConfigKey; import org.apache.cloudstack.framework.config.ConfigKey;
import org.apache.cloudstack.framework.config.Configurable; import org.apache.cloudstack.framework.config.Configurable;
import org.apache.cloudstack.framework.config.dao.ConfigurationDao; import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
import org.apache.log4j.Logger;
import com.cloud.capacity.Capacity; import com.cloud.capacity.Capacity;
import com.cloud.capacity.CapacityManager; import com.cloud.capacity.CapacityManager;

View File

@ -1346,7 +1346,7 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
PublicIp publicIp = PublicIp.createFromAddrAndVlan(ipToAssoc, _vlanDao.findById(ipToAssoc.getVlanId())); PublicIp publicIp = PublicIp.createFromAddrAndVlan(ipToAssoc, _vlanDao.findById(ipToAssoc.getVlanId()));
ipList.add(publicIp); ipList.add(publicIp);
Map<PublicIpAddress, Set<Service>> ipToServices = _networkModel.getIpToServices(ipList, false, true); Map<PublicIpAddress, Set<Service>> ipToServices = _networkModel.getIpToServices(ipList, false, true);
if (ipToServices != null & !ipToServices.isEmpty()) { if (!ipToServices.isEmpty()) {
Set<Service> services = ipToServices.get(publicIp); Set<Service> services = ipToServices.get(publicIp);
if (services != null && !services.isEmpty()) { if (services != null && !services.isEmpty()) {
throw new InvalidParameterValueException("IP " + ipToAssoc + " has services and rules associated in the network " + networkId); throw new InvalidParameterValueException("IP " + ipToAssoc + " has services and rules associated in the network " + networkId);
@ -1387,7 +1387,7 @@ public class IpAddressManagerImpl extends ManagerBase implements IpAddressManage
PublicIp publicIp = PublicIp.createFromAddrAndVlan(ip, _vlanDao.findById(ip.getVlanId())); PublicIp publicIp = PublicIp.createFromAddrAndVlan(ip, _vlanDao.findById(ip.getVlanId()));
ipList.add(publicIp); ipList.add(publicIp);
Map<PublicIpAddress, Set<Service>> ipToServices = _networkModel.getIpToServices(ipList, false, true); Map<PublicIpAddress, Set<Service>> ipToServices = _networkModel.getIpToServices(ipList, false, true);
if (ipToServices != null & !ipToServices.isEmpty()) { if (!ipToServices.isEmpty()) {
Set<Service> ipServices = ipToServices.get(publicIp); Set<Service> ipServices = ipToServices.get(publicIp);
if (ipServices != null && !ipServices.isEmpty()) { if (ipServices != null && !ipServices.isEmpty()) {
return false; return false;

View File

@ -1378,8 +1378,8 @@ public class AutoScaleManagerImpl<Type> extends ManagerBase implements AutoScale
private boolean startNewVM(long vmId) { private boolean startNewVM(long vmId) {
try { try {
CallContext.current().setEventDetails("Vm Id: " + vmId); CallContext.current().setEventDetails("Vm Id: " + vmId);
_userVmManager.startVirtualMachine(vmId, null, null); _userVmManager.startVirtualMachine(vmId, null, null, null);
} catch (ResourceUnavailableException ex) { } catch (final ResourceUnavailableException ex) {
s_logger.warn("Exception: ", ex); s_logger.warn("Exception: ", ex);
throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage()); throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage());
} catch (ConcurrentOperationException ex) { } catch (ConcurrentOperationException ex) {

View File

@ -44,11 +44,9 @@ import org.apache.commons.codec.binary.Base64;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.apache.cloudstack.acl.ControlledEntity; import org.apache.cloudstack.acl.ControlledEntity;
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
import org.apache.cloudstack.affinity.AffinityGroupProcessor; import org.apache.cloudstack.affinity.AffinityGroupProcessor;
import org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao; import org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao;
import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseUpdateTemplateOrIsoCmd;
import org.apache.cloudstack.api.command.admin.account.CreateAccountCmd; import org.apache.cloudstack.api.command.admin.account.CreateAccountCmd;
import org.apache.cloudstack.api.command.admin.account.DeleteAccountCmd; import org.apache.cloudstack.api.command.admin.account.DeleteAccountCmd;
import org.apache.cloudstack.api.command.admin.account.DisableAccountCmd; import org.apache.cloudstack.api.command.admin.account.DisableAccountCmd;
@ -557,18 +555,14 @@ import com.cloud.storage.GuestOSHypervisor;
import com.cloud.storage.GuestOSHypervisorVO; import com.cloud.storage.GuestOSHypervisorVO;
import com.cloud.storage.GuestOSVO; import com.cloud.storage.GuestOSVO;
import com.cloud.storage.GuestOsCategory; import com.cloud.storage.GuestOsCategory;
import com.cloud.storage.Storage.ImageFormat;
import com.cloud.storage.Storage.TemplateType;
import com.cloud.storage.StorageManager; import com.cloud.storage.StorageManager;
import com.cloud.storage.StoragePool; import com.cloud.storage.StoragePool;
import com.cloud.storage.VMTemplateVO;
import com.cloud.storage.Volume; import com.cloud.storage.Volume;
import com.cloud.storage.VolumeVO; import com.cloud.storage.VolumeVO;
import com.cloud.storage.dao.DiskOfferingDao; import com.cloud.storage.dao.DiskOfferingDao;
import com.cloud.storage.dao.GuestOSCategoryDao; import com.cloud.storage.dao.GuestOSCategoryDao;
import com.cloud.storage.dao.GuestOSDao; import com.cloud.storage.dao.GuestOSDao;
import com.cloud.storage.dao.GuestOSHypervisorDao; import com.cloud.storage.dao.GuestOSHypervisorDao;
import com.cloud.storage.dao.VMTemplateDao;
import com.cloud.storage.dao.VolumeDao; import com.cloud.storage.dao.VolumeDao;
import com.cloud.storage.secondary.SecondaryStorageVmManager; import com.cloud.storage.secondary.SecondaryStorageVmManager;
import com.cloud.tags.ResourceTagVO; import com.cloud.tags.ResourceTagVO;
@ -584,7 +578,6 @@ import com.cloud.user.UserVO;
import com.cloud.user.dao.AccountDao; import com.cloud.user.dao.AccountDao;
import com.cloud.user.dao.SSHKeyPairDao; import com.cloud.user.dao.SSHKeyPairDao;
import com.cloud.user.dao.UserDao; import com.cloud.user.dao.UserDao;
import com.cloud.utils.EnumUtils;
import com.cloud.utils.NumbersUtil; import com.cloud.utils.NumbersUtil;
import com.cloud.utils.Pair; import com.cloud.utils.Pair;
import com.cloud.utils.PasswordGenerator; import com.cloud.utils.PasswordGenerator;
@ -669,8 +662,6 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
@Inject @Inject
private DiskOfferingDao _diskOfferingDao; private DiskOfferingDao _diskOfferingDao;
@Inject @Inject
private VMTemplateDao _templateDao;
@Inject
private DomainDao _domainDao; private DomainDao _domainDao;
@Inject @Inject
private AccountDao _accountDao; private AccountDao _accountDao;
@ -738,12 +729,10 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
private AccountService _accountService; private AccountService _accountService;
@Inject @Inject
private ServiceOfferingDao _offeringDao; private ServiceOfferingDao _offeringDao;
@Inject @Inject
private DeploymentPlanningManager _dpMgr; private DeploymentPlanningManager _dpMgr;
private LockMasterListener _lockMasterListener; private LockMasterListener _lockMasterListener;
private final ScheduledExecutorService _eventExecutor = Executors.newScheduledThreadPool(1, new NamedThreadFactory("EventChecker")); private final ScheduledExecutorService _eventExecutor = Executors.newScheduledThreadPool(1, new NamedThreadFactory("EventChecker"));
private final ScheduledExecutorService _alertExecutor = Executors.newScheduledThreadPool(1, new NamedThreadFactory("AlertChecker")); private final ScheduledExecutorService _alertExecutor = Executors.newScheduledThreadPool(1, new NamedThreadFactory("AlertChecker"));
@Inject @Inject
@ -1708,210 +1697,6 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
return new Pair<List<? extends Configuration>, Integer>(result.first(), result.second()); return new Pair<List<? extends Configuration>, Integer>(result.first(), result.second());
} }
/* TODO: this method should go away. Keep here just in case that our latest refactoring using template_store_ref missed anything
* in handling Swift or S3.
private Set<Pair<Long, Long>> listTemplates(Long templateId, String name, String keyword, TemplateFilter templateFilter, boolean isIso,
Boolean bootable, Long pageSize, Long startIndex, Long zoneId, HypervisorType hyperType, boolean showDomr, boolean onlyReady,
List<Account> permittedAccounts, Account caller, ListProjectResourcesCriteria listProjectResourcesCriteria, Map<String, String> tags, String zoneType) {
VMTemplateVO template = null;
if (templateId != null) {
template = _templateDao.findById(templateId);
if (template == null) {
throw new InvalidParameterValueException("Please specify a valid template ID.");
}// If ISO requested then it should be ISO.
if (isIso && template.getFormat() != ImageFormat.ISO) {
s_logger.error("Template Id " + templateId + " is not an ISO");
InvalidParameterValueException ex = new InvalidParameterValueException("Specified Template Id is not an ISO");
ex.addProxyObject(template.getUuid(), "templateId");
throw ex;
}// If ISO not requested then it shouldn't be an ISO.
if (!isIso && template.getFormat() == ImageFormat.ISO) {
s_logger.error("Incorrect format of the template id " + templateId);
InvalidParameterValueException ex = new InvalidParameterValueException("Incorrect format " + template.getFormat()
+ " of the specified template id");
ex.addProxyObject(template.getUuid(), "templateId");
throw ex;
}
}
DomainVO domain = null;
if (!permittedAccounts.isEmpty()) {
domain = _domainDao.findById(permittedAccounts.get(0).getDomainId());
} else {
domain = _domainDao.findById(DomainVO.ROOT_DOMAIN);
}
List<HypervisorType> hypers = null;
if (!isIso) {
hypers = _resourceMgr.listAvailHypervisorInZone(null, null);
}
Set<Pair<Long, Long>> templateZonePairSet = new HashSet<Pair<Long, Long>>();
if (_swiftMgr.isSwiftEnabled()) {
if (template == null) {
templateZonePairSet = _templateDao.searchSwiftTemplates(name, keyword, templateFilter, isIso, hypers, bootable, domain, pageSize,
startIndex, zoneId, hyperType, onlyReady, showDomr, permittedAccounts, caller, tags);
Set<Pair<Long, Long>> templateZonePairSet2 = new HashSet<Pair<Long, Long>>();
templateZonePairSet2 = _templateDao.searchTemplates(name, keyword, templateFilter, isIso, hypers, bootable, domain, pageSize,
startIndex, zoneId, hyperType, onlyReady, showDomr, permittedAccounts, caller, listProjectResourcesCriteria, tags, zoneType);
for (Pair<Long, Long> tmpltPair : templateZonePairSet2) {
if (!templateZonePairSet.contains(new Pair<Long, Long>(tmpltPair.first(), -1L))) {
templateZonePairSet.add(tmpltPair);
}
}
} else {
// if template is not public, perform permission check here
if (!template.isPublicTemplate() && caller.getType() != Account.ACCOUNT_TYPE_ADMIN) {
Account owner = _accountMgr.getAccount(template.getAccountId());
_accountMgr.checkAccess(caller, null, true, owner);
}
templateZonePairSet.add(new Pair<Long, Long>(template.getId(), zoneId));
}
} else if (_s3Mgr.isS3Enabled()) {
if (template == null) {
templateZonePairSet = _templateDao.searchSwiftTemplates(name, keyword, templateFilter, isIso,
hypers, bootable, domain, pageSize, startIndex, zoneId, hyperType, onlyReady, showDomr,
permittedAccounts, caller, tags);
Set<Pair<Long, Long>> templateZonePairSet2 = new HashSet<Pair<Long, Long>>();
templateZonePairSet2 = _templateDao.searchTemplates(name, keyword, templateFilter, isIso, hypers,
bootable, domain, pageSize, startIndex, zoneId, hyperType, onlyReady, showDomr,
permittedAccounts, caller, listProjectResourcesCriteria, tags, zoneType);
for (Pair<Long, Long> tmpltPair : templateZonePairSet2) {
if (!templateZonePairSet.contains(new Pair<Long, Long>(tmpltPair.first(), -1L))) {
templateZonePairSet.add(tmpltPair);
}
}
} else {
// if template is not public, perform permission check here
if (!template.isPublicTemplate() && caller.getType() != Account.ACCOUNT_TYPE_ADMIN) {
Account owner = _accountMgr.getAccount(template.getAccountId());
_accountMgr.checkAccess(caller, null, true, owner);
}
templateZonePairSet.add(new Pair<Long, Long>(template.getId(), zoneId));
}
} else {
if (template == null) {
templateZonePairSet = _templateDao.searchTemplates(name, keyword, templateFilter, isIso, hypers, bootable, domain, pageSize,
startIndex, zoneId, hyperType, onlyReady, showDomr, permittedAccounts, caller, listProjectResourcesCriteria, tags, zoneType);
} else {
// if template is not public, perform permission check here
if (!template.isPublicTemplate() && caller.getType() != Account.ACCOUNT_TYPE_ADMIN) {
Account owner = _accountMgr.getAccount(template.getAccountId());
_accountMgr.checkAccess(caller, null, true, owner);
}
templateZonePairSet.add(new Pair<Long, Long>(template.getId(), zoneId));
}
}
return templateZonePairSet;
}
*/
private VMTemplateVO updateTemplateOrIso(BaseUpdateTemplateOrIsoCmd cmd) {
Long id = cmd.getId();
String name = cmd.getTemplateName();
String displayText = cmd.getDisplayText();
String format = cmd.getFormat();
Long guestOSId = cmd.getOsTypeId();
Boolean passwordEnabled = cmd.isPasswordEnabled();
Boolean bootable = cmd.isBootable();
Integer sortKey = cmd.getSortKey();
Boolean isDynamicallyScalable = cmd.isDynamicallyScalable();
Boolean isRoutingTemplate = cmd.isRoutingType();
Account account = CallContext.current().getCallingAccount();
// verify that template exists
VMTemplateVO template = _templateDao.findById(id);
if (template == null || template.getRemoved() != null) {
InvalidParameterValueException ex = new InvalidParameterValueException("unable to find template/iso with specified id");
ex.addProxyObject(id.toString(), "templateId");
throw ex;
}
// Don't allow to modify system template
if (id.equals(Long.valueOf(1))) {
InvalidParameterValueException ex = new InvalidParameterValueException("Unable to update template/iso of specified id");
ex.addProxyObject(template.getUuid(), "templateId");
throw ex;
}
// do a permission check
_accountMgr.checkAccess(account, AccessType.OperateEntry, true, template);
if(cmd.isRoutingType() != null){
if (!_accountService.isRootAdmin(account.getId())) {
throw new PermissionDeniedException("Parameter isrouting can only be specified by a Root Admin, permission denied");
}
}
boolean updateNeeded = !(name == null && displayText == null && format == null && guestOSId == null && passwordEnabled == null && bootable == null && sortKey == null
&& isDynamicallyScalable == null && isRoutingTemplate == null);
if (!updateNeeded) {
return template;
}
template = _templateDao.createForUpdate(id);
if (name != null) {
template.setName(name);
}
if (displayText != null) {
template.setDisplayText(displayText);
}
if (sortKey != null) {
template.setSortKey(sortKey);
}
ImageFormat imageFormat = null;
if (format != null) {
try {
imageFormat = ImageFormat.valueOf(format.toUpperCase());
} catch (IllegalArgumentException e) {
throw new InvalidParameterValueException("Image format: " + format + " is incorrect. Supported formats are " + EnumUtils.listValues(ImageFormat.values()));
}
template.setFormat(imageFormat);
}
if (guestOSId != null) {
GuestOSVO guestOS = _guestOSDao.findById(guestOSId);
if (guestOS == null) {
throw new InvalidParameterValueException("Please specify a valid guest OS ID.");
} else {
template.setGuestOSId(guestOSId);
}
}
if (passwordEnabled != null) {
template.setEnablePassword(passwordEnabled);
}
if (bootable != null) {
template.setBootable(bootable);
}
if (isDynamicallyScalable != null) {
template.setDynamicallyScalable(isDynamicallyScalable);
}
if (isRoutingTemplate != null) {
if (isRoutingTemplate) {
template.setTemplateType(TemplateType.ROUTING);
} else {
template.setTemplateType(TemplateType.USER);
}
}
_templateDao.update(id, template);
return _templateDao.findById(id);
}
@Override @Override
public Pair<List<? extends IpAddress>, Integer> searchForIPAddresses(ListPublicIpAddressesCmd cmd) { public Pair<List<? extends IpAddress>, Integer> searchForIPAddresses(ListPublicIpAddressesCmd cmd) {
Object keyword = cmd.getKeyword(); Object keyword = cmd.getKeyword();
@ -3463,7 +3248,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
} }
} }
long diskOffMaxSize = _volumeMgr.CustomDiskOfferingMaxSize.value(); long diskOffMaxSize = VolumeOrchestrationService.CustomDiskOfferingMaxSize.value();
KVMSnapshotEnabled = Boolean.parseBoolean(_configDao.getValue("KVM.snapshot.enabled")); KVMSnapshotEnabled = Boolean.parseBoolean(_configDao.getValue("KVM.snapshot.enabled"));
boolean userPublicTemplateEnabled = TemplateManager.AllowPublicUserTemplates.valueIn(caller.getId()); boolean userPublicTemplateEnabled = TemplateManager.AllowPublicUserTemplates.valueIn(caller.getId());

View File

@ -88,7 +88,7 @@ public interface UserVmManager extends UserVmService {
boolean expunge(UserVmVO vm, long callerUserId, Account caller); boolean expunge(UserVmVO vm, long callerUserId, Account caller);
Pair<UserVmVO, Map<VirtualMachineProfile.Param, Object>> startVirtualMachine(long vmId, Long hostId, Map<VirtualMachineProfile.Param, Object> additionalParams) Pair<UserVmVO, Map<VirtualMachineProfile.Param, Object>> startVirtualMachine(long vmId, Long hostId, Map<VirtualMachineProfile.Param, Object> additionalParams, String deploymentPlannerToUse)
throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException; throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException;
boolean upgradeVirtualMachine(Long id, Long serviceOfferingId, Map<String, String> customParameters) throws ResourceUnavailableException, boolean upgradeVirtualMachine(Long id, Long serviceOfferingId, Map<String, String> customParameters) throws ResourceUnavailableException,

View File

@ -115,7 +115,9 @@ import com.cloud.dc.dao.DedicatedResourceDao;
import com.cloud.dc.dao.HostPodDao; import com.cloud.dc.dao.HostPodDao;
import com.cloud.deploy.DataCenterDeployment; import com.cloud.deploy.DataCenterDeployment;
import com.cloud.deploy.DeployDestination; import com.cloud.deploy.DeployDestination;
import com.cloud.deploy.DeploymentPlanner;
import com.cloud.deploy.DeploymentPlanner.ExcludeList; import com.cloud.deploy.DeploymentPlanner.ExcludeList;
import com.cloud.deploy.DeploymentPlanningManager;
import com.cloud.deploy.PlannerHostReservationVO; import com.cloud.deploy.PlannerHostReservationVO;
import com.cloud.deploy.dao.PlannerHostReservationDao; import com.cloud.deploy.dao.PlannerHostReservationDao;
import com.cloud.domain.DomainVO; import com.cloud.domain.DomainVO;
@ -391,7 +393,6 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
protected ProjectManager _projectMgr; protected ProjectManager _projectMgr;
@Inject @Inject
protected ResourceManager _resourceMgr; protected ResourceManager _resourceMgr;
@Inject @Inject
protected NetworkServiceMapDao _ntwkSrvcDao; protected NetworkServiceMapDao _ntwkSrvcDao;
@Inject @Inject
@ -410,17 +411,14 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
protected GuestOSCategoryDao _guestOSCategoryDao; protected GuestOSCategoryDao _guestOSCategoryDao;
@Inject @Inject
UsageEventDao _usageEventDao; UsageEventDao _usageEventDao;
@Inject @Inject
SecondaryStorageVmDao _secondaryDao; SecondaryStorageVmDao _secondaryDao;
@Inject @Inject
VmDiskStatisticsDao _vmDiskStatsDao; VmDiskStatisticsDao _vmDiskStatsDao;
@Inject @Inject
protected VMSnapshotDao _vmSnapshotDao; protected VMSnapshotDao _vmSnapshotDao;
@Inject @Inject
protected VMSnapshotManager _vmSnapshotMgr; protected VMSnapshotManager _vmSnapshotMgr;
@Inject @Inject
AffinityGroupVMMapDao _affinityGroupVMMapDao; AffinityGroupVMMapDao _affinityGroupVMMapDao;
@Inject @Inject
@ -445,6 +443,8 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
UserVmDetailsDao _uservmDetailsDao; UserVmDetailsDao _uservmDetailsDao;
@Inject @Inject
UUIDManager _uuidMgr; UUIDManager _uuidMgr;
@Inject
DeploymentPlanningManager _planningMgr;
protected ScheduledExecutorService _executor = null; protected ScheduledExecutorService _executor = null;
protected int _expungeInterval; protected int _expungeInterval;
@ -1970,7 +1970,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
@Override @Override
@ActionEvent(eventType = EventTypes.EVENT_VM_START, eventDescription = "starting Vm", async = true) @ActionEvent(eventType = EventTypes.EVENT_VM_START, eventDescription = "starting Vm", async = true)
public UserVm startVirtualMachine(StartVMCmd cmd) throws ExecutionException, ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException { public UserVm startVirtualMachine(StartVMCmd cmd) throws ExecutionException, ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
return startVirtualMachine(cmd.getId(), cmd.getHostId(), null).first(); return startVirtualMachine(cmd.getId(), cmd.getHostId(), null, cmd.getDeploymentPlanner()).first();
} }
@Override @Override
@ -2972,10 +2972,10 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
@Override @Override
@ActionEvent(eventType = EventTypes.EVENT_VM_CREATE, eventDescription = "starting Vm", async = true) @ActionEvent(eventType = EventTypes.EVENT_VM_CREATE, eventDescription = "starting Vm", async = true)
public UserVm startVirtualMachine(DeployVMCmd cmd) throws ResourceUnavailableException, InsufficientCapacityException, ConcurrentOperationException { public UserVm startVirtualMachine(DeployVMCmd cmd) throws ResourceUnavailableException, InsufficientCapacityException, ConcurrentOperationException {
return startVirtualMachine(cmd, null); return startVirtualMachine(cmd, null, cmd.getDeploymentPlanner());
} }
protected UserVm startVirtualMachine(DeployVMCmd cmd, Map<VirtualMachineProfile.Param, Object> additonalParams) throws ResourceUnavailableException, protected UserVm startVirtualMachine(DeployVMCmd cmd, Map<VirtualMachineProfile.Param, Object> additonalParams, String deploymentPlannerToUse) throws ResourceUnavailableException,
InsufficientCapacityException, ConcurrentOperationException { InsufficientCapacityException, ConcurrentOperationException {
long vmId = cmd.getEntityId(); long vmId = cmd.getEntityId();
@ -2984,7 +2984,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
Pair<UserVmVO, Map<VirtualMachineProfile.Param, Object>> vmParamPair = null; Pair<UserVmVO, Map<VirtualMachineProfile.Param, Object>> vmParamPair = null;
try { try {
vmParamPair = startVirtualMachine(vmId, hostId, additonalParams); vmParamPair = startVirtualMachine(vmId, hostId, additonalParams, deploymentPlannerToUse);
vm = vmParamPair.first(); vm = vmParamPair.first();
} finally { } finally {
updateVmStateForFailedVmCreation(vm.getId(), hostId); updateVmStateForFailedVmCreation(vm.getId(), hostId);
@ -3230,7 +3230,7 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
} }
@Override @Override
public Pair<UserVmVO, Map<VirtualMachineProfile.Param, Object>> startVirtualMachine(long vmId, Long hostId, Map<VirtualMachineProfile.Param, Object> additionalParams) public Pair<UserVmVO, Map<VirtualMachineProfile.Param, Object>> startVirtualMachine(long vmId, Long hostId, Map<VirtualMachineProfile.Param, Object> additionalParams, String deploymentPlannerToUse)
throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException { throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
// Input validation // Input validation
Account callerAccount = CallContext.current().getCallingAccount(); Account callerAccount = CallContext.current().getCallingAccount();
@ -3323,18 +3323,17 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
VirtualMachineEntity vmEntity = _orchSrvc.getVirtualMachine(vm.getUuid()); VirtualMachineEntity vmEntity = _orchSrvc.getVirtualMachine(vm.getUuid());
// Get serviceOffering for Virtual Machine DeploymentPlanner planner = null;
ServiceOfferingVO offering = _serviceOfferingDao.findByIdIncludingRemoved(vm.getId(), vm.getServiceOfferingId()); if (deploymentPlannerToUse != null) {
String plannerName = offering.getDeploymentPlanner(); // if set to null, the deployment planner would be later figured out either from global config var, or from
if (plannerName == null) { // the service offering
if (vm.getHypervisorType() == HypervisorType.BareMetal) { planner = _planningMgr.getDeploymentPlannerByName(deploymentPlannerToUse);
plannerName = "BareMetalPlanner"; if (planner == null) {
} else { throw new InvalidParameterValueException("Can't find a planner by name " + deploymentPlannerToUse);
plannerName = _configDao.getValue(Config.VmDeploymentPlanner.key());
} }
} }
String reservationId = vmEntity.reserve(plannerName, plan, new ExcludeList(), Long.toString(callerUser.getId())); String reservationId = vmEntity.reserve(planner, plan, new ExcludeList(), Long.toString(callerUser.getId()));
vmEntity.deploy(reservationId, Long.toString(callerUser.getId()), params); vmEntity.deploy(reservationId, Long.toString(callerUser.getId()), params);
Pair<UserVmVO, Map<VirtualMachineProfile.Param, Object>> vmParamPair = new Pair(vm, params); Pair<UserVmVO, Map<VirtualMachineProfile.Param, Object>> vmParamPair = new Pair(vm, params);

View File

@ -75,6 +75,30 @@ public class ParamGenericValidationWorkerTest {
final BaseCmd cmd = new FakeCmd(); final BaseCmd cmd = new FakeCmd();
final Map<String, String> params = new HashMap<String, String>(); final Map<String, String> params = new HashMap<String, String>();
params.put(ApiConstants.COMMAND, ""); params.put(ApiConstants.COMMAND, "");
params.put(ApiConstants.ACCOUNT_ID, "");
params.put(ApiConstants.CTX_START_EVENT_ID, "");
params.put(ApiConstants.COMMAND, "");
params.put(ApiConstants.CMD_EVENT_TYPE, "");
params.put(ApiConstants.USERNAME, "");
params.put(ApiConstants.USER_ID, "");
params.put(ApiConstants.PASSWORD, "");
params.put(ApiConstants.DOMAIN, "");
params.put(ApiConstants.DOMAIN_ID, "");
params.put(ApiConstants.DOMAIN__ID, "");
params.put(ApiConstants.SESSIONKEY, "");
params.put(ApiConstants.RESPONSE, "");
params.put(ApiConstants.PAGE, "");
params.put(ApiConstants.USER_API_KEY, "");
params.put(ApiConstants.API_KEY, "");
params.put(ApiConstants.PAGE_SIZE, "");
params.put(ApiConstants.HTTPMETHOD, "");
params.put(ApiConstants.SIGNATURE, "");
params.put(ApiConstants.CTX_ACCOUNT_ID, "");
params.put(ApiConstants.CTX_START_EVENT_ID, "");
params.put(ApiConstants.CTX_USER_ID, "");
params.put(ApiConstants.UUID, "");
params.put(ApiConstants.ID, "");
params.put("_", "");
params.put("addedParam", ""); params.put("addedParam", "");
Account account = new AccountVO("testaccount", 1L, "networkdomain", (short) 0, "uuid"); Account account = new AccountVO("testaccount", 1L, "networkdomain", (short) 0, "uuid");

View File

@ -730,3 +730,5 @@ UPDATE `cloud`.`guest_os_hypervisor` SET `created` = now();
ALTER TABLE `cloud`.`guest_os` ADD COLUMN `created` datetime COMMENT 'Time when Guest OS was created in system'; ALTER TABLE `cloud`.`guest_os` ADD COLUMN `created` datetime COMMENT 'Time when Guest OS was created in system';
ALTER TABLE `cloud`.`guest_os` ADD COLUMN `removed` datetime COMMENT 'Time when Guest OS was removed if deleted, else NULL'; ALTER TABLE `cloud`.`guest_os` ADD COLUMN `removed` datetime COMMENT 'Time when Guest OS was removed if deleted, else NULL';
UPDATE `cloud`.`guest_os` SET `created` = now(); UPDATE `cloud`.`guest_os` SET `created` = now();
ALTER TABLE `cloud`.`vm_reservation` ADD COLUMN `deployment_planner` varchar(40) DEFAULT NULL COMMENT 'Preferred deployment planner for the vm';