mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Fixes after functional tests
Conflicts: client/tomcatconf/commands.properties.in
This commit is contained in:
parent
bb9bdf0173
commit
c7c899f62d
@ -1,9 +1,9 @@
|
|||||||
package com.cloud.exception;
|
package com.cloud.exception;
|
||||||
|
|
||||||
import com.cloud.exception.CloudException;
|
|
||||||
import com.cloud.utils.SerialVersionUID;
|
import com.cloud.utils.SerialVersionUID;
|
||||||
|
import com.cloud.utils.exception.CloudRuntimeException;
|
||||||
|
|
||||||
public class AffinityConflictException extends CloudException {
|
public class AffinityConflictException extends CloudRuntimeException {
|
||||||
|
|
||||||
private static final long serialVersionUID = SerialVersionUID.AffinityConflictException;
|
private static final long serialVersionUID = SerialVersionUID.AffinityConflictException;
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,27 @@
|
|||||||
package org.apache.cloudstack.affinity;
|
package org.apache.cloudstack.affinity;
|
||||||
|
|
||||||
import org.apache.cloudstack.deploy.UserPreferrenceProcessor;
|
import com.cloud.deploy.DeploymentPlan;
|
||||||
|
import com.cloud.deploy.DeploymentPlanner.ExcludeList;
|
||||||
|
import com.cloud.exception.AffinityConflictException;
|
||||||
|
import com.cloud.utils.component.Adapter;
|
||||||
|
import com.cloud.vm.VirtualMachine;
|
||||||
|
import com.cloud.vm.VirtualMachineProfile;
|
||||||
|
|
||||||
public interface AffinityGroupProcessor extends UserPreferrenceProcessor {
|
public interface AffinityGroupProcessor extends Adapter {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* process() is called to apply any user preferences to the deployment plan
|
||||||
|
* and avoid set for the given VM placement.
|
||||||
|
*
|
||||||
|
* @param vm
|
||||||
|
* virtual machine.
|
||||||
|
* @param plan
|
||||||
|
* deployment plan that tells you where it's being deployed to.
|
||||||
|
* @param avoid
|
||||||
|
* avoid these data centers, pods, clusters, or hosts.
|
||||||
|
*/
|
||||||
|
void process(VirtualMachineProfile<? extends VirtualMachine> vm, DeploymentPlan plan, ExcludeList avoid)
|
||||||
|
throws AffinityConflictException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* getType() should return the affinity/anti-affinity group being
|
* getType() should return the affinity/anti-affinity group being
|
||||||
|
|||||||
@ -0,0 +1,28 @@
|
|||||||
|
package org.apache.cloudstack.affinity;
|
||||||
|
|
||||||
|
import com.cloud.deploy.DeploymentPlan;
|
||||||
|
import com.cloud.deploy.DeploymentPlanner.ExcludeList;
|
||||||
|
import com.cloud.exception.AffinityConflictException;
|
||||||
|
import com.cloud.utils.component.AdapterBase;
|
||||||
|
import com.cloud.vm.VirtualMachine;
|
||||||
|
import com.cloud.vm.VirtualMachineProfile;
|
||||||
|
|
||||||
|
public class AffinityProcessorBase extends AdapterBase implements AffinityGroupProcessor {
|
||||||
|
|
||||||
|
protected String _type;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void process(VirtualMachineProfile<? extends VirtualMachine> vm, DeploymentPlan plan, ExcludeList avoid)
|
||||||
|
throws AffinityConflictException {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getType() {
|
||||||
|
return _type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(String type) {
|
||||||
|
_type = type;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,27 +0,0 @@
|
|||||||
package org.apache.cloudstack.deploy;
|
|
||||||
|
|
||||||
|
|
||||||
import com.cloud.deploy.DeploymentPlan;
|
|
||||||
import com.cloud.deploy.DeploymentPlanner.ExcludeList;
|
|
||||||
import com.cloud.exception.AffinityConflictException;
|
|
||||||
import com.cloud.utils.component.Adapter;
|
|
||||||
import com.cloud.vm.VirtualMachine;
|
|
||||||
import com.cloud.vm.VirtualMachineProfile;
|
|
||||||
|
|
||||||
public interface UserPreferrenceProcessor extends Adapter {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* process() is called to apply any user preferences to the deployment plan
|
|
||||||
* and avoid set for the given VM placement.
|
|
||||||
*
|
|
||||||
* @param vm
|
|
||||||
* virtual machine.
|
|
||||||
* @param plan
|
|
||||||
* deployment plan that tells you where it's being deployed to.
|
|
||||||
* @param avoid
|
|
||||||
* avoid these data centers, pods, clusters, or hosts.
|
|
||||||
*/
|
|
||||||
void process(VirtualMachineProfile<? extends VirtualMachine> vm, DeploymentPlan plan, ExcludeList avoid)
|
|
||||||
throws AffinityConflictException;
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -574,3 +574,4 @@ createAffinityGroup=15
|
|||||||
deleteAffinityGroup=15
|
deleteAffinityGroup=15
|
||||||
listAffinityGroups=15
|
listAffinityGroups=15
|
||||||
updateVMAffinityGroup=15
|
updateVMAffinityGroup=15
|
||||||
|
listAffinityGroupTypes=15
|
||||||
|
|||||||
@ -36,7 +36,9 @@ import com.cloud.deploy.DataCenterDeployment;
|
|||||||
import com.cloud.deploy.DeployDestination;
|
import com.cloud.deploy.DeployDestination;
|
||||||
import com.cloud.deploy.DeploymentPlan;
|
import com.cloud.deploy.DeploymentPlan;
|
||||||
import com.cloud.deploy.DeploymentPlanner;
|
import com.cloud.deploy.DeploymentPlanner;
|
||||||
|
import com.cloud.deploy.DeploymentPlanningManager;
|
||||||
import com.cloud.deploy.DeploymentPlanner.ExcludeList;
|
import com.cloud.deploy.DeploymentPlanner.ExcludeList;
|
||||||
|
import com.cloud.exception.AffinityConflictException;
|
||||||
import com.cloud.exception.AgentUnavailableException;
|
import com.cloud.exception.AgentUnavailableException;
|
||||||
import com.cloud.exception.ConcurrentOperationException;
|
import com.cloud.exception.ConcurrentOperationException;
|
||||||
import com.cloud.exception.InsufficientCapacityException;
|
import com.cloud.exception.InsufficientCapacityException;
|
||||||
@ -55,7 +57,7 @@ import com.cloud.storage.dao.VMTemplateDao;
|
|||||||
import com.cloud.storage.dao.VolumeDao;
|
import com.cloud.storage.dao.VolumeDao;
|
||||||
import com.cloud.user.dao.AccountDao;
|
import com.cloud.user.dao.AccountDao;
|
||||||
import com.cloud.user.dao.UserDao;
|
import com.cloud.user.dao.UserDao;
|
||||||
import com.cloud.utils.component.ComponentContext;
|
import com.cloud.utils.exception.CloudRuntimeException;
|
||||||
import com.cloud.vm.VMInstanceVO;
|
import com.cloud.vm.VMInstanceVO;
|
||||||
import com.cloud.vm.VirtualMachineManager;
|
import com.cloud.vm.VirtualMachineManager;
|
||||||
import com.cloud.vm.VirtualMachineProfile;
|
import com.cloud.vm.VirtualMachineProfile;
|
||||||
@ -69,42 +71,45 @@ public class VMEntityManagerImpl implements VMEntityManager {
|
|||||||
protected VMInstanceDao _vmDao;
|
protected VMInstanceDao _vmDao;
|
||||||
@Inject
|
@Inject
|
||||||
protected VMTemplateDao _templateDao = null;
|
protected VMTemplateDao _templateDao = null;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected ServiceOfferingDao _serviceOfferingDao;
|
protected ServiceOfferingDao _serviceOfferingDao;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected DiskOfferingDao _diskOfferingDao = null;
|
protected DiskOfferingDao _diskOfferingDao = null;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected NetworkDao _networkDao;
|
protected NetworkDao _networkDao;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected AccountDao _accountDao = null;
|
protected AccountDao _accountDao = null;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected UserDao _userDao = null;
|
protected UserDao _userDao = null;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected VMEntityDao _vmEntityDao;
|
protected VMEntityDao _vmEntityDao;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected VMReservationDao _reservationDao;
|
protected VMReservationDao _reservationDao;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected VirtualMachineManager _itMgr;
|
protected VirtualMachineManager _itMgr;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected List<DeploymentPlanner> _planners;
|
protected List<DeploymentPlanner> _planners;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected VolumeDao _volsDao;
|
protected VolumeDao _volsDao;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected PrimaryDataStoreDao _storagePoolDao;
|
protected PrimaryDataStoreDao _storagePoolDao;
|
||||||
@Inject
|
@Inject
|
||||||
DataStoreManager dataStoreMgr;
|
DataStoreManager dataStoreMgr;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
DeploymentPlanningManager _dpMgr;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VMEntityVO loadVirtualMachine(String vmId) {
|
public VMEntityVO loadVirtualMachine(String vmId) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
@ -114,11 +119,11 @@ public class VMEntityManagerImpl implements VMEntityManager {
|
|||||||
@Override
|
@Override
|
||||||
public void saveVirtualMachine(VMEntityVO entity) {
|
public void saveVirtualMachine(VMEntityVO entity) {
|
||||||
_vmEntityDao.persist(entity);
|
_vmEntityDao.persist(entity);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String reserveVirtualMachine(VMEntityVO vmEntityVO, String plannerToUse, DeploymentPlan planToDeploy, ExcludeList exclude)
|
public String reserveVirtualMachine(VMEntityVO vmEntityVO, String plannerToUse, DeploymentPlan planToDeploy, ExcludeList exclude)
|
||||||
throws InsufficientCapacityException, ResourceUnavailableException {
|
throws InsufficientCapacityException, ResourceUnavailableException {
|
||||||
|
|
||||||
//call planner and get the deployDestination.
|
//call planner and get the deployDestination.
|
||||||
@ -130,12 +135,12 @@ public class VMEntityManagerImpl implements VMEntityManager {
|
|||||||
if(planToDeploy != null && planToDeploy.getDataCenterId() != 0){
|
if(planToDeploy != null && planToDeploy.getDataCenterId() != 0){
|
||||||
plan = new DataCenterDeployment(planToDeploy.getDataCenterId(), planToDeploy.getPodId(), planToDeploy.getClusterId(), planToDeploy.getHostId(), planToDeploy.getPoolId(), planToDeploy.getPhysicalNetworkId());
|
plan = new DataCenterDeployment(planToDeploy.getDataCenterId(), planToDeploy.getPodId(), planToDeploy.getClusterId(), planToDeploy.getHostId(), planToDeploy.getPoolId(), planToDeploy.getPhysicalNetworkId());
|
||||||
}
|
}
|
||||||
|
|
||||||
List<VolumeVO> vols = _volsDao.findReadyRootVolumesByInstance(vm.getId());
|
List<VolumeVO> vols = _volsDao.findReadyRootVolumesByInstance(vm.getId());
|
||||||
if(!vols.isEmpty()){
|
if(!vols.isEmpty()){
|
||||||
VolumeVO vol = vols.get(0);
|
VolumeVO vol = vols.get(0);
|
||||||
StoragePool pool = (StoragePool)this.dataStoreMgr.getPrimaryDataStore(vol.getPoolId());
|
StoragePool pool = (StoragePool)this.dataStoreMgr.getPrimaryDataStore(vol.getPoolId());
|
||||||
|
|
||||||
if (!pool.isInMaintenance()) {
|
if (!pool.isInMaintenance()) {
|
||||||
long rootVolDcId = pool.getDataCenterId();
|
long rootVolDcId = pool.getDataCenterId();
|
||||||
Long rootVolPodId = pool.getPodId();
|
Long rootVolPodId = pool.getPodId();
|
||||||
@ -156,21 +161,21 @@ public class VMEntityManagerImpl implements VMEntityManager {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
DeployDestination dest;
|
||||||
|
try {
|
||||||
|
dest = _dpMgr.planDeployment(vmProfile, plan, exclude);
|
||||||
|
} catch (AffinityConflictException e) {
|
||||||
|
throw new CloudRuntimeException("Unable to create deployment, affinity rules associted to the VM conflict");
|
||||||
}
|
}
|
||||||
|
|
||||||
DeploymentPlanner planner = ComponentContext.getComponent(plannerToUse);
|
|
||||||
DeployDestination dest = null;
|
|
||||||
|
|
||||||
if (planner.canHandle(vmProfile, plan, exclude)) {
|
|
||||||
dest = planner.plan(vmProfile, plan, exclude);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dest != null) {
|
if (dest != null) {
|
||||||
//save destination with VMEntityVO
|
//save destination with VMEntityVO
|
||||||
VMReservationVO vmReservation = new VMReservationVO(vm.getId(), dest.getDataCenter().getId(), dest.getPod().getId(), dest.getCluster().getId(), dest.getHost().getId());
|
VMReservationVO vmReservation = new VMReservationVO(vm.getId(), dest.getDataCenter().getId(), dest.getPod().getId(), dest.getCluster().getId(), dest.getHost().getId());
|
||||||
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) {
|
||||||
for(Volume vo : dest.getStorageForDisks().keySet()){
|
for(Volume vo : dest.getStorageForDisks().keySet()){
|
||||||
volumeReservationMap.put(vo.getId(), dest.getStorageForDisks().get(vo).getId());
|
volumeReservationMap.put(vo.getId(), dest.getStorageForDisks().get(vo).getId());
|
||||||
@ -180,21 +185,21 @@ public class VMEntityManagerImpl implements VMEntityManager {
|
|||||||
|
|
||||||
vmEntityVO.setVmReservation(vmReservation);
|
vmEntityVO.setVmReservation(vmReservation);
|
||||||
_vmEntityDao.persist(vmEntityVO);
|
_vmEntityDao.persist(vmEntityVO);
|
||||||
|
|
||||||
return vmReservation.getUuid();
|
return vmReservation.getUuid();
|
||||||
}else{
|
}else{
|
||||||
throw new InsufficientServerCapacityException("Unable to create a deployment for " + vmProfile, DataCenter.class, plan.getDataCenterId());
|
throw new InsufficientServerCapacityException("Unable to create a deployment for " + vmProfile, DataCenter.class, plan.getDataCenterId());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deployVirtualMachine(String reservationId, String caller, Map<VirtualMachineProfile.Param, Object> params) throws InsufficientCapacityException, ResourceUnavailableException{
|
public void deployVirtualMachine(String reservationId, String caller, Map<VirtualMachineProfile.Param, Object> params) throws InsufficientCapacityException, ResourceUnavailableException{
|
||||||
//grab the VM Id and destination using the reservationId.
|
//grab the VM Id and destination using the reservationId.
|
||||||
|
|
||||||
VMReservationVO vmReservation = _reservationDao.findByReservationId(reservationId);
|
VMReservationVO vmReservation = _reservationDao.findByReservationId(reservationId);
|
||||||
long vmId = vmReservation.getVmId();
|
long vmId = vmReservation.getVmId();
|
||||||
|
|
||||||
VMInstanceVO vm = _vmDao.findById(vmId);
|
VMInstanceVO vm = _vmDao.findById(vmId);
|
||||||
//Pass it down
|
//Pass it down
|
||||||
Long poolId = null;
|
Long poolId = null;
|
||||||
@ -205,12 +210,17 @@ public class VMEntityManagerImpl implements VMEntityManager {
|
|||||||
poolId = storage.get(volIdList.get(0));
|
poolId = storage.get(volIdList.get(0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DataCenterDeployment plan = new DataCenterDeployment(vm.getDataCenterId(), vmReservation.getPodId(), vmReservation.getClusterId(),
|
DataCenterDeployment reservedPlan = new DataCenterDeployment(vm.getDataCenterId(), vmReservation.getPodId(), vmReservation.getClusterId(),
|
||||||
vmReservation.getHostId(), null , null);
|
vmReservation.getHostId(), null , null);
|
||||||
|
try{
|
||||||
VMInstanceVO vmDeployed = _itMgr.start(vm, params, _userDao.findById(new Long(caller)), _accountDao.findById(vm.getAccountId()), plan);
|
VMInstanceVO vmDeployed = _itMgr.start(vm, params, _userDao.findById(new Long(caller)), _accountDao.findById(vm.getAccountId()), reservedPlan);
|
||||||
|
}catch(Exception ex){
|
||||||
|
//Retry the deployment without using the reservation plan
|
||||||
|
DataCenterDeployment plan = new DataCenterDeployment(vm.getDataCenterId(), null, null,null, null , null);
|
||||||
|
_itMgr.start(vm, params, _userDao.findById(new Long(caller)), _accountDao.findById(vm.getAccountId()), plan);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -227,7 +237,7 @@ public class VMEntityManagerImpl implements VMEntityManager {
|
|||||||
VMInstanceVO vm = _vmDao.findByUuid(vmEntityVO.getUuid());
|
VMInstanceVO vm = _vmDao.findByUuid(vmEntityVO.getUuid());
|
||||||
return _itMgr.destroy(vm, _userDao.findById(new Long(caller)), _accountDao.findById(vm.getAccountId()));
|
return _itMgr.destroy(vm, _userDao.findById(new Long(caller)), _accountDao.findById(vm.getAccountId()));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,7 +28,6 @@ import org.apache.log4j.Logger;
|
|||||||
import com.cloud.deploy.DeploymentPlan;
|
import com.cloud.deploy.DeploymentPlan;
|
||||||
import com.cloud.deploy.DeploymentPlanner.ExcludeList;
|
import com.cloud.deploy.DeploymentPlanner.ExcludeList;
|
||||||
import com.cloud.exception.AffinityConflictException;
|
import com.cloud.exception.AffinityConflictException;
|
||||||
import com.cloud.utils.component.AdapterBase;
|
|
||||||
import com.cloud.vm.VMInstanceVO;
|
import com.cloud.vm.VMInstanceVO;
|
||||||
import com.cloud.vm.VirtualMachine;
|
import com.cloud.vm.VirtualMachine;
|
||||||
import com.cloud.vm.VirtualMachineProfile;
|
import com.cloud.vm.VirtualMachineProfile;
|
||||||
@ -36,7 +35,7 @@ import com.cloud.vm.dao.UserVmDao;
|
|||||||
import com.cloud.vm.dao.VMInstanceDao;
|
import com.cloud.vm.dao.VMInstanceDao;
|
||||||
|
|
||||||
@Local(value = AffinityGroupProcessor.class)
|
@Local(value = AffinityGroupProcessor.class)
|
||||||
public class HostAntiAffinityProcessor extends AdapterBase implements AffinityGroupProcessor {
|
public class HostAntiAffinityProcessor extends AffinityProcessorBase implements AffinityGroupProcessor {
|
||||||
|
|
||||||
private static final Logger s_logger = Logger.getLogger(HostAntiAffinityProcessor.class);
|
private static final Logger s_logger = Logger.getLogger(HostAntiAffinityProcessor.class);
|
||||||
@Inject
|
@Inject
|
||||||
@ -74,9 +73,4 @@ public class HostAntiAffinityProcessor extends AdapterBase implements AffinityGr
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getType() {
|
|
||||||
return "HostAntiAffinity";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -161,38 +161,44 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentPlanner {
|
|||||||
+ hostIdSpecified);
|
+ hostIdSpecified);
|
||||||
}
|
}
|
||||||
HostVO host = _hostDao.findById(hostIdSpecified);
|
HostVO host = _hostDao.findById(hostIdSpecified);
|
||||||
if (s_logger.isDebugEnabled()) {
|
if (host == null) {
|
||||||
if(host == null){
|
s_logger.debug("The specified host cannot be found");
|
||||||
s_logger.debug("The specified host cannot be found");
|
} else if (avoid.shouldAvoid(host)) {
|
||||||
}else{
|
s_logger.debug("The specified host is in avoid set");
|
||||||
|
} else {
|
||||||
|
if (s_logger.isDebugEnabled()) {
|
||||||
s_logger.debug("Looking for suitable pools for this host under zone: "+host.getDataCenterId() +", pod: "+ host.getPodId()+", cluster: "+ host.getClusterId());
|
s_logger.debug("Looking for suitable pools for this host under zone: "+host.getDataCenterId() +", pod: "+ host.getPodId()+", cluster: "+ host.getClusterId());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//search for storage under the zone, pod, cluster of the host.
|
// search for storage under the zone, pod, cluster of the host.
|
||||||
DataCenterDeployment lastPlan = new DataCenterDeployment(host.getDataCenterId(), host.getPodId(), host.getClusterId(), hostIdSpecified, plan.getPoolId(), null, plan.getReservationContext());
|
DataCenterDeployment lastPlan = new DataCenterDeployment(host.getDataCenterId(), host.getPodId(),
|
||||||
|
host.getClusterId(), hostIdSpecified, plan.getPoolId(), null, plan.getReservationContext());
|
||||||
|
|
||||||
Pair<Map<Volume, List<StoragePool>>, List<Volume>> result = findSuitablePoolsForVolumes(vmProfile, lastPlan, avoid, HostAllocator.RETURN_UPTO_ALL);
|
Pair<Map<Volume, List<StoragePool>>, List<Volume>> result = findSuitablePoolsForVolumes(vmProfile,
|
||||||
Map<Volume, List<StoragePool>> suitableVolumeStoragePools = result.first();
|
lastPlan, avoid, HostAllocator.RETURN_UPTO_ALL);
|
||||||
List<Volume> readyAndReusedVolumes = result.second();
|
Map<Volume, List<StoragePool>> suitableVolumeStoragePools = result.first();
|
||||||
|
List<Volume> readyAndReusedVolumes = result.second();
|
||||||
|
|
||||||
//choose the potential pool for this VM for this host
|
// choose the potential pool for this VM for this host
|
||||||
if(!suitableVolumeStoragePools.isEmpty()){
|
if (!suitableVolumeStoragePools.isEmpty()) {
|
||||||
List<Host> suitableHosts = new ArrayList<Host>();
|
List<Host> suitableHosts = new ArrayList<Host>();
|
||||||
suitableHosts.add(host);
|
suitableHosts.add(host);
|
||||||
|
|
||||||
Pair<Host, Map<Volume, StoragePool>> potentialResources = findPotentialDeploymentResources(suitableHosts, suitableVolumeStoragePools);
|
Pair<Host, Map<Volume, StoragePool>> potentialResources = findPotentialDeploymentResources(
|
||||||
if(potentialResources != null){
|
suitableHosts, suitableVolumeStoragePools);
|
||||||
Pod pod = _podDao.findById(host.getPodId());
|
if (potentialResources != null) {
|
||||||
Cluster cluster = _clusterDao.findById(host.getClusterId());
|
Pod pod = _podDao.findById(host.getPodId());
|
||||||
Map<Volume, StoragePool> storageVolMap = potentialResources.second();
|
Cluster cluster = _clusterDao.findById(host.getClusterId());
|
||||||
// remove the reused vol<->pool from destination, since we don't have to prepare this volume.
|
Map<Volume, StoragePool> storageVolMap = potentialResources.second();
|
||||||
for(Volume vol : readyAndReusedVolumes){
|
// remove the reused vol<->pool from destination, since
|
||||||
storageVolMap.remove(vol);
|
// we don't have to prepare this volume.
|
||||||
|
for (Volume vol : readyAndReusedVolumes) {
|
||||||
|
storageVolMap.remove(vol);
|
||||||
|
}
|
||||||
|
DeployDestination dest = new DeployDestination(dc, pod, cluster, host, storageVolMap);
|
||||||
|
s_logger.debug("Returning Deployment Destination: " + dest);
|
||||||
|
return dest;
|
||||||
}
|
}
|
||||||
DeployDestination dest = new DeployDestination(dc, pod, cluster, host, storageVolMap);
|
|
||||||
s_logger.debug("Returning Deployment Destination: "+ dest);
|
|
||||||
return dest;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
s_logger.debug("Cannnot deploy to specified host, returning.");
|
s_logger.debug("Cannnot deploy to specified host, returning.");
|
||||||
|
|||||||
@ -37,14 +37,9 @@ import java.util.concurrent.Executors;
|
|||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
|
||||||
import javax.crypto.Mac;
|
import javax.crypto.Mac;
|
||||||
import javax.crypto.spec.SecretKeySpec;
|
import javax.crypto.spec.SecretKeySpec;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.management.InstanceAlreadyExistsException;
|
|
||||||
import javax.management.MBeanRegistrationException;
|
|
||||||
import javax.management.MalformedObjectNameException;
|
|
||||||
import javax.management.NotCompliantMBeanException;
|
|
||||||
import javax.naming.ConfigurationException;
|
import javax.naming.ConfigurationException;
|
||||||
|
|
||||||
import com.cloud.storage.dao.*;
|
import com.cloud.storage.dao.*;
|
||||||
@ -54,59 +49,43 @@ import org.apache.cloudstack.api.ApiConstants;
|
|||||||
import com.cloud.event.ActionEventUtils;
|
import com.cloud.event.ActionEventUtils;
|
||||||
import org.apache.cloudstack.api.BaseUpdateTemplateOrIsoCmd;
|
import org.apache.cloudstack.api.BaseUpdateTemplateOrIsoCmd;
|
||||||
import org.apache.cloudstack.api.command.admin.account.*;
|
import org.apache.cloudstack.api.command.admin.account.*;
|
||||||
import org.apache.cloudstack.api.command.admin.autoscale.*;
|
|
||||||
import org.apache.cloudstack.api.command.admin.cluster.*;
|
|
||||||
import org.apache.cloudstack.api.command.admin.config.*;
|
|
||||||
import org.apache.cloudstack.api.command.admin.domain.*;
|
import org.apache.cloudstack.api.command.admin.domain.*;
|
||||||
import org.apache.cloudstack.api.command.admin.host.*;
|
import org.apache.cloudstack.api.command.admin.host.*;
|
||||||
import org.apache.cloudstack.api.command.admin.ldap.*;
|
|
||||||
import org.apache.cloudstack.api.command.admin.network.*;
|
import org.apache.cloudstack.api.command.admin.network.*;
|
||||||
import org.apache.cloudstack.api.command.admin.offering.*;
|
import org.apache.cloudstack.api.command.admin.offering.*;
|
||||||
import org.apache.cloudstack.api.command.admin.pod.*;
|
|
||||||
import org.apache.cloudstack.api.command.admin.region.*;
|
|
||||||
import org.apache.cloudstack.api.command.admin.resource.*;
|
import org.apache.cloudstack.api.command.admin.resource.*;
|
||||||
import org.apache.cloudstack.api.command.admin.router.*;
|
import org.apache.cloudstack.api.command.admin.router.*;
|
||||||
import org.apache.cloudstack.api.command.admin.storage.*;
|
import org.apache.cloudstack.api.command.admin.storage.*;
|
||||||
import org.apache.cloudstack.api.command.admin.swift.*;
|
|
||||||
import org.apache.cloudstack.api.command.admin.systemvm.*;
|
import org.apache.cloudstack.api.command.admin.systemvm.*;
|
||||||
import org.apache.cloudstack.api.command.admin.template.*;
|
|
||||||
import org.apache.cloudstack.api.command.admin.usage.*;
|
import org.apache.cloudstack.api.command.admin.usage.*;
|
||||||
import org.apache.cloudstack.api.command.admin.user.*;
|
import org.apache.cloudstack.api.command.admin.user.*;
|
||||||
import org.apache.cloudstack.api.command.admin.vlan.*;
|
|
||||||
import org.apache.cloudstack.api.command.admin.vm.*;
|
|
||||||
import org.apache.cloudstack.api.command.admin.vpc.*;
|
import org.apache.cloudstack.api.command.admin.vpc.*;
|
||||||
import org.apache.cloudstack.api.command.admin.zone.*;
|
|
||||||
import org.apache.cloudstack.api.command.user.account.*;
|
|
||||||
import org.apache.cloudstack.api.command.user.address.*;
|
|
||||||
import org.apache.cloudstack.api.command.user.autoscale.*;
|
import org.apache.cloudstack.api.command.user.autoscale.*;
|
||||||
import org.apache.cloudstack.api.command.user.config.*;
|
|
||||||
import org.apache.cloudstack.api.command.user.event.*;
|
|
||||||
import org.apache.cloudstack.api.command.user.firewall.*;
|
import org.apache.cloudstack.api.command.user.firewall.*;
|
||||||
import org.apache.cloudstack.api.command.user.guest.*;
|
|
||||||
import org.apache.cloudstack.api.command.user.iso.*;
|
import org.apache.cloudstack.api.command.user.iso.*;
|
||||||
import org.apache.cloudstack.api.command.user.job.*;
|
|
||||||
import org.apache.cloudstack.api.command.user.loadbalancer.*;
|
import org.apache.cloudstack.api.command.user.loadbalancer.*;
|
||||||
import org.apache.cloudstack.api.command.user.nat.*;
|
import org.apache.cloudstack.api.command.user.nat.*;
|
||||||
import org.apache.cloudstack.api.command.user.network.*;
|
import org.apache.cloudstack.api.command.user.network.*;
|
||||||
import org.apache.cloudstack.api.command.user.offering.*;
|
|
||||||
import org.apache.cloudstack.api.command.user.project.*;
|
import org.apache.cloudstack.api.command.user.project.*;
|
||||||
import org.apache.cloudstack.api.command.user.region.*;
|
|
||||||
import org.apache.cloudstack.api.command.user.resource.*;
|
import org.apache.cloudstack.api.command.user.resource.*;
|
||||||
import org.apache.cloudstack.api.command.user.securitygroup.*;
|
import org.apache.cloudstack.api.command.user.securitygroup.*;
|
||||||
import org.apache.cloudstack.api.command.user.snapshot.*;
|
import org.apache.cloudstack.api.command.user.snapshot.*;
|
||||||
import org.apache.cloudstack.api.command.user.ssh.*;
|
|
||||||
import org.apache.cloudstack.api.command.user.tag.*;
|
|
||||||
import org.apache.cloudstack.api.command.user.template.*;
|
import org.apache.cloudstack.api.command.user.template.*;
|
||||||
import org.apache.cloudstack.api.command.user.vm.*;
|
import org.apache.cloudstack.api.command.user.vm.*;
|
||||||
import org.apache.cloudstack.api.command.user.vmgroup.*;
|
|
||||||
import org.apache.cloudstack.api.command.user.volume.*;
|
import org.apache.cloudstack.api.command.user.volume.*;
|
||||||
import org.apache.cloudstack.api.command.user.vpc.*;
|
import org.apache.cloudstack.api.command.user.vpc.*;
|
||||||
import org.apache.cloudstack.api.command.user.vpn.*;
|
import org.apache.cloudstack.api.command.user.vpn.*;
|
||||||
import org.apache.cloudstack.api.command.user.zone.*;
|
|
||||||
import org.apache.cloudstack.api.response.ExtractResponse;
|
import org.apache.cloudstack.api.response.ExtractResponse;
|
||||||
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 org.springframework.stereotype.Component;
|
import org.apache.cloudstack.affinity.AffinityGroupProcessor;
|
||||||
|
import org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao;
|
||||||
|
|
||||||
|
import org.apache.cloudstack.api.command.user.affinitygroup.CreateAffinityGroupCmd;
|
||||||
|
import org.apache.cloudstack.api.command.user.affinitygroup.DeleteAffinityGroupCmd;
|
||||||
|
import org.apache.cloudstack.api.command.user.affinitygroup.ListAffinityGroupTypesCmd;
|
||||||
|
import org.apache.cloudstack.api.command.user.affinitygroup.ListAffinityGroupsCmd;
|
||||||
|
import org.apache.cloudstack.api.command.user.affinitygroup.UpdateVMAffinityGroupCmd;
|
||||||
import com.cloud.agent.AgentManager;
|
import com.cloud.agent.AgentManager;
|
||||||
import com.cloud.agent.api.GetVncPortAnswer;
|
import com.cloud.agent.api.GetVncPortAnswer;
|
||||||
import com.cloud.agent.api.GetVncPortCommand;
|
import com.cloud.agent.api.GetVncPortCommand;
|
||||||
@ -140,7 +119,6 @@ import com.cloud.deploy.DeploymentPlanner.ExcludeList;
|
|||||||
import com.cloud.domain.DomainVO;
|
import com.cloud.domain.DomainVO;
|
||||||
import com.cloud.domain.dao.DomainDao;
|
import com.cloud.domain.dao.DomainDao;
|
||||||
import com.cloud.event.ActionEvent;
|
import com.cloud.event.ActionEvent;
|
||||||
import com.cloud.event.ActionEventUtils;
|
|
||||||
import com.cloud.event.EventTypes;
|
import com.cloud.event.EventTypes;
|
||||||
import com.cloud.event.EventVO;
|
import com.cloud.event.EventVO;
|
||||||
import com.cloud.event.dao.EventDao;
|
import com.cloud.event.dao.EventDao;
|
||||||
@ -175,7 +153,6 @@ import com.cloud.service.dao.ServiceOfferingDao;
|
|||||||
import com.cloud.storage.*;
|
import com.cloud.storage.*;
|
||||||
import com.cloud.storage.Storage.ImageFormat;
|
import com.cloud.storage.Storage.ImageFormat;
|
||||||
import com.cloud.storage.Upload.Mode;
|
import com.cloud.storage.Upload.Mode;
|
||||||
import com.cloud.storage.dao.*;
|
|
||||||
import com.cloud.storage.s3.S3Manager;
|
import com.cloud.storage.s3.S3Manager;
|
||||||
import com.cloud.storage.secondary.SecondaryStorageVmManager;
|
import com.cloud.storage.secondary.SecondaryStorageVmManager;
|
||||||
import com.cloud.storage.snapshot.SnapshotManager;
|
import com.cloud.storage.snapshot.SnapshotManager;
|
||||||
@ -193,11 +170,7 @@ 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;
|
||||||
import com.cloud.utils.ReflectUtil;
|
|
||||||
import com.cloud.utils.Ternary;
|
import com.cloud.utils.Ternary;
|
||||||
import com.cloud.utils.component.Adapter;
|
|
||||||
import com.cloud.utils.component.AdapterBase;
|
|
||||||
import com.cloud.utils.component.ComponentContext;
|
|
||||||
import com.cloud.utils.component.ComponentLifecycle;
|
import com.cloud.utils.component.ComponentLifecycle;
|
||||||
import com.cloud.utils.component.ManagerBase;
|
import com.cloud.utils.component.ManagerBase;
|
||||||
import com.cloud.utils.concurrency.NamedThreadFactory;
|
import com.cloud.utils.concurrency.NamedThreadFactory;
|
||||||
@ -214,10 +187,6 @@ import com.cloud.vm.dao.*;
|
|||||||
import edu.emory.mathcs.backport.java.util.Arrays;
|
import edu.emory.mathcs.backport.java.util.Arrays;
|
||||||
import edu.emory.mathcs.backport.java.util.Collections;
|
import edu.emory.mathcs.backport.java.util.Collections;
|
||||||
import org.apache.cloudstack.acl.ControlledEntity;
|
import org.apache.cloudstack.acl.ControlledEntity;
|
||||||
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
|
|
||||||
import org.apache.cloudstack.api.ApiConstants;
|
|
||||||
import org.apache.cloudstack.api.BaseUpdateTemplateOrIsoCmd;
|
|
||||||
import org.apache.cloudstack.api.command.admin.account.*;
|
|
||||||
import org.apache.cloudstack.api.command.admin.autoscale.CreateCounterCmd;
|
import org.apache.cloudstack.api.command.admin.autoscale.CreateCounterCmd;
|
||||||
import org.apache.cloudstack.api.command.admin.autoscale.DeleteCounterCmd;
|
import org.apache.cloudstack.api.command.admin.autoscale.DeleteCounterCmd;
|
||||||
import org.apache.cloudstack.api.command.admin.cluster.AddClusterCmd;
|
import org.apache.cloudstack.api.command.admin.cluster.AddClusterCmd;
|
||||||
@ -228,12 +197,8 @@ import org.apache.cloudstack.api.command.admin.config.ListCfgsByCmd;
|
|||||||
import org.apache.cloudstack.api.command.admin.config.ListHypervisorCapabilitiesCmd;
|
import org.apache.cloudstack.api.command.admin.config.ListHypervisorCapabilitiesCmd;
|
||||||
import org.apache.cloudstack.api.command.admin.config.UpdateCfgCmd;
|
import org.apache.cloudstack.api.command.admin.config.UpdateCfgCmd;
|
||||||
import org.apache.cloudstack.api.command.admin.config.UpdateHypervisorCapabilitiesCmd;
|
import org.apache.cloudstack.api.command.admin.config.UpdateHypervisorCapabilitiesCmd;
|
||||||
import org.apache.cloudstack.api.command.admin.domain.*;
|
|
||||||
import org.apache.cloudstack.api.command.admin.host.*;
|
|
||||||
import org.apache.cloudstack.api.command.admin.ldap.LDAPConfigCmd;
|
import org.apache.cloudstack.api.command.admin.ldap.LDAPConfigCmd;
|
||||||
import org.apache.cloudstack.api.command.admin.ldap.LDAPRemoveCmd;
|
import org.apache.cloudstack.api.command.admin.ldap.LDAPRemoveCmd;
|
||||||
import org.apache.cloudstack.api.command.admin.network.*;
|
|
||||||
import org.apache.cloudstack.api.command.admin.offering.*;
|
|
||||||
import org.apache.cloudstack.api.command.admin.pod.CreatePodCmd;
|
import org.apache.cloudstack.api.command.admin.pod.CreatePodCmd;
|
||||||
import org.apache.cloudstack.api.command.admin.pod.DeletePodCmd;
|
import org.apache.cloudstack.api.command.admin.pod.DeletePodCmd;
|
||||||
import org.apache.cloudstack.api.command.admin.pod.ListPodsByCmd;
|
import org.apache.cloudstack.api.command.admin.pod.ListPodsByCmd;
|
||||||
@ -241,22 +206,15 @@ import org.apache.cloudstack.api.command.admin.pod.UpdatePodCmd;
|
|||||||
import org.apache.cloudstack.api.command.admin.region.AddRegionCmd;
|
import org.apache.cloudstack.api.command.admin.region.AddRegionCmd;
|
||||||
import org.apache.cloudstack.api.command.admin.region.RemoveRegionCmd;
|
import org.apache.cloudstack.api.command.admin.region.RemoveRegionCmd;
|
||||||
import org.apache.cloudstack.api.command.admin.region.UpdateRegionCmd;
|
import org.apache.cloudstack.api.command.admin.region.UpdateRegionCmd;
|
||||||
import org.apache.cloudstack.api.command.admin.resource.*;
|
|
||||||
import org.apache.cloudstack.api.command.admin.router.*;
|
|
||||||
import org.apache.cloudstack.api.command.admin.storage.*;
|
|
||||||
import org.apache.cloudstack.api.command.admin.swift.AddSwiftCmd;
|
import org.apache.cloudstack.api.command.admin.swift.AddSwiftCmd;
|
||||||
import org.apache.cloudstack.api.command.admin.swift.ListSwiftsCmd;
|
import org.apache.cloudstack.api.command.admin.swift.ListSwiftsCmd;
|
||||||
import org.apache.cloudstack.api.command.admin.systemvm.*;
|
|
||||||
import org.apache.cloudstack.api.command.admin.template.PrepareTemplateCmd;
|
import org.apache.cloudstack.api.command.admin.template.PrepareTemplateCmd;
|
||||||
import org.apache.cloudstack.api.command.admin.usage.*;
|
|
||||||
import org.apache.cloudstack.api.command.admin.user.*;
|
|
||||||
import org.apache.cloudstack.api.command.admin.vlan.CreateVlanIpRangeCmd;
|
import org.apache.cloudstack.api.command.admin.vlan.CreateVlanIpRangeCmd;
|
||||||
import org.apache.cloudstack.api.command.admin.vlan.DeleteVlanIpRangeCmd;
|
import org.apache.cloudstack.api.command.admin.vlan.DeleteVlanIpRangeCmd;
|
||||||
import org.apache.cloudstack.api.command.admin.vlan.ListVlanIpRangesCmd;
|
import org.apache.cloudstack.api.command.admin.vlan.ListVlanIpRangesCmd;
|
||||||
import org.apache.cloudstack.api.command.admin.vm.AssignVMCmd;
|
import org.apache.cloudstack.api.command.admin.vm.AssignVMCmd;
|
||||||
import org.apache.cloudstack.api.command.admin.vm.MigrateVMCmd;
|
import org.apache.cloudstack.api.command.admin.vm.MigrateVMCmd;
|
||||||
import org.apache.cloudstack.api.command.admin.vm.RecoverVMCmd;
|
import org.apache.cloudstack.api.command.admin.vm.RecoverVMCmd;
|
||||||
import org.apache.cloudstack.api.command.admin.vpc.*;
|
|
||||||
import org.apache.cloudstack.api.command.admin.zone.CreateZoneCmd;
|
import org.apache.cloudstack.api.command.admin.zone.CreateZoneCmd;
|
||||||
import org.apache.cloudstack.api.command.admin.zone.DeleteZoneCmd;
|
import org.apache.cloudstack.api.command.admin.zone.DeleteZoneCmd;
|
||||||
import org.apache.cloudstack.api.command.admin.zone.MarkDefaultZoneForAccountCmd;
|
import org.apache.cloudstack.api.command.admin.zone.MarkDefaultZoneForAccountCmd;
|
||||||
@ -268,29 +226,19 @@ import org.apache.cloudstack.api.command.user.account.ListProjectAccountsCmd;
|
|||||||
import org.apache.cloudstack.api.command.user.address.AssociateIPAddrCmd;
|
import org.apache.cloudstack.api.command.user.address.AssociateIPAddrCmd;
|
||||||
import org.apache.cloudstack.api.command.user.address.DisassociateIPAddrCmd;
|
import org.apache.cloudstack.api.command.user.address.DisassociateIPAddrCmd;
|
||||||
import org.apache.cloudstack.api.command.user.address.ListPublicIpAddressesCmd;
|
import org.apache.cloudstack.api.command.user.address.ListPublicIpAddressesCmd;
|
||||||
import org.apache.cloudstack.api.command.user.autoscale.*;
|
|
||||||
import org.apache.cloudstack.api.command.user.config.ListCapabilitiesCmd;
|
import org.apache.cloudstack.api.command.user.config.ListCapabilitiesCmd;
|
||||||
import org.apache.cloudstack.api.command.user.event.ArchiveEventsCmd;
|
import org.apache.cloudstack.api.command.user.event.ArchiveEventsCmd;
|
||||||
import org.apache.cloudstack.api.command.user.event.DeleteEventsCmd;
|
import org.apache.cloudstack.api.command.user.event.DeleteEventsCmd;
|
||||||
import org.apache.cloudstack.api.command.user.event.ListEventTypesCmd;
|
import org.apache.cloudstack.api.command.user.event.ListEventTypesCmd;
|
||||||
import org.apache.cloudstack.api.command.user.event.ListEventsCmd;
|
import org.apache.cloudstack.api.command.user.event.ListEventsCmd;
|
||||||
import org.apache.cloudstack.api.command.user.firewall.*;
|
|
||||||
import org.apache.cloudstack.api.command.user.guest.ListGuestOsCategoriesCmd;
|
import org.apache.cloudstack.api.command.user.guest.ListGuestOsCategoriesCmd;
|
||||||
import org.apache.cloudstack.api.command.user.guest.ListGuestOsCmd;
|
import org.apache.cloudstack.api.command.user.guest.ListGuestOsCmd;
|
||||||
import org.apache.cloudstack.api.command.user.iso.*;
|
|
||||||
import org.apache.cloudstack.api.command.user.job.ListAsyncJobsCmd;
|
import org.apache.cloudstack.api.command.user.job.ListAsyncJobsCmd;
|
||||||
import org.apache.cloudstack.api.command.user.job.QueryAsyncJobResultCmd;
|
import org.apache.cloudstack.api.command.user.job.QueryAsyncJobResultCmd;
|
||||||
import org.apache.cloudstack.api.command.user.loadbalancer.*;
|
|
||||||
import org.apache.cloudstack.api.command.user.nat.*;
|
|
||||||
import org.apache.cloudstack.api.command.user.network.*;
|
|
||||||
import org.apache.cloudstack.api.command.user.offering.ListDiskOfferingsCmd;
|
import org.apache.cloudstack.api.command.user.offering.ListDiskOfferingsCmd;
|
||||||
import org.apache.cloudstack.api.command.user.offering.ListServiceOfferingsCmd;
|
import org.apache.cloudstack.api.command.user.offering.ListServiceOfferingsCmd;
|
||||||
import org.apache.cloudstack.api.command.user.project.*;
|
|
||||||
import org.apache.cloudstack.api.command.user.region.ListRegionsCmd;
|
import org.apache.cloudstack.api.command.user.region.ListRegionsCmd;
|
||||||
import org.apache.cloudstack.api.command.user.region.ha.gslb.*;
|
import org.apache.cloudstack.api.command.user.region.ha.gslb.*;
|
||||||
import org.apache.cloudstack.api.command.user.resource.*;
|
|
||||||
import org.apache.cloudstack.api.command.user.securitygroup.*;
|
|
||||||
import org.apache.cloudstack.api.command.user.snapshot.*;
|
|
||||||
import org.apache.cloudstack.api.command.user.ssh.CreateSSHKeyPairCmd;
|
import org.apache.cloudstack.api.command.user.ssh.CreateSSHKeyPairCmd;
|
||||||
import org.apache.cloudstack.api.command.user.ssh.DeleteSSHKeyPairCmd;
|
import org.apache.cloudstack.api.command.user.ssh.DeleteSSHKeyPairCmd;
|
||||||
import org.apache.cloudstack.api.command.user.ssh.ListSSHKeyPairsCmd;
|
import org.apache.cloudstack.api.command.user.ssh.ListSSHKeyPairsCmd;
|
||||||
@ -298,8 +246,6 @@ import org.apache.cloudstack.api.command.user.ssh.RegisterSSHKeyPairCmd;
|
|||||||
import org.apache.cloudstack.api.command.user.tag.CreateTagsCmd;
|
import org.apache.cloudstack.api.command.user.tag.CreateTagsCmd;
|
||||||
import org.apache.cloudstack.api.command.user.tag.DeleteTagsCmd;
|
import org.apache.cloudstack.api.command.user.tag.DeleteTagsCmd;
|
||||||
import org.apache.cloudstack.api.command.user.tag.ListTagsCmd;
|
import org.apache.cloudstack.api.command.user.tag.ListTagsCmd;
|
||||||
import org.apache.cloudstack.api.command.user.template.*;
|
|
||||||
import org.apache.cloudstack.api.command.user.vm.*;
|
|
||||||
import org.apache.cloudstack.api.command.user.vmgroup.CreateVMGroupCmd;
|
import org.apache.cloudstack.api.command.user.vmgroup.CreateVMGroupCmd;
|
||||||
import org.apache.cloudstack.api.command.user.vmgroup.DeleteVMGroupCmd;
|
import org.apache.cloudstack.api.command.user.vmgroup.DeleteVMGroupCmd;
|
||||||
import org.apache.cloudstack.api.command.user.vmgroup.ListVMGroupsCmd;
|
import org.apache.cloudstack.api.command.user.vmgroup.ListVMGroupsCmd;
|
||||||
@ -308,27 +254,10 @@ import org.apache.cloudstack.api.command.user.vmsnapshot.CreateVMSnapshotCmd;
|
|||||||
import org.apache.cloudstack.api.command.user.vmsnapshot.DeleteVMSnapshotCmd;
|
import org.apache.cloudstack.api.command.user.vmsnapshot.DeleteVMSnapshotCmd;
|
||||||
import org.apache.cloudstack.api.command.user.vmsnapshot.ListVMSnapshotCmd;
|
import org.apache.cloudstack.api.command.user.vmsnapshot.ListVMSnapshotCmd;
|
||||||
import org.apache.cloudstack.api.command.user.vmsnapshot.RevertToSnapshotCmd;
|
import org.apache.cloudstack.api.command.user.vmsnapshot.RevertToSnapshotCmd;
|
||||||
import org.apache.cloudstack.api.command.user.volume.*;
|
|
||||||
import org.apache.cloudstack.api.command.user.vpc.*;
|
|
||||||
import org.apache.cloudstack.api.command.user.vpn.*;
|
|
||||||
import org.apache.cloudstack.api.command.user.zone.ListZonesByCmd;
|
import org.apache.cloudstack.api.command.user.zone.ListZonesByCmd;
|
||||||
import org.apache.cloudstack.api.response.ExtractResponse;
|
|
||||||
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.cloudstack.storage.datastore.db.StoragePoolVO;
|
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
|
||||||
import org.apache.commons.codec.binary.Base64;
|
|
||||||
import org.apache.log4j.Logger;
|
|
||||||
|
|
||||||
import javax.crypto.Mac;
|
|
||||||
import javax.crypto.spec.SecretKeySpec;
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import javax.naming.ConfigurationException;
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.net.*;
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.concurrent.Executors;
|
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
public class ManagementServerImpl extends ManagerBase implements ManagementServer {
|
public class ManagementServerImpl extends ManagerBase implements ManagementServer {
|
||||||
public static final Logger s_logger = Logger.getLogger(ManagementServerImpl.class.getName());
|
public static final Logger s_logger = Logger.getLogger(ManagementServerImpl.class.getName());
|
||||||
@ -466,6 +395,12 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
|
|||||||
@Inject ClusterManager _clusterMgr;
|
@Inject ClusterManager _clusterMgr;
|
||||||
private String _hashKey = null;
|
private String _hashKey = null;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
protected AffinityGroupVMMapDao _affinityGroupVMMapDao;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
protected List<AffinityGroupProcessor> _affinityProcessors;
|
||||||
|
|
||||||
public ManagementServerImpl() {
|
public ManagementServerImpl() {
|
||||||
setRunLevel(ComponentLifecycle.RUN_LEVEL_APPLICATION_MAINLOOP);
|
setRunLevel(ComponentLifecycle.RUN_LEVEL_APPLICATION_MAINLOOP);
|
||||||
}
|
}
|
||||||
@ -824,6 +759,15 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
|
|||||||
ExcludeList excludes = new ExcludeList();
|
ExcludeList excludes = new ExcludeList();
|
||||||
excludes.addHost(srcHostId);
|
excludes.addHost(srcHostId);
|
||||||
|
|
||||||
|
// call affinitygroup chain
|
||||||
|
long vmGroupCount = _affinityGroupVMMapDao.countAffinityGroupsForVm(vm.getId());
|
||||||
|
|
||||||
|
if (vmGroupCount > 0) {
|
||||||
|
for (AffinityGroupProcessor processor : _affinityProcessors) {
|
||||||
|
processor.process(vmProfile, plan, excludes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (HostAllocator allocator : _hostAllocators) {
|
for (HostAllocator allocator : _hostAllocators) {
|
||||||
suitableHosts = allocator.allocateTo(vmProfile, plan, Host.Type.Routing, excludes, HostAllocator.RETURN_UPTO_ALL, false);
|
suitableHosts = allocator.allocateTo(vmProfile, plan, Host.Type.Routing, excludes, HostAllocator.RETURN_UPTO_ALL, false);
|
||||||
if (suitableHosts != null && !suitableHosts.isEmpty()) {
|
if (suitableHosts != null && !suitableHosts.isEmpty()) {
|
||||||
@ -2308,6 +2252,8 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
|
|||||||
cmdList.add(DeleteAffinityGroupCmd.class);
|
cmdList.add(DeleteAffinityGroupCmd.class);
|
||||||
cmdList.add(ListAffinityGroupsCmd.class);
|
cmdList.add(ListAffinityGroupsCmd.class);
|
||||||
cmdList.add(UpdateVMAffinityGroupCmd.class);
|
cmdList.add(UpdateVMAffinityGroupCmd.class);
|
||||||
|
cmdList.add(ListAffinityGroupTypesCmd.class);
|
||||||
|
|
||||||
return cmdList;
|
return cmdList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2284,10 +2284,12 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check that the affinity groups exist
|
// check that the affinity groups exist
|
||||||
for (Long affinityGroupId : affinityGroupIdList) {
|
if (affinityGroupIdList != null) {
|
||||||
AffinityGroupVO ag = _affinityGroupDao.findById(affinityGroupId);
|
for (Long affinityGroupId : affinityGroupIdList) {
|
||||||
if (ag == null) {
|
AffinityGroupVO ag = _affinityGroupDao.findById(affinityGroupId);
|
||||||
throw new InvalidParameterValueException("Unable to find affinity group by id " + affinityGroupId);
|
if (ag == null) {
|
||||||
|
throw new InvalidParameterValueException("Unable to find affinity group by id " + affinityGroupId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2582,7 +2584,9 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Use
|
|||||||
|
|
||||||
_securityGroupMgr.addInstanceToGroups(vm.getId(), securityGroupIdList);
|
_securityGroupMgr.addInstanceToGroups(vm.getId(), securityGroupIdList);
|
||||||
|
|
||||||
_affinityGroupVMMapDao.updateMap(vm.getId(), affinityGroupIdList);
|
if (affinityGroupIdList != null && !affinityGroupIdList.isEmpty()) {
|
||||||
|
_affinityGroupVMMapDao.updateMap(vm.getId(), affinityGroupIdList);
|
||||||
|
}
|
||||||
|
|
||||||
return vm;
|
return vm;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -703,8 +703,10 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
|
|||||||
try {
|
try {
|
||||||
dest = _dpMgr.planDeployment(vmProfile, plan, avoids);
|
dest = _dpMgr.planDeployment(vmProfile, plan, avoids);
|
||||||
} catch (AffinityConflictException e2) {
|
} catch (AffinityConflictException e2) {
|
||||||
// TODO Auto-generated catch block
|
s_logger.warn("Unable to create deployment, affinity rules associted to the VM conflict", e2);
|
||||||
e2.printStackTrace();
|
throw new CloudRuntimeException(
|
||||||
|
"Unable to create deployment, affinity rules associted to the VM conflict");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dest == null) {
|
if (dest == null) {
|
||||||
@ -718,6 +720,11 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
|
|||||||
throw new InsufficientServerCapacityException("Unable to create a deployment for " + vmProfile, DataCenter.class, plan.getDataCenterId());
|
throw new InsufficientServerCapacityException("Unable to create a deployment for " + vmProfile, DataCenter.class, plan.getDataCenterId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (dest != null) {
|
||||||
|
avoids.addHost(dest.getHost().getId());
|
||||||
|
journal.record("Deployment found ", vmProfile, dest);
|
||||||
|
}
|
||||||
|
|
||||||
long destHostId = dest.getHost().getId();
|
long destHostId = dest.getHost().getId();
|
||||||
vm.setPodId(dest.getPod().getId());
|
vm.setPodId(dest.getPod().getId());
|
||||||
Long cluster_id = dest.getCluster().getId();
|
Long cluster_id = dest.getCluster().getId();
|
||||||
@ -1486,25 +1493,23 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
|
|||||||
|
|
||||||
DeployDestination dest = null;
|
DeployDestination dest = null;
|
||||||
while (true) {
|
while (true) {
|
||||||
for (DeploymentPlanner planner : _planners) {
|
|
||||||
if (planner.canHandle(profile, plan, excludes)) {
|
|
||||||
dest = planner.plan(profile, plan, excludes);
|
|
||||||
} else {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dest != null) {
|
try {
|
||||||
if (s_logger.isDebugEnabled()) {
|
dest = _dpMgr.planDeployment(profile, plan, excludes);
|
||||||
s_logger.debug("Planner " + planner + " found " + dest + " for migrating to.");
|
} catch (AffinityConflictException e2) {
|
||||||
}
|
s_logger.warn("Unable to create deployment, affinity rules associted to the VM conflict", e2);
|
||||||
break;
|
throw new CloudRuntimeException(
|
||||||
}
|
"Unable to create deployment, affinity rules associted to the VM conflict");
|
||||||
if (s_logger.isDebugEnabled()) {
|
|
||||||
s_logger.debug("Planner " + planner + " was unable to find anything.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dest == null) {
|
if (dest != null) {
|
||||||
|
if (s_logger.isDebugEnabled()) {
|
||||||
|
s_logger.debug("Found destination " + dest + " for migrating to.");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (s_logger.isDebugEnabled()) {
|
||||||
|
s_logger.debug("Unable to find destination for migrating the vm " + profile);
|
||||||
|
}
|
||||||
throw new InsufficientServerCapacityException("Unable to find a server to migrate to.", host.getClusterId());
|
throw new InsufficientServerCapacityException("Unable to find a server to migrate to.", host.getClusterId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -16,6 +16,7 @@ import org.apache.log4j.Logger;
|
|||||||
import org.springframework.context.annotation.Primary;
|
import org.springframework.context.annotation.Primary;
|
||||||
|
|
||||||
|
|
||||||
|
import com.cloud.deploy.DeploymentPlanner;
|
||||||
import com.cloud.event.ActionEvent;
|
import com.cloud.event.ActionEvent;
|
||||||
import com.cloud.event.EventTypes;
|
import com.cloud.event.EventTypes;
|
||||||
import com.cloud.exception.InvalidParameterValueException;
|
import com.cloud.exception.InvalidParameterValueException;
|
||||||
@ -77,28 +78,22 @@ public class AffinityGroupServiceImpl extends ManagerBase implements AffinityGro
|
|||||||
|
|
||||||
|
|
||||||
//validate the affinityGroupType
|
//validate the affinityGroupType
|
||||||
String internalAffinityType = null;
|
|
||||||
Map<String, AffinityGroupProcessor> typeProcessorMap = getAffinityTypeToProcessorMap();
|
Map<String, AffinityGroupProcessor> typeProcessorMap = getAffinityTypeToProcessorMap();
|
||||||
if (typeProcessorMap != null && !typeProcessorMap.isEmpty()) {
|
if (typeProcessorMap != null && !typeProcessorMap.isEmpty()) {
|
||||||
if (!typeProcessorMap.containsKey(affinityGroupType)) {
|
if (!typeProcessorMap.containsKey(affinityGroupType)) {
|
||||||
throw new InvalidParameterValueException("Unable to create affinity group, invalid affinity group type"
|
throw new InvalidParameterValueException("Unable to create affinity group, invalid affinity group type"
|
||||||
+ affinityGroupType);
|
+ affinityGroupType);
|
||||||
} else {
|
|
||||||
AffinityGroupProcessor processor = typeProcessorMap.get(affinityGroupType);
|
|
||||||
internalAffinityType = processor.getType();
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new InvalidParameterValueException(
|
throw new InvalidParameterValueException(
|
||||||
"Unable to create affinity group, no Affinity Group Types configured");
|
"Unable to create affinity group, no Affinity Group Types configured");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (internalAffinityType == null) {
|
if (domainId == null) {
|
||||||
throw new InvalidParameterValueException(
|
domainId = owner.getDomainId();
|
||||||
"Unable to create affinity group, Affinity Group Processor for type " + affinityGroupType
|
|
||||||
+ "is wrongly configured");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AffinityGroupVO group = new AffinityGroupVO(affinityGroupName, internalAffinityType, description, domainId,
|
AffinityGroupVO group = new AffinityGroupVO(affinityGroupName, affinityGroupType, description, domainId,
|
||||||
owner.getId());
|
owner.getId());
|
||||||
_affinityGroupDao.persist(group);
|
_affinityGroupDao.persist(group);
|
||||||
|
|
||||||
@ -174,8 +169,6 @@ public class AffinityGroupServiceImpl extends ManagerBase implements AffinityGro
|
|||||||
vmInstanceSearch.and("instanceId", vmInstanceSearch.entity().getInstanceId(), SearchCriteria.Op.EQ);
|
vmInstanceSearch.and("instanceId", vmInstanceSearch.entity().getInstanceId(), SearchCriteria.Op.EQ);
|
||||||
|
|
||||||
SearchBuilder<AffinityGroupVO> groupSearch = _affinityGroupDao.createSearchBuilder();
|
SearchBuilder<AffinityGroupVO> groupSearch = _affinityGroupDao.createSearchBuilder();
|
||||||
groupSearch.join("vmInstanceSearch", vmInstanceSearch, groupSearch.entity().getId(), vmInstanceSearch.entity()
|
|
||||||
.getAffinityGroupId(), JoinBuilder.JoinType.INNER);
|
|
||||||
|
|
||||||
SearchCriteria<AffinityGroupVO> sc = groupSearch.create();
|
SearchCriteria<AffinityGroupVO> sc = groupSearch.create();
|
||||||
|
|
||||||
@ -207,6 +200,8 @@ public class AffinityGroupServiceImpl extends ManagerBase implements AffinityGro
|
|||||||
}
|
}
|
||||||
_accountMgr.checkAccess(caller, null, true, userVM);
|
_accountMgr.checkAccess(caller, null, true, userVM);
|
||||||
// add join to affinity_groups_vm_map
|
// add join to affinity_groups_vm_map
|
||||||
|
groupSearch.join("vmInstanceSearch", vmInstanceSearch, groupSearch.entity().getId(), vmInstanceSearch
|
||||||
|
.entity().getAffinityGroupId(), JoinBuilder.JoinType.INNER);
|
||||||
sc.setJoinParameters("vmInstanceSearch", "instanceId", vmId);
|
sc.setJoinParameters("vmInstanceSearch", "instanceId", vmId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,11 +217,7 @@ public class AffinityGroupServiceImpl extends ManagerBase implements AffinityGro
|
|||||||
|
|
||||||
if (componentMap.size() > 0) {
|
if (componentMap.size() > 0) {
|
||||||
for (Entry<String, AffinityGroupProcessor> entry : componentMap.entrySet()) {
|
for (Entry<String, AffinityGroupProcessor> entry : componentMap.entrySet()) {
|
||||||
Map<String, Object> params = entry.getValue().getConfigParams();
|
types.add(entry.getValue().getType());
|
||||||
if (params.containsKey("type")) {
|
|
||||||
types.add((String) params.get("type"));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -235,17 +226,13 @@ public class AffinityGroupServiceImpl extends ManagerBase implements AffinityGro
|
|||||||
|
|
||||||
protected Map<String, AffinityGroupProcessor> getAffinityTypeToProcessorMap() {
|
protected Map<String, AffinityGroupProcessor> getAffinityTypeToProcessorMap() {
|
||||||
Map<String, AffinityGroupProcessor> typeProcessorMap = new HashMap<String, AffinityGroupProcessor>();
|
Map<String, AffinityGroupProcessor> typeProcessorMap = new HashMap<String, AffinityGroupProcessor>();
|
||||||
Map<String, AffinityGroupProcessor> componentMap = ComponentContext.getComponentsOfType(AffinityGroupProcessor.class);
|
Map<String, AffinityGroupProcessor> componentMap = ComponentContext
|
||||||
|
.getComponentsOfType(AffinityGroupProcessor.class);
|
||||||
|
|
||||||
if (componentMap.size() > 0) {
|
if (componentMap.size() > 0) {
|
||||||
for (Entry<String, AffinityGroupProcessor> entry : componentMap.entrySet()) {
|
for (Entry<String, AffinityGroupProcessor> entry : componentMap.entrySet()) {
|
||||||
Map<String, Object> params = entry.getValue().getConfigParams();
|
typeProcessorMap.put(entry.getValue().getType(), entry.getValue());
|
||||||
if (params.containsKey("type")) {
|
|
||||||
typeProcessorMap.put((String) params.get("type"), entry.getValue());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return typeProcessorMap;
|
return typeProcessorMap;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,7 +30,6 @@ import org.apache.cloudstack.api.InternalIdentity;
|
|||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Table(name = ("affinity_group_vm_map"))
|
@Table(name = ("affinity_group_vm_map"))
|
||||||
@SecondaryTables({ @SecondaryTable(name = "affinity_group", pkJoinColumns = { @PrimaryKeyJoinColumn(name = "affinity_group_id", referencedColumnName = "id") }) })
|
|
||||||
public class AffinityGroupVMMapVO implements InternalIdentity {
|
public class AffinityGroupVMMapVO implements InternalIdentity {
|
||||||
@Id
|
@Id
|
||||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||||
@ -43,9 +42,6 @@ public class AffinityGroupVMMapVO implements InternalIdentity {
|
|||||||
@Column(name = "instance_id")
|
@Column(name = "instance_id")
|
||||||
private long instanceId;
|
private long instanceId;
|
||||||
|
|
||||||
@Column(name = "name", table = "affinity_group", insertable = false, updatable = false)
|
|
||||||
private String groupName;
|
|
||||||
|
|
||||||
public AffinityGroupVMMapVO() {
|
public AffinityGroupVMMapVO() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,8 +63,4 @@ public class AffinityGroupVMMapVO implements InternalIdentity {
|
|||||||
return instanceId;
|
return instanceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getGroupName() {
|
|
||||||
return groupName;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -76,12 +76,12 @@ public class AffinityGroupVMMapDaoImpl extends GenericDaoBase<AffinityGroupVMMap
|
|||||||
ListByVmIdGroupId.and("affinityGroupId", ListByVmIdGroupId.entity().getAffinityGroupId(), SearchCriteria.Op.EQ);
|
ListByVmIdGroupId.and("affinityGroupId", ListByVmIdGroupId.entity().getAffinityGroupId(), SearchCriteria.Op.EQ);
|
||||||
ListByVmIdGroupId.done();
|
ListByVmIdGroupId.done();
|
||||||
|
|
||||||
ListByVmIdType = createSearchBuilder();
|
|
||||||
ListByVmIdType.and("instanceId", ListByVmIdType.entity().getInstanceId(), SearchCriteria.Op.EQ);
|
|
||||||
SearchBuilder<AffinityGroupVO> groupSearch = _affinityGroupDao.createSearchBuilder();
|
SearchBuilder<AffinityGroupVO> groupSearch = _affinityGroupDao.createSearchBuilder();
|
||||||
groupSearch.and("type", groupSearch.entity().getType(), SearchCriteria.Op.EQ);
|
groupSearch.and("type", groupSearch.entity().getType(), SearchCriteria.Op.EQ);
|
||||||
ListByVmIdType.join("groupSearch", groupSearch, ListByVmIdType.entity().getAffinityGroupId(), groupSearch
|
|
||||||
.entity().getId(), JoinType.INNER);
|
ListByVmIdType = createSearchBuilder();
|
||||||
|
ListByVmIdType.and("instanceId", ListByVmIdType.entity().getInstanceId(), SearchCriteria.Op.EQ);
|
||||||
|
ListByVmIdType.join("groupSearch", groupSearch, ListByVmIdType.entity().getAffinityGroupId(), groupSearch.entity().getId(), JoinType.INNER);
|
||||||
ListByVmIdType.done();
|
ListByVmIdType.done();
|
||||||
|
|
||||||
CountSGForVm = createSearchBuilder(Long.class);
|
CountSGForVm = createSearchBuilder(Long.class);
|
||||||
@ -145,7 +145,7 @@ public class AffinityGroupVMMapDaoImpl extends GenericDaoBase<AffinityGroupVMMap
|
|||||||
SearchCriteria<AffinityGroupVMMapVO> sc = ListByVmIdType.create();
|
SearchCriteria<AffinityGroupVMMapVO> sc = ListByVmIdType.create();
|
||||||
sc.setParameters("instanceId", instanceId);
|
sc.setParameters("instanceId", instanceId);
|
||||||
sc.setJoinParameters("groupSearch", "type", type);
|
sc.setJoinParameters("groupSearch", "type", type);
|
||||||
return customSearch(sc, null).get(0);
|
return findOneBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user