server: add possibility to scale vm to current customer offerings (#4622)

We can use cloudmonkey to scale a vm with dynamic offering, to same offering but with different cpunumber or memory.
Enable it on UI to improve user experience.
This commit is contained in:
Wei Zhou 2021-02-01 09:44:48 +01:00 committed by GitHub
parent 1913c6854e
commit a44fb11a02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2820,7 +2820,9 @@ public class QueryManagerImpl extends MutualExclusiveIdsManagerBase implements Q
_accountMgr.checkAccess(caller, null, true, vmInstance);
currentVmOffering = _srvOfferingDao.findByIdIncludingRemoved(vmInstance.getId(), vmInstance.getServiceOfferingId());
sc.addAnd("id", SearchCriteria.Op.NEQ, currentVmOffering.getId());
if (! currentVmOffering.isDynamic()) {
sc.addAnd("id", SearchCriteria.Op.NEQ, currentVmOffering.getId());
}
// 1. Only return offerings with the same storage type
sc.addAnd("useLocalStorage", SearchCriteria.Op.EQ, currentVmOffering.isUseLocalStorage());