Merge remote-tracking branch 'apache/4.19'

This commit is contained in:
Wei Zhou 2024-02-17 12:30:40 +01:00
commit 6af1c25f52
23 changed files with 170 additions and 149 deletions

View File

@ -449,10 +449,11 @@ public interface ManagementService {
* this method removes the child storage pools and adds the corresponding parent datastore cluster for API response listing * this method removes the child storage pools and adds the corresponding parent datastore cluster for API response listing
* *
* @param Long volumeId * @param Long volumeId
* @param String keyword if passed, will only return storage pools that contain this keyword in the name
* @return Pair<List<? extends StoragePool>, List<? extends StoragePool>> List of storage pools in cluster and list * @return Pair<List<? extends StoragePool>, List<? extends StoragePool>> List of storage pools in cluster and list
* of pools with enough capacity. * of pools with enough capacity.
*/ */
Pair<List<? extends StoragePool>, List<? extends StoragePool>> listStoragePoolsForMigrationOfVolume(Long volumeId); Pair<List<? extends StoragePool>, List<? extends StoragePool>> listStoragePoolsForMigrationOfVolume(Long volumeId, String keyword);
Pair<List<? extends StoragePool>, List<? extends StoragePool>> listStoragePoolsForSystemMigrationOfVolume(Long volumeId, Long newDiskOfferingId, Long newSize, Long newMinIops, Long newMaxIops, boolean keepSourceStoragePool, boolean bypassStorageTypeCheck); Pair<List<? extends StoragePool>, List<? extends StoragePool>> listStoragePoolsForSystemMigrationOfVolume(Long volumeId, Long newDiskOfferingId, Long newSize, Long newMinIops, Long newMaxIops, boolean keepSourceStoragePool, boolean bypassStorageTypeCheck);

View File

@ -442,6 +442,6 @@ public class NicProfile implements InternalIdentity, Serializable {
@Override @Override
public String toString() { public String toString() {
return String.format("NicProfile %s", ReflectionToStringBuilderUtils.reflectOnlySelectedFields(this, "id", "vmId", "reservationId", "iPv4Address", "broadcastUri")); return String.format("NicProfile %s", ReflectionToStringBuilderUtils.reflectOnlySelectedFields(this, "id", "vmId", "deviceId", "broadcastUri", "reservationId", "iPv4Address"));
} }
} }

View File

@ -65,7 +65,7 @@ public class FindStoragePoolsForMigrationCmd extends BaseListCmd {
@Override @Override
public void execute() { public void execute() {
Pair<List<? extends StoragePool>, List<? extends StoragePool>> pools = _mgr.listStoragePoolsForMigrationOfVolume(getId()); Pair<List<? extends StoragePool>, List<? extends StoragePool>> pools = _mgr.listStoragePoolsForMigrationOfVolume(getId(), getKeyword());
ListResponse<StoragePoolResponse> response = new ListResponse<StoragePoolResponse>(); ListResponse<StoragePoolResponse> response = new ListResponse<StoragePoolResponse>();
List<StoragePoolResponse> poolResponses = new ArrayList<StoragePoolResponse>(); List<StoragePoolResponse> poolResponses = new ArrayList<StoragePoolResponse>();
@ -85,7 +85,8 @@ public class FindStoragePoolsForMigrationCmd extends BaseListCmd {
poolResponses.add(poolResponse); poolResponses.add(poolResponse);
} }
sortPoolsBySuitabilityAndName(poolResponses); sortPoolsBySuitabilityAndName(poolResponses);
response.setResponses(poolResponses); List<StoragePoolResponse> pagingList = com.cloud.utils.StringUtils.applyPagination(poolResponses, this.getStartIndex(), this.getPageSizeVal());
response.setResponses(pagingList, poolResponses.size());
response.setResponseName(getCommandName()); response.setResponseName(getCommandName());
this.setResponseObject(response); this.setResponseObject(response);
} }

View File

@ -54,6 +54,8 @@ public class GsonHelper {
GsonBuilder LOGGERBuilder = new GsonBuilder(); GsonBuilder LOGGERBuilder = new GsonBuilder();
LOGGERBuilder.disableHtmlEscaping(); LOGGERBuilder.disableHtmlEscaping();
LOGGERBuilder.setExclusionStrategies(new LoggingExclusionStrategy(LOGGER)); LOGGERBuilder.setExclusionStrategies(new LoggingExclusionStrategy(LOGGER));
LOGGERBuilder.serializeSpecialFloatingPointValues();
// maybe add LOGGERBuilder.serializeNulls(); as well?
s_gogger = setDefaultGsonConfig(LOGGERBuilder); s_gogger = setDefaultGsonConfig(LOGGERBuilder);
LOGGER.info("Default Builder inited."); LOGGER.info("Default Builder inited.");
} }

View File

@ -52,9 +52,12 @@ public interface StoragePoolAllocator extends Adapter {
* avoid * avoid
* @param int returnUpTo (use -1 to return all possible pools) * @param int returnUpTo (use -1 to return all possible pools)
* @param boolean bypassStorageTypeCheck allows bypassing useLocalStorage check for provided DiskProfile when true * @param boolean bypassStorageTypeCheck allows bypassing useLocalStorage check for provided DiskProfile when true
* @param String keyword if passed, will only return storage pools that contain this keyword in the name
* @return List<StoragePool> List of storage pools that are suitable for the * @return List<StoragePool> List of storage pools that are suitable for the
* VM * VM
**/ **/
List<StoragePool> allocateToPool(DiskProfile dskCh, VirtualMachineProfile vmProfile, DeploymentPlan plan, ExcludeList avoid, int returnUpTo, boolean bypassStorageTypeCheck, String keyword);
List<StoragePool> allocateToPool(DiskProfile dskCh, VirtualMachineProfile vmProfile, DeploymentPlan plan, ExcludeList avoid, int returnUpTo, boolean bypassStorageTypeCheck); List<StoragePool> allocateToPool(DiskProfile dskCh, VirtualMachineProfile vmProfile, DeploymentPlan plan, ExcludeList avoid, int returnUpTo, boolean bypassStorageTypeCheck);

View File

@ -2308,12 +2308,12 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
@DB @DB
protected void releaseNic(final VirtualMachineProfile vmProfile, final long nicId) throws ConcurrentOperationException, ResourceUnavailableException { protected void releaseNic(final VirtualMachineProfile vmProfile, final long nicId) throws ConcurrentOperationException, ResourceUnavailableException {
final Pair<Network, NicProfile> networkToRelease = Transaction.execute(new TransactionCallback<Pair<Network, NicProfile>>() { final Pair<Network, NicProfile> networkToRelease = Transaction.execute(new TransactionCallback<>() {
@Override @Override
public Pair<Network, NicProfile> doInTransaction(final TransactionStatus status) { public Pair<Network, NicProfile> doInTransaction(final TransactionStatus status) {
final NicVO nic = _nicDao.lockRow(nicId, true); final NicVO nic = _nicDao.lockRow(nicId, true);
if (nic == null) { if (nic == null) {
throw new ConcurrentOperationException("Unable to acquire lock on nic " + nic); throw new ConcurrentOperationException(String.format("Unable to acquire lock on nic id=%d", nicId));
} }
final Nic.State originalState = nic.getState(); final Nic.State originalState = nic.getState();
@ -2327,6 +2327,9 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
final NicProfile profile = new NicProfile(nic, network, nic.getBroadcastUri(), nic.getIsolationUri(), null, _networkModel final NicProfile profile = new NicProfile(nic, network, nic.getBroadcastUri(), nic.getIsolationUri(), null, _networkModel
.isSecurityGroupSupportedInNetwork(network), _networkModel.getNetworkTag(vmProfile.getHypervisorType(), network)); .isSecurityGroupSupportedInNetwork(network), _networkModel.getNetworkTag(vmProfile.getHypervisorType(), network));
if (guru.release(profile, vmProfile, nic.getReservationId())) { if (guru.release(profile, vmProfile, nic.getReservationId())) {
if (logger.isDebugEnabled()) {
logger.debug(String.format("The nic %s on %s was released according to %s by guru %s, now updating record.", nic, profile, vmProfile, guru));
}
applyProfileToNicForRelease(nic, profile); applyProfileToNicForRelease(nic, profile);
nic.setState(Nic.State.Allocated); nic.setState(Nic.State.Allocated);
if (originalState == Nic.State.Reserved) { if (originalState == Nic.State.Reserved) {
@ -2336,7 +2339,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
} }
} }
// Perform release on network elements // Perform release on network elements
return new Pair<Network, NicProfile>(network, profile); return new Pair<>(network, profile);
} else { } else {
nic.setState(Nic.State.Allocated); nic.setState(Nic.State.Allocated);
updateNic(nic, network.getId(), -1); updateNic(nic, network.getId(), -1);
@ -2433,7 +2436,7 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
for (final NetworkElement element : networkElements) { for (final NetworkElement element : networkElements) {
if (providersToImplement.contains(element.getProvider())) { if (providersToImplement.contains(element.getProvider())) {
if (logger.isDebugEnabled()) { if (logger.isDebugEnabled()) {
logger.debug("Asking " + element.getName() + " to release " + nic); logger.debug(String.format("Asking %s to release %s, according to the reservation strategy %s", element.getName(), nic, nic.getReservationStrategy()));
} }
try { try {
element.release(network, profile, vm, null); element.release(network, profile, vm, null);

View File

@ -30,6 +30,7 @@ import javax.persistence.Id;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Transient; import javax.persistence.Transient;
import org.apache.cloudstack.utils.reflectiontostringbuilderutils.ReflectionToStringBuilderUtils;
import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder;
@ -329,17 +330,7 @@ public class NicVO implements Nic {
@Override @Override
public String toString() { public String toString() {
return new StringBuilder("Nic[").append(id) return String.format("Nic %s", ReflectionToStringBuilderUtils.reflectOnlySelectedFields(this, "id", "instanceId", "deviceId", "broadcastUri", "reservationId", "iPv4Address"));
.append("-")
.append(instanceId)
.append("-")
.append(deviceId)
.append("-")
.append(reservationId)
.append("-")
.append(iPv4Address)
.append("]")
.toString();
} }
@Override @Override

View File

@ -40,6 +40,8 @@ public interface PrimaryDataStoreDao extends GenericDao<StoragePoolVO, Long> {
*/ */
List<StoragePoolVO> listBy(long datacenterId, Long podId, Long clusterId, ScopeType scope); List<StoragePoolVO> listBy(long datacenterId, Long podId, Long clusterId, ScopeType scope);
List<StoragePoolVO> listBy(long datacenterId, Long podId, Long clusterId, ScopeType scope, String keyword);
/** /**
* Set capacity of storage pool in bytes * Set capacity of storage pool in bytes
* @param id pool id. * @param id pool id.
@ -115,15 +117,19 @@ public interface PrimaryDataStoreDao extends GenericDao<StoragePoolVO, Long> {
List<StoragePoolVO> findLocalStoragePoolsByTags(long dcId, long podId, Long clusterId, String[] tags, boolean validateTagRule); List<StoragePoolVO> findLocalStoragePoolsByTags(long dcId, long podId, Long clusterId, String[] tags, boolean validateTagRule);
List<StoragePoolVO> findLocalStoragePoolsByTags(long dcId, long podId, Long clusterId, String[] tags, boolean validateTagRule, String keyword);
List<StoragePoolVO> findZoneWideStoragePoolsByTags(long dcId, String[] tags, boolean validateTagRule); List<StoragePoolVO> findZoneWideStoragePoolsByTags(long dcId, String[] tags, boolean validateTagRule);
List<StoragePoolVO> findZoneWideStoragePoolsByHypervisor(long dataCenterId, HypervisorType hypervisorType); List<StoragePoolVO> findZoneWideStoragePoolsByHypervisor(long dataCenterId, HypervisorType hypervisorType);
List<StoragePoolVO> findZoneWideStoragePoolsByHypervisor(long dataCenterId, HypervisorType hypervisorType, String keyword);
List<StoragePoolVO> findLocalStoragePoolsByHostAndTags(long hostId, String[] tags); List<StoragePoolVO> findLocalStoragePoolsByHostAndTags(long hostId, String[] tags);
List<StoragePoolVO> listLocalStoragePoolByPath(long datacenterId, String path); List<StoragePoolVO> listLocalStoragePoolByPath(long datacenterId, String path);
List<StoragePoolVO> findPoolsInClusters(List<Long> clusterIds); List<StoragePoolVO> findPoolsInClusters(List<Long> clusterIds, String keyword);
void deletePoolTags(long poolId); void deletePoolTags(long poolId);

View File

@ -244,6 +244,11 @@ public class PrimaryDataStoreDaoImpl extends GenericDaoBase<StoragePoolVO, Long>
@Override @Override
public List<StoragePoolVO> listBy(long datacenterId, Long podId, Long clusterId, ScopeType scope) { public List<StoragePoolVO> listBy(long datacenterId, Long podId, Long clusterId, ScopeType scope) {
return listBy(datacenterId, podId, clusterId, scope, null);
}
@Override
public List<StoragePoolVO> listBy(long datacenterId, Long podId, Long clusterId, ScopeType scope, String keyword) {
SearchCriteria<StoragePoolVO> sc = null; SearchCriteria<StoragePoolVO> sc = null;
if (clusterId != null) { if (clusterId != null) {
sc = DcPodSearch.create(); sc = DcPodSearch.create();
@ -255,6 +260,9 @@ public class PrimaryDataStoreDaoImpl extends GenericDaoBase<StoragePoolVO, Long>
sc.setParameters("datacenterId", datacenterId); sc.setParameters("datacenterId", datacenterId);
sc.setParameters("podId", podId); sc.setParameters("podId", podId);
sc.setParameters("status", Status.Up); sc.setParameters("status", Status.Up);
if (keyword != null) {
sc.addAnd("name", Op.LIKE, "%" + keyword + "%");
}
if (scope != null) { if (scope != null) {
sc.setParameters("scope", scope); sc.setParameters("scope", scope);
} }
@ -444,9 +452,14 @@ public class PrimaryDataStoreDaoImpl extends GenericDaoBase<StoragePoolVO, Long>
@Override @Override
public List<StoragePoolVO> findLocalStoragePoolsByTags(long dcId, long podId, Long clusterId, String[] tags, boolean validateTagRule) { public List<StoragePoolVO> findLocalStoragePoolsByTags(long dcId, long podId, Long clusterId, String[] tags, boolean validateTagRule) {
return findLocalStoragePoolsByTags(dcId, podId, clusterId, tags, validateTagRule, null);
}
@Override
public List<StoragePoolVO> findLocalStoragePoolsByTags(long dcId, long podId, Long clusterId, String[] tags, boolean validateTagRule, String keyword) {
List<StoragePoolVO> storagePools = null; List<StoragePoolVO> storagePools = null;
if (tags == null || tags.length == 0) { if (tags == null || tags.length == 0) {
storagePools = listBy(dcId, podId, clusterId, ScopeType.HOST); storagePools = listBy(dcId, podId, clusterId, ScopeType.HOST, keyword);
if (validateTagRule) { if (validateTagRule) {
storagePools = getPoolsWithoutTagRule(storagePools); storagePools = getPoolsWithoutTagRule(storagePools);
@ -583,11 +596,19 @@ public class PrimaryDataStoreDaoImpl extends GenericDaoBase<StoragePoolVO, Long>
@Override @Override
public List<StoragePoolVO> findZoneWideStoragePoolsByHypervisor(long dataCenterId, HypervisorType hypervisorType) { public List<StoragePoolVO> findZoneWideStoragePoolsByHypervisor(long dataCenterId, HypervisorType hypervisorType) {
return findZoneWideStoragePoolsByHypervisor(dataCenterId, hypervisorType, null);
}
@Override
public List<StoragePoolVO> findZoneWideStoragePoolsByHypervisor(long dataCenterId, HypervisorType hypervisorType, String keyword) {
QueryBuilder<StoragePoolVO> sc = QueryBuilder.create(StoragePoolVO.class); QueryBuilder<StoragePoolVO> sc = QueryBuilder.create(StoragePoolVO.class);
sc.and(sc.entity().getDataCenterId(), Op.EQ, dataCenterId); sc.and(sc.entity().getDataCenterId(), Op.EQ, dataCenterId);
sc.and(sc.entity().getStatus(), Op.EQ, Status.Up); sc.and(sc.entity().getStatus(), Op.EQ, Status.Up);
sc.and(sc.entity().getScope(), Op.EQ, ScopeType.ZONE); sc.and(sc.entity().getScope(), Op.EQ, ScopeType.ZONE);
sc.and(sc.entity().getHypervisor(), Op.EQ, hypervisorType); sc.and(sc.entity().getHypervisor(), Op.EQ, hypervisorType);
if (keyword != null) {
sc.and(sc.entity().getName(), Op.LIKE, "%" + keyword + "%");
}
return sc.list(); return sc.list();
} }
@ -612,10 +633,13 @@ public class PrimaryDataStoreDaoImpl extends GenericDaoBase<StoragePoolVO, Long>
} }
@Override @Override
public List<StoragePoolVO> findPoolsInClusters(List<Long> clusterIds) { public List<StoragePoolVO> findPoolsInClusters(List<Long> clusterIds, String keyword) {
SearchCriteria<StoragePoolVO> sc = ClustersSearch.create(); SearchCriteria<StoragePoolVO> sc = ClustersSearch.create();
sc.setParameters("clusterIds", clusterIds.toArray()); sc.setParameters("clusterIds", clusterIds.toArray());
sc.setParameters("status", StoragePoolStatus.Up); sc.setParameters("status", StoragePoolStatus.Up);
if (keyword != null) {
sc.addAnd("name", Op.LIKE, "%" + keyword + "%");
}
return listBy(sc); return listBy(sc);
} }

View File

@ -104,16 +104,20 @@ public abstract class AbstractStoragePoolAllocator extends AdapterBase implement
return false; return false;
} }
protected abstract List<StoragePool> select(DiskProfile dskCh, VirtualMachineProfile vmProfile, DeploymentPlan plan, ExcludeList avoid, int returnUpTo, boolean bypassStorageTypeCheck); protected abstract List<StoragePool> select(DiskProfile dskCh, VirtualMachineProfile vmProfile, DeploymentPlan plan, ExcludeList avoid, int returnUpTo, boolean bypassStorageTypeCheck, String keyword);
@Override @Override
public List<StoragePool> allocateToPool(DiskProfile dskCh, VirtualMachineProfile vmProfile, DeploymentPlan plan, ExcludeList avoid, int returnUpTo) { public List<StoragePool> allocateToPool(DiskProfile dskCh, VirtualMachineProfile vmProfile, DeploymentPlan plan, ExcludeList avoid, int returnUpTo) {
return allocateToPool(dskCh, vmProfile, plan, avoid, returnUpTo, false); return allocateToPool(dskCh, vmProfile, plan, avoid, returnUpTo, false, null);
} }
@Override @Override
public List<StoragePool> allocateToPool(DiskProfile dskCh, VirtualMachineProfile vmProfile, DeploymentPlan plan, ExcludeList avoid, int returnUpTo, boolean bypassStorageTypeCheck) { public List<StoragePool> allocateToPool(DiskProfile dskCh, VirtualMachineProfile vmProfile, DeploymentPlan plan, ExcludeList avoid, int returnUpTo, boolean bypassStorageTypeCheck) {
List<StoragePool> pools = select(dskCh, vmProfile, plan, avoid, returnUpTo, bypassStorageTypeCheck); return allocateToPool(dskCh, vmProfile, plan, avoid, returnUpTo, bypassStorageTypeCheck, null);
}
public List<StoragePool> allocateToPool(DiskProfile dskCh, VirtualMachineProfile vmProfile, DeploymentPlan plan, ExcludeList avoid, int returnUpTo, boolean bypassStorageTypeCheck, String keyword) {
List<StoragePool> pools = select(dskCh, vmProfile, plan, avoid, returnUpTo, bypassStorageTypeCheck, keyword);
return reorderPools(pools, vmProfile, plan, dskCh); return reorderPools(pools, vmProfile, plan, dskCh);
} }

View File

@ -44,7 +44,7 @@ public class ClusterScopeStoragePoolAllocator extends AbstractStoragePoolAllocat
DiskOfferingDao _diskOfferingDao; DiskOfferingDao _diskOfferingDao;
@Override @Override
protected List<StoragePool> select(DiskProfile dskCh, VirtualMachineProfile vmProfile, DeploymentPlan plan, ExcludeList avoid, int returnUpTo, boolean bypassStorageTypeCheck) { protected List<StoragePool> select(DiskProfile dskCh, VirtualMachineProfile vmProfile, DeploymentPlan plan, ExcludeList avoid, int returnUpTo, boolean bypassStorageTypeCheck, String keyword) {
logStartOfSearch(dskCh, vmProfile, plan, returnUpTo, bypassStorageTypeCheck); logStartOfSearch(dskCh, vmProfile, plan, returnUpTo, bypassStorageTypeCheck);
if (!bypassStorageTypeCheck && dskCh.useLocalStorage()) { if (!bypassStorageTypeCheck && dskCh.useLocalStorage()) {

View File

@ -45,7 +45,7 @@ public class GarbageCollectingStoragePoolAllocator extends AbstractStoragePoolAl
boolean _storagePoolCleanupEnabled; boolean _storagePoolCleanupEnabled;
@Override @Override
public List<StoragePool> select(DiskProfile dskCh, VirtualMachineProfile vmProfile, DeploymentPlan plan, ExcludeList avoid, int returnUpTo, boolean bypassStorageTypeCheck) { public List<StoragePool> select(DiskProfile dskCh, VirtualMachineProfile vmProfile, DeploymentPlan plan, ExcludeList avoid, int returnUpTo, boolean bypassStorageTypeCheck, String keyword) {
logStartOfSearch(dskCh, vmProfile, plan, returnUpTo, bypassStorageTypeCheck); logStartOfSearch(dskCh, vmProfile, plan, returnUpTo, bypassStorageTypeCheck);
if (!_storagePoolCleanupEnabled) { if (!_storagePoolCleanupEnabled) {
logger.debug("Storage pool cleanup is not enabled, so GarbageCollectingStoragePoolAllocator is being skipped."); logger.debug("Storage pool cleanup is not enabled, so GarbageCollectingStoragePoolAllocator is being skipped.");

View File

@ -58,7 +58,7 @@ public class LocalStoragePoolAllocator extends AbstractStoragePoolAllocator {
ConfigurationDao _configDao; ConfigurationDao _configDao;
@Override @Override
protected List<StoragePool> select(DiskProfile dskCh, VirtualMachineProfile vmProfile, DeploymentPlan plan, ExcludeList avoid, int returnUpTo, boolean bypassStorageTypeCheck) { protected List<StoragePool> select(DiskProfile dskCh, VirtualMachineProfile vmProfile, DeploymentPlan plan, ExcludeList avoid, int returnUpTo, boolean bypassStorageTypeCheck, String keyword) {
logStartOfSearch(dskCh, vmProfile, plan, returnUpTo, bypassStorageTypeCheck); logStartOfSearch(dskCh, vmProfile, plan, returnUpTo, bypassStorageTypeCheck);
if (!bypassStorageTypeCheck && !dskCh.useLocalStorage()) { if (!bypassStorageTypeCheck && !dskCh.useLocalStorage()) {
@ -99,7 +99,7 @@ public class LocalStoragePoolAllocator extends AbstractStoragePoolAllocator {
return null; return null;
} }
List<StoragePoolVO> availablePools = List<StoragePoolVO> availablePools =
storagePoolDao.findLocalStoragePoolsByTags(plan.getDataCenterId(), plan.getPodId(), plan.getClusterId(), dskCh.getTags(), true); storagePoolDao.findLocalStoragePoolsByTags(plan.getDataCenterId(), plan.getPodId(), plan.getClusterId(), dskCh.getTags(), true, keyword);
availablePools.addAll(storagePoolJoinDao.findStoragePoolByScopeAndRuleTags(plan.getDataCenterId(), plan.getPodId(), plan.getClusterId(), ScopeType.HOST, List.of(dskCh.getTags()))); availablePools.addAll(storagePoolJoinDao.findStoragePoolByScopeAndRuleTags(plan.getDataCenterId(), plan.getPodId(), plan.getClusterId(), ScopeType.HOST, List.of(dskCh.getTags())));
for (StoragePoolVO pool : availablePools) { for (StoragePoolVO pool : availablePools) {
if (suitablePools.size() == returnUpTo) { if (suitablePools.size() == returnUpTo) {

View File

@ -48,7 +48,7 @@ public class ZoneWideStoragePoolAllocator extends AbstractStoragePoolAllocator {
private CapacityDao capacityDao; private CapacityDao capacityDao;
@Override @Override
protected List<StoragePool> select(DiskProfile dskCh, VirtualMachineProfile vmProfile, DeploymentPlan plan, ExcludeList avoid, int returnUpTo, boolean bypassStorageTypeCheck) { protected List<StoragePool> select(DiskProfile dskCh, VirtualMachineProfile vmProfile, DeploymentPlan plan, ExcludeList avoid, int returnUpTo, boolean bypassStorageTypeCheck, String keyword) {
logStartOfSearch(dskCh, vmProfile, plan, returnUpTo, bypassStorageTypeCheck); logStartOfSearch(dskCh, vmProfile, plan, returnUpTo, bypassStorageTypeCheck);
if (!bypassStorageTypeCheck && dskCh.useLocalStorage()) { if (!bypassStorageTypeCheck && dskCh.useLocalStorage()) {

View File

@ -137,7 +137,7 @@ public class AbstractStoragePoolAllocatorTest {
class MockStorapoolAllocater extends AbstractStoragePoolAllocator { class MockStorapoolAllocater extends AbstractStoragePoolAllocator {
@Override @Override
protected List<StoragePool> select(DiskProfile dskCh, VirtualMachineProfile vmProfile, DeploymentPlan plan, DeploymentPlanner.ExcludeList avoid, int returnUpTo, boolean bypassStorageTypeCheck) { protected List<StoragePool> select(DiskProfile dskCh, VirtualMachineProfile vmProfile, DeploymentPlan plan, DeploymentPlanner.ExcludeList avoid, int returnUpTo, boolean bypassStorageTypeCheck, String keyword) {
return null; return null;
} }
} }

View File

@ -33,7 +33,7 @@ import com.cloud.vm.VirtualMachineProfile;
public class RandomStoragePoolAllocator extends AbstractStoragePoolAllocator { public class RandomStoragePoolAllocator extends AbstractStoragePoolAllocator {
@Override @Override
public List<StoragePool> select(DiskProfile dskCh, VirtualMachineProfile vmProfile, DeploymentPlan plan, ExcludeList avoid, int returnUpTo, boolean bypassStorageTypeCheck) { public List<StoragePool> select(DiskProfile dskCh, VirtualMachineProfile vmProfile, DeploymentPlan plan, ExcludeList avoid, int returnUpTo, boolean bypassStorageTypeCheck, String keyword) {
logStartOfSearch(dskCh, vmProfile, plan, returnUpTo, bypassStorageTypeCheck); logStartOfSearch(dskCh, vmProfile, plan, returnUpTo, bypassStorageTypeCheck);
List<StoragePool> suitablePools = new ArrayList<StoragePool>(); List<StoragePool> suitablePools = new ArrayList<StoragePool>();

View File

@ -21,6 +21,7 @@ import java.util.Map;
import javax.inject.Inject; import javax.inject.Inject;
import javax.naming.ConfigurationException; import javax.naming.ConfigurationException;
import com.cloud.network.router.VirtualNetworkApplianceManager;
import org.apache.cloudstack.framework.config.dao.ConfigurationDao; import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
import com.cloud.configuration.Config; import com.cloud.configuration.Config;
@ -164,18 +165,24 @@ public class ControlNetworkGuru extends PodBasedNetworkGuru implements NetworkGu
assert nic.getTrafficType() == TrafficType.Control; assert nic.getTrafficType() == TrafficType.Control;
HypervisorType hType = vm.getHypervisorType(); HypervisorType hType = vm.getHypervisorType();
if ( ( (hType == HypervisorType.VMware) || (hType == HypervisorType.Hyperv) )&& isRouterVm(vm)) { if ( ( (hType == HypervisorType.VMware) || (hType == HypervisorType.Hyperv) )&& isRouterVm(vm)) {
if (!VirtualNetworkApplianceManager.RemoveControlIpOnStop.valueIn(vm.getVirtualMachine().getDataCenterId())) {
if (logger.isDebugEnabled()) {
logger.debug(String.format("not releasing %s from %s with reservationId %s, as systemvm.release.control.ip.on.stop is set to false for the data center.", nic, vm, reservationId));
}
return true;
}
long dcId = vm.getVirtualMachine().getDataCenterId(); long dcId = vm.getVirtualMachine().getDataCenterId();
DataCenterVO dcVo = _dcDao.findById(dcId); DataCenterVO dcVo = _dcDao.findById(dcId);
if (dcVo.getNetworkType() != NetworkType.Basic) { if (dcVo.getNetworkType() != NetworkType.Basic) {
super.release(nic, vm, reservationId); super.release(nic, vm, reservationId);
if (logger.isDebugEnabled()) { if (logger.isDebugEnabled()) {
logger.debug("Released nic: " + nic); logger.debug(String.format("Released nic: %s for vm %s", nic, vm));
} }
return true; return true;
} else { } else {
nic.deallocate(); nic.deallocate();
if (logger.isDebugEnabled()) { if (logger.isDebugEnabled()) {
logger.debug("Released nic: " + nic); logger.debug(String.format("Released nic: %s for vm %s", nic, vm));
} }
return true; return true;
} }
@ -185,7 +192,7 @@ public class ControlNetworkGuru extends PodBasedNetworkGuru implements NetworkGu
nic.deallocate(); nic.deallocate();
if (logger.isDebugEnabled()) { if (logger.isDebugEnabled()) {
logger.debug("Released nic: " + nic); logger.debug(String.format("Released nic: %s for vm %s", nic, vm));
} }
return true; return true;

View File

@ -157,7 +157,7 @@ public class PodBasedNetworkGuru extends AdapterBase implements NetworkGuru {
nic.deallocate(); nic.deallocate();
if (logger.isDebugEnabled()) { if (logger.isDebugEnabled()) {
logger.debug("Released nic: " + nic); logger.debug(String.format("Released nic: %s for vm %s", nic, vm));
} }
return true; return true;

View File

@ -36,82 +36,83 @@ import com.cloud.vm.DomainRouterVO;
*/ */
public interface VirtualNetworkApplianceManager extends Manager, VirtualNetworkApplianceService { public interface VirtualNetworkApplianceManager extends Manager, VirtualNetworkApplianceService {
static final String RouterTemplateXenCK = "router.template.xenserver"; String RouterTemplateXenCK = "router.template.xenserver";
static final String RouterTemplateKvmCK = "router.template.kvm"; String RouterTemplateKvmCK = "router.template.kvm";
static final String RouterTemplateVmwareCK = "router.template.vmware"; String RouterTemplateVmwareCK = "router.template.vmware";
static final String RouterTemplateHyperVCK = "router.template.hyperv"; String RouterTemplateHyperVCK = "router.template.hyperv";
static final String RouterTemplateLxcCK = "router.template.lxc"; String RouterTemplateLxcCK = "router.template.lxc";
static final String RouterTemplateOvm3CK = "router.template.ovm3"; String RouterTemplateOvm3CK = "router.template.ovm3";
static final String SetServiceMonitorCK = "network.router.EnableServiceMonitoring"; String SetServiceMonitorCK = "network.router.EnableServiceMonitoring";
static final String RouterAlertsCheckIntervalCK = "router.alerts.check.interval"; String RouterAlertsCheckIntervalCK = "router.alerts.check.interval";
static final String VirtualRouterServiceOfferingCK = "router.service.offering"; String VirtualRouterServiceOfferingCK = "router.service.offering";
static final String RouterHealthChecksConfigRefreshIntervalCK = "router.health.checks.config.refresh.interval"; String RouterHealthChecksConfigRefreshIntervalCK = "router.health.checks.config.refresh.interval";
static final String RouterHealthChecksResultFetchIntervalCK = "router.health.checks.results.fetch.interval"; String RouterHealthChecksResultFetchIntervalCK = "router.health.checks.results.fetch.interval";
static final String RouterHealthChecksFailuresToRecreateVrCK = "router.health.checks.failures.to.recreate.vr"; String RouterHealthChecksFailuresToRecreateVrCK = "router.health.checks.failures.to.recreate.vr";
String RemoveControlIpOnStopCK = "systemvm.release.control.ip.on.stop";
static final ConfigKey<String> RouterTemplateXen = new ConfigKey<String>(String.class, RouterTemplateXenCK, "Advanced", "SystemVM Template (XenServer)", ConfigKey<String> RouterTemplateXen = new ConfigKey<>(String.class, RouterTemplateXenCK, "Advanced", "SystemVM Template (XenServer)",
"Name of the default router template on Xenserver.", true, ConfigKey.Scope.Zone, null); "Name of the default router template on Xenserver.", true, ConfigKey.Scope.Zone, null);
static final ConfigKey<String> RouterTemplateKvm = new ConfigKey<String>(String.class, RouterTemplateKvmCK, "Advanced", "SystemVM Template (KVM)", ConfigKey<String> RouterTemplateKvm = new ConfigKey<>(String.class, RouterTemplateKvmCK, "Advanced", "SystemVM Template (KVM)",
"Name of the default router template on KVM.", true, ConfigKey.Scope.Zone, null); "Name of the default router template on KVM.", true, ConfigKey.Scope.Zone, null);
static final ConfigKey<String> RouterTemplateVmware = new ConfigKey<String>(String.class, RouterTemplateVmwareCK, "Advanced", "SystemVM Template (vSphere)", ConfigKey<String> RouterTemplateVmware = new ConfigKey<>(String.class, RouterTemplateVmwareCK, "Advanced", "SystemVM Template (vSphere)",
"Name of the default router template on Vmware.", true, ConfigKey.Scope.Zone, null); "Name of the default router template on Vmware.", true, ConfigKey.Scope.Zone, null);
static final ConfigKey<String> RouterTemplateHyperV = new ConfigKey<String>(String.class, RouterTemplateHyperVCK, "Advanced", "SystemVM Template (HyperV)", ConfigKey<String> RouterTemplateHyperV = new ConfigKey<>(String.class, RouterTemplateHyperVCK, "Advanced", "SystemVM Template (HyperV)",
"Name of the default router template on Hyperv.", true, ConfigKey.Scope.Zone, null); "Name of the default router template on Hyperv.", true, ConfigKey.Scope.Zone, null);
static final ConfigKey<String> RouterTemplateLxc = new ConfigKey<String>(String.class, RouterTemplateLxcCK, "Advanced", "SystemVM Template (LXC)", ConfigKey<String> RouterTemplateLxc = new ConfigKey<>(String.class, RouterTemplateLxcCK, "Advanced", "SystemVM Template (LXC)",
"Name of the default router template on LXC.", true, ConfigKey.Scope.Zone, null); "Name of the default router template on LXC.", true, ConfigKey.Scope.Zone, null);
static final ConfigKey<String> RouterTemplateOvm3 = new ConfigKey<String>(String.class, RouterTemplateOvm3CK, "Advanced", "SystemVM Template (Ovm3)", ConfigKey<String> RouterTemplateOvm3 = new ConfigKey<>(String.class, RouterTemplateOvm3CK, "Advanced", "SystemVM Template (Ovm3)",
"Name of the default router template on Ovm3.", true, ConfigKey.Scope.Zone, null); "Name of the default router template on Ovm3.", true, ConfigKey.Scope.Zone, null);
static final ConfigKey<Boolean> SetServiceMonitor = new ConfigKey<Boolean>(Boolean.class, SetServiceMonitorCK, "Advanced", "true", ConfigKey<Boolean> SetServiceMonitor = new ConfigKey<>(Boolean.class, SetServiceMonitorCK, "Advanced", "true",
"service monitoring in router enable/disable option, default true", true, ConfigKey.Scope.Zone, null); "service monitoring in router enable/disable option, default true", true, ConfigKey.Scope.Zone, null);
static final ConfigKey<Integer> RouterAlertsCheckInterval = new ConfigKey<Integer>(Integer.class, RouterAlertsCheckIntervalCK, "Advanced", "1800", ConfigKey<Integer> RouterAlertsCheckInterval = new ConfigKey<>(Integer.class, RouterAlertsCheckIntervalCK, "Advanced", "1800",
"Interval (in seconds) to check for alerts in Virtual Router.", false, ConfigKey.Scope.Global, null); "Interval (in seconds) to check for alerts in Virtual Router.", false, ConfigKey.Scope.Global, null);
static final ConfigKey<Boolean> RouterVersionCheckEnabled = new ConfigKey<Boolean>("Advanced", Boolean.class, "router.version.check", "true", ConfigKey<Boolean> RouterVersionCheckEnabled = new ConfigKey<>("Advanced", Boolean.class, "router.version.check", "true",
"If true, router minimum required version is checked before sending command", false); "If true, router minimum required version is checked before sending command", false);
static final ConfigKey<Boolean> UseExternalDnsServers = new ConfigKey<Boolean>(Boolean.class, "use.external.dns", "Advanced", "false", ConfigKey<Boolean> UseExternalDnsServers = new ConfigKey<>(Boolean.class, "use.external.dns", "Advanced", "false",
"Bypass internal dns, use external dns1 and dns2", true, ConfigKey.Scope.Zone, null); "Bypass internal dns, use external dns1 and dns2", true, ConfigKey.Scope.Zone, null);
static final ConfigKey<Boolean> ExposeDnsAndBootpServer = new ConfigKey<Boolean>(Boolean.class, "expose.dns.externally", "Advanced", "true", ConfigKey<Boolean> ExposeDnsAndBootpServer = new ConfigKey<>(Boolean.class, "expose.dns.externally", "Advanced", "true",
"open dns, dhcp and bootp on the public interface", true, ConfigKey.Scope.Zone, null); "open dns, dhcp and bootp on the public interface", true, ConfigKey.Scope.Zone, null);
static final ConfigKey<String> VirtualRouterServiceOffering = new ConfigKey<String>(String.class, VirtualRouterServiceOfferingCK, "Advanced", "", ConfigKey<String> VirtualRouterServiceOffering = new ConfigKey<>(String.class, VirtualRouterServiceOfferingCK, "Advanced", "",
"Uuid of the service offering used by virtual routers; if NULL - system offering will be used", true, ConfigKey.Scope.Account, null); "Uuid of the service offering used by virtual routers; if NULL - system offering will be used", true, ConfigKey.Scope.Account, null);
// Health checks // Health checks
static final ConfigKey<Boolean> RouterHealthChecksEnabled = new ConfigKey<Boolean>(Boolean.class, "router.health.checks.enabled", "Advanced", "true", ConfigKey<Boolean> RouterHealthChecksEnabled = new ConfigKey<>(Boolean.class, "router.health.checks.enabled", "Advanced", "true",
"If true, router health checks are allowed to be executed and read. If false, all scheduled checks and API calls for on demand checks are disabled.", "If true, router health checks are allowed to be executed and read. If false, all scheduled checks and API calls for on demand checks are disabled.",
true, ConfigKey.Scope.Global, null); true, ConfigKey.Scope.Global, null);
static final ConfigKey<Integer> RouterHealthChecksBasicInterval = new ConfigKey<Integer>(Integer.class, "router.health.checks.basic.interval", "Advanced", "3", ConfigKey<Integer> RouterHealthChecksBasicInterval = new ConfigKey<>(Integer.class, "router.health.checks.basic.interval", "Advanced", "3",
"Interval in minutes at which basic router health checks are performed. If set to 0, no tests are scheduled.", "Interval in minutes at which basic router health checks are performed. If set to 0, no tests are scheduled.",
true, ConfigKey.Scope.Global, null, RouterHealthChecksEnabled.key()); true, ConfigKey.Scope.Global, null, RouterHealthChecksEnabled.key());
static final ConfigKey<Integer> RouterHealthChecksAdvancedInterval = new ConfigKey<Integer>(Integer.class, "router.health.checks.advanced.interval", "Advanced", "10", ConfigKey<Integer> RouterHealthChecksAdvancedInterval = new ConfigKey<>(Integer.class, "router.health.checks.advanced.interval", "Advanced", "10",
"Interval in minutes at which advanced router health checks are performed. If set to 0, no tests are scheduled.", "Interval in minutes at which advanced router health checks are performed. If set to 0, no tests are scheduled.",
true, ConfigKey.Scope.Global, null, RouterHealthChecksEnabled.key()); true, ConfigKey.Scope.Global, null, RouterHealthChecksEnabled.key());
static final ConfigKey<Integer> RouterHealthChecksConfigRefreshInterval = new ConfigKey<Integer>(Integer.class, RouterHealthChecksConfigRefreshIntervalCK, "Advanced", "10", ConfigKey<Integer> RouterHealthChecksConfigRefreshInterval = new ConfigKey<>(Integer.class, RouterHealthChecksConfigRefreshIntervalCK, "Advanced", "10",
"Interval in minutes at which router health checks config - such as scheduling intervals, excluded checks, etc is updated on virtual routers by the management server. This value should" + "Interval in minutes at which router health checks config - such as scheduling intervals, excluded checks, etc is updated on virtual routers by the management server. This value should" +
" be sufficiently high (like 2x) from the router.health.checks.basic.interval and router.health.checks.advanced.interval so that there is time between new results generation and results generation for passed data.", " be sufficiently high (like 2x) from the router.health.checks.basic.interval and router.health.checks.advanced.interval so that there is time between new results generation and results generation for passed data.",
false, ConfigKey.Scope.Global, null, RouterHealthChecksEnabled.key()); false, ConfigKey.Scope.Global, null, RouterHealthChecksEnabled.key());
static final ConfigKey<Integer> RouterHealthChecksResultFetchInterval = new ConfigKey<Integer>(Integer.class, RouterHealthChecksResultFetchIntervalCK, "Advanced", "10", ConfigKey<Integer> RouterHealthChecksResultFetchInterval = new ConfigKey<>(Integer.class, RouterHealthChecksResultFetchIntervalCK, "Advanced", "10",
"Interval in minutes at which router health checks results are fetched by management server. On each result fetch, management server evaluates need to recreate VR as per configuration of " + RouterHealthChecksFailuresToRecreateVrCK + "Interval in minutes at which router health checks results are fetched by management server. On each result fetch, management server evaluates need to recreate VR as per configuration of " + RouterHealthChecksFailuresToRecreateVrCK +
"This value should be sufficiently high (like 2x) from the router.health.checks.basic.interval and router.health.checks.advanced.interval so that there is time between new results generation and fetch.", "This value should be sufficiently high (like 2x) from the router.health.checks.basic.interval and router.health.checks.advanced.interval so that there is time between new results generation and fetch.",
false, ConfigKey.Scope.Global, null, RouterHealthChecksEnabled.key()); false, ConfigKey.Scope.Global, null, RouterHealthChecksEnabled.key());
static final ConfigKey<String> RouterHealthChecksFailuresToRecreateVr = new ConfigKey<String>(String.class, RouterHealthChecksFailuresToRecreateVrCK, "Advanced", "", ConfigKey<String> RouterHealthChecksFailuresToRecreateVr = new ConfigKey<>(String.class, RouterHealthChecksFailuresToRecreateVrCK, "Advanced", "",
"Health checks failures defined by this config are the checks that should cause router recreation. If empty the recreate is not attempted for any health check failure. Possible values are comma separated script names " + "Health checks failures defined by this config are the checks that should cause router recreation. If empty the recreate is not attempted for any health check failure. Possible values are comma separated script names " +
"from systemvms /root/health_scripts/ (namely - cpu_usage_check.py, dhcp_check.py, disk_space_check.py, dns_check.py, gateways_check.py, haproxy_check.py, iptables_check.py, memory_usage_check.py, router_version_check.py), connectivity.test, filesystem.writable.test " + "from systemvms /root/health_scripts/ (namely - cpu_usage_check.py, dhcp_check.py, disk_space_check.py, dns_check.py, gateways_check.py, haproxy_check.py, iptables_check.py, memory_usage_check.py, router_version_check.py), connectivity.test, filesystem.writable.test " +
" or services (namely - loadbalancing.service, webserver.service, dhcp.service) ", " or services (namely - loadbalancing.service, webserver.service, dhcp.service) ",
true, ConfigKey.Scope.Zone, null, null, RouterHealthChecksEnabled.key(), null, null, ConfigKey.Kind.CSV, null); true, ConfigKey.Scope.Zone, null, null, RouterHealthChecksEnabled.key(), null, null, ConfigKey.Kind.CSV, null);
static final ConfigKey<String> RouterHealthChecksToExclude = new ConfigKey<String>(String.class, "router.health.checks.to.exclude", "Advanced", "", ConfigKey<String> RouterHealthChecksToExclude = new ConfigKey<>(String.class, "router.health.checks.to.exclude", "Advanced", "",
"Health checks that should be excluded when executing scheduled checks on the router. This can be a comma separated list of script names placed in the '/root/health_checks/' folder. Currently the following scripts are " + "Health checks that should be excluded when executing scheduled checks on the router. This can be a comma separated list of script names placed in the '/root/health_checks/' folder. Currently the following scripts are " +
"placed in default systemvm template - cpu_usage_check.py, disk_space_check.py, gateways_check.py, iptables_check.py, router_version_check.py, dhcp_check.py, dns_check.py, haproxy_check.py, memory_usage_check.py.", "placed in default systemvm template - cpu_usage_check.py, disk_space_check.py, gateways_check.py, iptables_check.py, router_version_check.py, dhcp_check.py, dns_check.py, haproxy_check.py, memory_usage_check.py.",
true, ConfigKey.Scope.Zone, null, null, RouterHealthChecksEnabled.key(), null, null, ConfigKey.Kind.CSV, null); true, ConfigKey.Scope.Zone, null, null, RouterHealthChecksEnabled.key(), null, null, ConfigKey.Kind.CSV, null);
static final ConfigKey<Double> RouterHealthChecksFreeDiskSpaceThreshold = new ConfigKey<Double>(Double.class, "router.health.checks.free.disk.space.threshold", ConfigKey<Double> RouterHealthChecksFreeDiskSpaceThreshold = new ConfigKey<>(Double.class, "router.health.checks.free.disk.space.threshold",
"Advanced", "100", "Free disk space threshold (in MB) on VR below which the check is considered a failure.", "Advanced", "100", "Free disk space threshold (in MB) on VR below which the check is considered a failure.",
true, ConfigKey.Scope.Zone, null, RouterHealthChecksEnabled.key()); true, ConfigKey.Scope.Zone, null, RouterHealthChecksEnabled.key());
static final ConfigKey<Double> RouterHealthChecksMaxCpuUsageThreshold = new ConfigKey<Double>(Double.class, "router.health.checks.max.cpu.usage.threshold", ConfigKey<Double> RouterHealthChecksMaxCpuUsageThreshold = new ConfigKey<>(Double.class, "router.health.checks.max.cpu.usage.threshold",
"Advanced", "100", " Max CPU Usage threshold as % above which check is considered a failure.", "Advanced", "100", " Max CPU Usage threshold as % above which check is considered a failure.",
true, ConfigKey.Scope.Zone, null, RouterHealthChecksEnabled.key()); true, ConfigKey.Scope.Zone, null, RouterHealthChecksEnabled.key());
static final ConfigKey<Double> RouterHealthChecksMaxMemoryUsageThreshold = new ConfigKey<Double>(Double.class, "router.health.checks.max.memory.usage.threshold", ConfigKey<Double> RouterHealthChecksMaxMemoryUsageThreshold = new ConfigKey<>(Double.class, "router.health.checks.max.memory.usage.threshold",
"Advanced", "100", "Max Memory Usage threshold as % above which check is considered a failure.", "Advanced", "100", "Max Memory Usage threshold as % above which check is considered a failure.",
true, ConfigKey.Scope.Zone, null, RouterHealthChecksEnabled.key()); true, ConfigKey.Scope.Zone, null, RouterHealthChecksEnabled.key());
ConfigKey<String> RouterLogrotateFrequency = new ConfigKey<>(String.class, "router.logrotate.frequency", "Advanced", "*:00:00", ConfigKey<String> RouterLogrotateFrequency = new ConfigKey<>(String.class, "router.logrotate.frequency", "Advanced", "*:00:00",
@ -121,23 +122,15 @@ public interface VirtualNetworkApplianceManager extends Manager, VirtualNetworkA
"reach the minimum size.", "reach the minimum size.",
true, ConfigKey.Scope.Zone, null); true, ConfigKey.Scope.Zone, null);
public static final int DEFAULT_ROUTER_VM_RAMSIZE = 256; // 256M ConfigKey<Boolean> RemoveControlIpOnStop = new ConfigKey<>(Boolean.class, RemoveControlIpOnStopCK, "Advanced", "true",
public static final int DEFAULT_ROUTER_CPU_MHZ = 500; // 500 MHz "on stopping routers and system VMs the IP will be released to preserve IPv4 space.", true, ConfigKey.Scope.Zone, null);
public static final boolean USE_POD_VLAN = false;
public static final int DEFAULT_PRIORITY = 100; int DEFAULT_ROUTER_VM_RAMSIZE = 256; // 256M
public static final int DEFAULT_DELTA = 2; int DEFAULT_ROUTER_CPU_MHZ = 500; // 500 MHz
boolean USE_POD_VLAN = false;
int DEFAULT_PRIORITY = 100;
int DEFAULT_DELTA = 2;
/**
/*
* Send ssh public/private key pair to specified host
* @param hostId
* @param pubKey
* @param prvKey
*
* NOT USED IN THE VIRTUAL NET APPLIANCE
*
*/
//boolean sendSshKeysToHost(Long hostId, String pubKey, String prvKey):
boolean startRemoteAccessVpn(Network network, RemoteAccessVpn vpn, List<? extends VirtualRouter> routers) throws ResourceUnavailableException; boolean startRemoteAccessVpn(Network network, RemoteAccessVpn vpn, List<? extends VirtualRouter> routers) throws ResourceUnavailableException;

View File

@ -57,7 +57,6 @@ import org.apache.cloudstack.api.command.admin.router.UpgradeRouterTemplateCmd;
import org.apache.cloudstack.config.ApiServiceConfiguration; import org.apache.cloudstack.config.ApiServiceConfiguration;
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;
import org.apache.cloudstack.framework.config.ConfigDepot;
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;
@ -66,7 +65,6 @@ import org.apache.cloudstack.framework.jobs.impl.AsyncJobVO;
import org.apache.cloudstack.lb.ApplicationLoadBalancerRuleVO; import org.apache.cloudstack.lb.ApplicationLoadBalancerRuleVO;
import org.apache.cloudstack.lb.dao.ApplicationLoadBalancerRuleDao; import org.apache.cloudstack.lb.dao.ApplicationLoadBalancerRuleDao;
import org.apache.cloudstack.managed.context.ManagedContextRunnable; import org.apache.cloudstack.managed.context.ManagedContextRunnable;
import org.apache.cloudstack.network.router.deployment.RouterDeploymentDefinitionBuilder;
import org.apache.cloudstack.network.topology.NetworkTopology; import org.apache.cloudstack.network.topology.NetworkTopology;
import org.apache.cloudstack.network.topology.NetworkTopologyContext; import org.apache.cloudstack.network.topology.NetworkTopologyContext;
import org.apache.cloudstack.utils.CloudStackVersion; import org.apache.cloudstack.utils.CloudStackVersion;
@ -115,13 +113,11 @@ import com.cloud.api.query.vo.UserVmJoinVO;
import com.cloud.cluster.ManagementServerHostVO; import com.cloud.cluster.ManagementServerHostVO;
import com.cloud.cluster.dao.ManagementServerHostDao; import com.cloud.cluster.dao.ManagementServerHostDao;
import com.cloud.configuration.Config; import com.cloud.configuration.Config;
import com.cloud.configuration.ConfigurationManager;
import com.cloud.configuration.ZoneConfig; import com.cloud.configuration.ZoneConfig;
import com.cloud.dc.DataCenter; import com.cloud.dc.DataCenter;
import com.cloud.dc.DataCenter.NetworkType; import com.cloud.dc.DataCenter.NetworkType;
import com.cloud.dc.DataCenterVO; import com.cloud.dc.DataCenterVO;
import com.cloud.dc.HostPodVO; import com.cloud.dc.HostPodVO;
import com.cloud.dc.dao.ClusterDao;
import com.cloud.dc.dao.DataCenterDao; import com.cloud.dc.dao.DataCenterDao;
import com.cloud.dc.dao.HostPodDao; import com.cloud.dc.dao.HostPodDao;
import com.cloud.dc.dao.VlanDao; import com.cloud.dc.dao.VlanDao;
@ -143,7 +139,6 @@ import com.cloud.host.Status;
import com.cloud.host.dao.HostDao; import com.cloud.host.dao.HostDao;
import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.network.IpAddress; import com.cloud.network.IpAddress;
import com.cloud.network.IpAddressManager;
import com.cloud.network.MonitoringService; import com.cloud.network.MonitoringService;
import com.cloud.network.Network; import com.cloud.network.Network;
import com.cloud.network.Network.GuestType; import com.cloud.network.Network.GuestType;
@ -177,17 +172,13 @@ import com.cloud.network.dao.NetworkServiceMapDao;
import com.cloud.network.dao.NetworkVO; import com.cloud.network.dao.NetworkVO;
import com.cloud.network.dao.OpRouterMonitorServiceDao; import com.cloud.network.dao.OpRouterMonitorServiceDao;
import com.cloud.network.dao.OpRouterMonitorServiceVO; import com.cloud.network.dao.OpRouterMonitorServiceVO;
import com.cloud.network.dao.PhysicalNetworkServiceProviderDao;
import com.cloud.network.dao.RemoteAccessVpnDao; import com.cloud.network.dao.RemoteAccessVpnDao;
import com.cloud.network.dao.RouterHealthCheckResultDao; import com.cloud.network.dao.RouterHealthCheckResultDao;
import com.cloud.network.dao.RouterHealthCheckResultVO; import com.cloud.network.dao.RouterHealthCheckResultVO;
import com.cloud.network.dao.Site2SiteCustomerGatewayDao; import com.cloud.network.dao.Site2SiteCustomerGatewayDao;
import com.cloud.network.dao.Site2SiteVpnConnectionDao; import com.cloud.network.dao.Site2SiteVpnConnectionDao;
import com.cloud.network.dao.Site2SiteVpnConnectionVO; import com.cloud.network.dao.Site2SiteVpnConnectionVO;
import com.cloud.network.dao.Site2SiteVpnGatewayDao;
import com.cloud.network.dao.UserIpv6AddressDao;
import com.cloud.network.dao.VirtualRouterProviderDao; import com.cloud.network.dao.VirtualRouterProviderDao;
import com.cloud.network.dao.VpnUserDao;
import com.cloud.network.lb.LoadBalancingRule; import com.cloud.network.lb.LoadBalancingRule;
import com.cloud.network.lb.LoadBalancingRule.LbDestination; import com.cloud.network.lb.LoadBalancingRule.LbDestination;
import com.cloud.network.lb.LoadBalancingRule.LbHealthCheckPolicy; import com.cloud.network.lb.LoadBalancingRule.LbHealthCheckPolicy;
@ -216,16 +207,11 @@ import com.cloud.offering.NetworkOffering;
import com.cloud.offering.ServiceOffering; import com.cloud.offering.ServiceOffering;
import com.cloud.offerings.NetworkOfferingVO; import com.cloud.offerings.NetworkOfferingVO;
import com.cloud.offerings.dao.NetworkOfferingDao; import com.cloud.offerings.dao.NetworkOfferingDao;
import com.cloud.resource.ResourceManager;
import com.cloud.serializer.GsonHelper; import com.cloud.serializer.GsonHelper;
import com.cloud.server.ConfigurationServer;
import com.cloud.server.ManagementServer; import com.cloud.server.ManagementServer;
import com.cloud.service.ServiceOfferingVO; import com.cloud.service.ServiceOfferingVO;
import com.cloud.service.dao.ServiceOfferingDao; import com.cloud.service.dao.ServiceOfferingDao;
import com.cloud.storage.Storage.ProvisioningType; import com.cloud.storage.Storage.ProvisioningType;
import com.cloud.storage.dao.GuestOSDao;
import com.cloud.storage.dao.VMTemplateDao;
import com.cloud.storage.dao.VolumeDao;
import com.cloud.user.Account; import com.cloud.user.Account;
import com.cloud.user.AccountManager; import com.cloud.user.AccountManager;
import com.cloud.user.User; import com.cloud.user.User;
@ -272,9 +258,7 @@ import com.cloud.vm.dao.DomainRouterDao;
import com.cloud.vm.dao.NicDao; import com.cloud.vm.dao.NicDao;
import com.cloud.vm.dao.NicIpAliasDao; import com.cloud.vm.dao.NicIpAliasDao;
import com.cloud.vm.dao.NicIpAliasVO; import com.cloud.vm.dao.NicIpAliasVO;
import com.cloud.vm.dao.UserVmDao;
import com.cloud.vm.dao.UserVmDetailsDao; import com.cloud.vm.dao.UserVmDetailsDao;
import com.cloud.vm.dao.VMInstanceDao;
import com.google.gson.JsonSyntaxException; import com.google.gson.JsonSyntaxException;
import com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;
@ -300,7 +284,6 @@ Configurable, StateListener<VirtualMachine.State, VirtualMachine.Event, VirtualM
@Inject private LoadBalancerDao _loadBalancerDao; @Inject private LoadBalancerDao _loadBalancerDao;
@Inject private LoadBalancerVMMapDao _loadBalancerVMMapDao; @Inject private LoadBalancerVMMapDao _loadBalancerVMMapDao;
@Inject protected IPAddressDao _ipAddressDao; @Inject protected IPAddressDao _ipAddressDao;
@Inject private VMTemplateDao _templateDao;
@Inject protected DomainRouterDao _routerDao; @Inject protected DomainRouterDao _routerDao;
@Inject private UserDao _userDao; @Inject private UserDao _userDao;
@Inject protected UserStatisticsDao _userStatsDao; @Inject protected UserStatisticsDao _userStatsDao;
@ -311,17 +294,11 @@ Configurable, StateListener<VirtualMachine.State, VirtualMachine.Event, VirtualM
@Inject protected AgentManager _agentMgr; @Inject protected AgentManager _agentMgr;
@Inject private AlertManager _alertMgr; @Inject private AlertManager _alertMgr;
@Inject private AccountManager _accountMgr; @Inject private AccountManager _accountMgr;
@Inject private ConfigurationManager _configMgr;
@Inject private ConfigurationServer _configServer;
@Inject protected ServiceOfferingDao _serviceOfferingDao; @Inject protected ServiceOfferingDao _serviceOfferingDao;
@Inject private UserVmDao _userVmDao;
@Inject private VMInstanceDao _vmDao;
@Inject private NetworkOfferingDao _networkOfferingDao; @Inject private NetworkOfferingDao _networkOfferingDao;
@Inject private GuestOSDao _guestOSDao;
@Inject protected NetworkOrchestrationService _networkMgr; @Inject protected NetworkOrchestrationService _networkMgr;
@Inject protected NetworkModel _networkModel; @Inject protected NetworkModel _networkModel;
@Inject protected VirtualMachineManager _itMgr; @Inject protected VirtualMachineManager _itMgr;
@Inject private VpnUserDao _vpnUsersDao;
@Inject private RulesManager _rulesMgr; @Inject private RulesManager _rulesMgr;
@Inject protected NetworkDao _networkDao; @Inject protected NetworkDao _networkDao;
@Inject private LoadBalancingRulesManager _lbMgr; @Inject private LoadBalancingRulesManager _lbMgr;
@ -329,21 +306,13 @@ Configurable, StateListener<VirtualMachine.State, VirtualMachine.Event, VirtualM
@Inject protected RemoteAccessVpnDao _vpnDao; @Inject protected RemoteAccessVpnDao _vpnDao;
@Inject protected NicDao _nicDao; @Inject protected NicDao _nicDao;
@Inject private NicIpAliasDao _nicIpAliasDao; @Inject private NicIpAliasDao _nicIpAliasDao;
@Inject private VolumeDao _volumeDao;
@Inject private UserVmDetailsDao _vmDetailsDao; @Inject private UserVmDetailsDao _vmDetailsDao;
@Inject private ClusterDao _clusterDao;
@Inject private ResourceManager _resourceMgr;
@Inject private PhysicalNetworkServiceProviderDao _physicalProviderDao;
@Inject protected VirtualRouterProviderDao _vrProviderDao; @Inject protected VirtualRouterProviderDao _vrProviderDao;
@Inject private ManagementServerHostDao _msHostDao; @Inject private ManagementServerHostDao _msHostDao;
@Inject private Site2SiteCustomerGatewayDao _s2sCustomerGatewayDao; @Inject private Site2SiteCustomerGatewayDao _s2sCustomerGatewayDao;
@Inject private Site2SiteVpnGatewayDao _s2sVpnGatewayDao;
@Inject private Site2SiteVpnConnectionDao _s2sVpnConnectionDao; @Inject private Site2SiteVpnConnectionDao _s2sVpnConnectionDao;
@Inject private Site2SiteVpnManager _s2sVpnMgr; @Inject private Site2SiteVpnManager _s2sVpnMgr;
@Inject private UserIpv6AddressDao _ipv6Dao;
@Inject private NetworkService _networkSvc; @Inject private NetworkService _networkSvc;
@Inject private IpAddressManager _ipAddrMgr;
@Inject private ConfigDepot _configDepot;
@Inject protected MonitoringServiceDao _monitorServiceDao; @Inject protected MonitoringServiceDao _monitorServiceDao;
@Inject private AsyncJobManager _asyncMgr; @Inject private AsyncJobManager _asyncMgr;
@Inject protected VpcDao _vpcDao; @Inject protected VpcDao _vpcDao;
@ -370,7 +339,6 @@ Configurable, StateListener<VirtualMachine.State, VirtualMachine.Event, VirtualM
@Inject protected RouterControlHelper _routerControlHelper; @Inject protected RouterControlHelper _routerControlHelper;
@Inject protected CommandSetupHelper _commandSetupHelper; @Inject protected CommandSetupHelper _commandSetupHelper;
@Inject protected RouterDeploymentDefinitionBuilder _routerDeploymentManagerBuilder;
@Inject private ManagementServer mgr; @Inject private ManagementServer mgr;
private int _routerRamSize; private int _routerRamSize;
@ -2796,28 +2764,43 @@ Configurable, StateListener<VirtualMachine.State, VirtualMachine.Event, VirtualM
final VirtualMachine vm = profile.getVirtualMachine(); final VirtualMachine vm = profile.getVirtualMachine();
final DomainRouterVO domR = _routerDao.findById(vm.getId()); final DomainRouterVO domR = _routerDao.findById(vm.getId());
processStopOrRebootAnswer(domR, answer); processStopOrRebootAnswer(domR, answer);
final List<? extends Nic> routerNics = _nicDao.listByVmId(profile.getId()); if (Boolean.TRUE.equals(RemoveControlIpOnStop.valueIn(profile.getVirtualMachine().getDataCenterId()))) {
for (final Nic nic : routerNics) { removeNics(vm, domR);
final Network network = _networkModel.getNetwork(nic.getNetworkId());
final DataCenterVO dcVO = _dcDao.findById(network.getDataCenterId());
if (network.getTrafficType() == TrafficType.Guest && nic.getBroadcastUri() != null && nic.getBroadcastUri().getScheme().equals("pvlan")) {
final NicProfile nicProfile = new NicProfile(nic, network, nic.getBroadcastUri(), nic.getIsolationUri(), 0, false, "pvlan-nic");
final NetworkTopology networkTopology = _networkTopologyContext.retrieveNetworkTopology(dcVO);
try {
networkTopology.setupDhcpForPvlan(false, domR, domR.getHostId(), nicProfile);
} catch (final ResourceUnavailableException e) {
logger.debug("ERROR in finalizeStop: ", e);
}
}
} }
} }
} }
@Override @Override
public void finalizeExpunge(final VirtualMachine vm) { public void finalizeExpunge(final VirtualMachine vm) {
if (Boolean.FALSE.equals(RemoveControlIpOnStop.valueIn(vm.getDataCenterId()))) {
final DomainRouterVO domR = _routerDao.findById(vm.getId());
logger.info(String.format("removing nics for VR [%s]", vm));
removeNics(vm, domR);
}
}
private void removeNics(VirtualMachine vm, DomainRouterVO domR) {
final List<? extends Nic> routerNics = _nicDao.listByVmId(vm.getId());
final DataCenterVO dcVO = _dcDao.findById(vm.getDataCenterId());
for (final Nic nic : routerNics) {
final Network network = _networkModel.getNetwork(nic.getNetworkId());
removeDhcpRulesForPvLan(domR, nic, network, dcVO);
}
}
private void removeDhcpRulesForPvLan(DomainRouterVO domR, Nic nic, Network network, DataCenterVO dcVO) {
if (network.getTrafficType() == TrafficType.Guest && nic.getBroadcastUri() != null && nic.getBroadcastUri().getScheme().equals("pvlan")) {
final NicProfile nicProfile = new NicProfile(nic, network, nic.getBroadcastUri(), nic.getIsolationUri(), 0, false, "pvlan-nic");
final NetworkTopology networkTopology = _networkTopologyContext.retrieveNetworkTopology(dcVO);
try {
networkTopology.setupDhcpForPvlan(false, domR, domR.getHostId(), nicProfile);
} catch (final ResourceUnavailableException e) {
logger.debug("ERROR in finalizeStop: ", e);
}
}
} }
@Override @Override
@ -3339,7 +3322,8 @@ Configurable, StateListener<VirtualMachine.State, VirtualMachine.Event, VirtualM
RouterHealthChecksMaxCpuUsageThreshold, RouterHealthChecksMaxCpuUsageThreshold,
RouterHealthChecksMaxMemoryUsageThreshold, RouterHealthChecksMaxMemoryUsageThreshold,
ExposeDnsAndBootpServer, ExposeDnsAndBootpServer,
RouterLogrotateFrequency RouterLogrotateFrequency,
RemoveControlIpOnStop
}; };
} }

View File

@ -1629,9 +1629,9 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
} }
@Override @Override
public Pair<List<? extends StoragePool>, List<? extends StoragePool>> listStoragePoolsForMigrationOfVolume(final Long volumeId) { public Pair<List<? extends StoragePool>, List<? extends StoragePool>> listStoragePoolsForMigrationOfVolume(final Long volumeId, String keyword) {
Pair<List<? extends StoragePool>, List<? extends StoragePool>> allPoolsAndSuitablePoolsPair = listStoragePoolsForMigrationOfVolumeInternal(volumeId, null, null, null, null, false, true, false); Pair<List<? extends StoragePool>, List<? extends StoragePool>> allPoolsAndSuitablePoolsPair = listStoragePoolsForMigrationOfVolumeInternal(volumeId, null, null, null, null, false, true, false, keyword);
List<? extends StoragePool> allPools = allPoolsAndSuitablePoolsPair.first(); List<? extends StoragePool> allPools = allPoolsAndSuitablePoolsPair.first();
List<? extends StoragePool> suitablePools = allPoolsAndSuitablePoolsPair.second(); List<? extends StoragePool> suitablePools = allPoolsAndSuitablePoolsPair.second();
List<StoragePool> avoidPools = new ArrayList<>(); List<StoragePool> avoidPools = new ArrayList<>();
@ -1649,10 +1649,10 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
@Override @Override
public Pair<List<? extends StoragePool>, List<? extends StoragePool>> listStoragePoolsForSystemMigrationOfVolume(final Long volumeId, Long newDiskOfferingId, Long newSize, Long newMinIops, Long newMaxIops, boolean keepSourceStoragePool, boolean bypassStorageTypeCheck) { public Pair<List<? extends StoragePool>, List<? extends StoragePool>> listStoragePoolsForSystemMigrationOfVolume(final Long volumeId, Long newDiskOfferingId, Long newSize, Long newMinIops, Long newMaxIops, boolean keepSourceStoragePool, boolean bypassStorageTypeCheck) {
return listStoragePoolsForMigrationOfVolumeInternal(volumeId, newDiskOfferingId, newSize, newMinIops, newMaxIops, keepSourceStoragePool, bypassStorageTypeCheck, true); return listStoragePoolsForMigrationOfVolumeInternal(volumeId, newDiskOfferingId, newSize, newMinIops, newMaxIops, keepSourceStoragePool, bypassStorageTypeCheck, true, null);
} }
public Pair<List<? extends StoragePool>, List<? extends StoragePool>> listStoragePoolsForMigrationOfVolumeInternal(final Long volumeId, Long newDiskOfferingId, Long newSize, Long newMinIops, Long newMaxIops, boolean keepSourceStoragePool, boolean bypassStorageTypeCheck, boolean bypassAccountCheck) { public Pair<List<? extends StoragePool>, List<? extends StoragePool>> listStoragePoolsForMigrationOfVolumeInternal(final Long volumeId, Long newDiskOfferingId, Long newSize, Long newMinIops, Long newMaxIops, boolean keepSourceStoragePool, boolean bypassStorageTypeCheck, boolean bypassAccountCheck, String keyword) {
if (!bypassAccountCheck) { if (!bypassAccountCheck) {
final Account caller = getCaller(); final Account caller = getCaller();
if (!_accountMgr.isRootAdmin(caller.getId())) { if (!_accountMgr.isRootAdmin(caller.getId())) {
@ -1727,7 +1727,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
Pair<Host, List<Cluster>> hostClusterPair = getVolumeVmHostClusters(srcVolumePool, vm, hypervisorType); Pair<Host, List<Cluster>> hostClusterPair = getVolumeVmHostClusters(srcVolumePool, vm, hypervisorType);
Host vmHost = hostClusterPair.first(); Host vmHost = hostClusterPair.first();
List<Cluster> clusters = hostClusterPair.second(); List<Cluster> clusters = hostClusterPair.second();
allPools = getAllStoragePoolCompatibleWithVolumeSourceStoragePool(srcVolumePool, hypervisorType, clusters); allPools = getAllStoragePoolCompatibleWithVolumeSourceStoragePool(srcVolumePool, hypervisorType, clusters, keyword);
ExcludeList avoid = new ExcludeList(); ExcludeList avoid = new ExcludeList();
if (!keepSourceStoragePool) { if (!keepSourceStoragePool) {
allPools.remove(srcVolumePool); allPools.remove(srcVolumePool);
@ -1735,7 +1735,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
} }
if (vm != null) { if (vm != null) {
suitablePools = findAllSuitableStoragePoolsForVm(volume, diskOfferingId, newSize, newMinIops, newMaxIops, vm, vmHost, avoid, suitablePools = findAllSuitableStoragePoolsForVm(volume, diskOfferingId, newSize, newMinIops, newMaxIops, vm, vmHost, avoid,
CollectionUtils.isNotEmpty(clusters) ? clusters.get(0) : null, hypervisorType, bypassStorageTypeCheck); CollectionUtils.isNotEmpty(clusters) ? clusters.get(0) : null, hypervisorType, bypassStorageTypeCheck, keyword);
} else { } else {
suitablePools = findAllSuitableStoragePoolsForDetachedVolume(volume, diskOfferingId, allPools); suitablePools = findAllSuitableStoragePoolsForDetachedVolume(volume, diskOfferingId, allPools);
} }
@ -1802,15 +1802,15 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
* <li>We also all storage available filtering by data center, pod and cluster as the current storage pool used by the given volume.</li> * <li>We also all storage available filtering by data center, pod and cluster as the current storage pool used by the given volume.</li>
* </ul> * </ul>
*/ */
private List<? extends StoragePool> getAllStoragePoolCompatibleWithVolumeSourceStoragePool(StoragePool srcVolumePool, HypervisorType hypervisorType, List<Cluster> clusters) { private List<? extends StoragePool> getAllStoragePoolCompatibleWithVolumeSourceStoragePool(StoragePool srcVolumePool, HypervisorType hypervisorType, List<Cluster> clusters, String keyword) {
List<StoragePoolVO> storagePools = new ArrayList<>(); List<StoragePoolVO> storagePools = new ArrayList<>();
List<StoragePoolVO> zoneWideStoragePools = _poolDao.findZoneWideStoragePoolsByHypervisor(srcVolumePool.getDataCenterId(), hypervisorType); List<StoragePoolVO> zoneWideStoragePools = _poolDao.findZoneWideStoragePoolsByHypervisor(srcVolumePool.getDataCenterId(), hypervisorType, keyword);
if (CollectionUtils.isNotEmpty(zoneWideStoragePools)) { if (CollectionUtils.isNotEmpty(zoneWideStoragePools)) {
storagePools.addAll(zoneWideStoragePools); storagePools.addAll(zoneWideStoragePools);
} }
if (CollectionUtils.isNotEmpty(clusters)) { if (CollectionUtils.isNotEmpty(clusters)) {
List<Long> clusterIds = clusters.stream().map(Cluster::getId).collect(Collectors.toList()); List<Long> clusterIds = clusters.stream().map(Cluster::getId).collect(Collectors.toList());
List<StoragePoolVO> clusterAndLocalStoragePools = _poolDao.findPoolsInClusters(clusterIds); List<StoragePoolVO> clusterAndLocalStoragePools = _poolDao.findPoolsInClusters(clusterIds, keyword);
if (CollectionUtils.isNotEmpty(clusterAndLocalStoragePools)) { if (CollectionUtils.isNotEmpty(clusterAndLocalStoragePools)) {
storagePools.addAll(clusterAndLocalStoragePools); storagePools.addAll(clusterAndLocalStoragePools);
} }
@ -1826,7 +1826,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
* *
* Side note: the idea behind this method is to provide power for administrators of manually overriding deployments defined by CloudStack. * Side note: the idea behind this method is to provide power for administrators of manually overriding deployments defined by CloudStack.
*/ */
private List<StoragePool> findAllSuitableStoragePoolsForVm(final VolumeVO volume, Long diskOfferingId, Long newSize, Long newMinIops, Long newMaxIops, VMInstanceVO vm, Host vmHost, ExcludeList avoid, Cluster srcCluster, HypervisorType hypervisorType, boolean bypassStorageTypeCheck) { private List<StoragePool> findAllSuitableStoragePoolsForVm(final VolumeVO volume, Long diskOfferingId, Long newSize, Long newMinIops, Long newMaxIops, VMInstanceVO vm, Host vmHost, ExcludeList avoid, Cluster srcCluster, HypervisorType hypervisorType, boolean bypassStorageTypeCheck, String keyword) {
List<StoragePool> suitablePools = new ArrayList<>(); List<StoragePool> suitablePools = new ArrayList<>();
Long clusterId = null; Long clusterId = null;
Long podId = null; Long podId = null;
@ -1848,7 +1848,7 @@ public class ManagementServerImpl extends ManagerBase implements ManagementServe
} }
for (StoragePoolAllocator allocator : _storagePoolAllocators) { for (StoragePoolAllocator allocator : _storagePoolAllocators) {
List<StoragePool> pools = allocator.allocateToPool(diskProfile, profile, plan, avoid, StoragePoolAllocator.RETURN_UPTO_ALL, bypassStorageTypeCheck); List<StoragePool> pools = allocator.allocateToPool(diskProfile, profile, plan, avoid, StoragePoolAllocator.RETURN_UPTO_ALL, bypassStorageTypeCheck, keyword);
if (CollectionUtils.isEmpty(pools)) { if (CollectionUtils.isEmpty(pools)) {
continue; continue;
} }

View File

@ -517,7 +517,7 @@ class TestMetrics(cloudstackTestCase):
self.cleanup.append(self.small_virtual_machine) self.cleanup.append(self.small_virtual_machine)
currentHost = Host.list(self.apiclient, id=self.small_virtual_machine.hostid)[0] currentHost = Host.list(self.apiclient, id=self.small_virtual_machine.hostid)[0]
if currentHost.hypervisor.lower() == "xenserver" and currentHost.hypervisorversion == "7.1.0": if currentHost.hypervisor.lower() == "xenserver":
# Skip tests as volume metrics doesn't see to work # Skip tests as volume metrics doesn't see to work
self.skipTest("Skipping test because volume metrics doesn't work on hypervisor\ self.skipTest("Skipping test because volume metrics doesn't work on hypervisor\
%s, %s" % (currentHost.hypervisor, currentHost.hypervisorversion)) %s, %s" % (currentHost.hypervisor, currentHost.hypervisorversion))

View File

@ -497,8 +497,10 @@ export default {
this.updateVPCCheckAndFetchNetworkOfferingData() this.updateVPCCheckAndFetchNetworkOfferingData()
}, },
fetchDomainData () { fetchDomainData () {
this.domain.loading = true if ('listDomains' in this.$store.getters.apis) {
this.loadMore('listDomains', 1, this.domain) this.domain.loading = true
this.loadMore('listDomains', 1, this.domain)
}
}, },
loadMore (apiToCall, page, sema) { loadMore (apiToCall, page, sema) {
const params = {} const params = {}