shwstppr commented on a change in pull request #5420:
URL: https://github.com/apache/cloudstack/pull/5420#discussion_r709791219
##########
File path: server/src/main/java/com/cloud/api/query/QueryManagerImpl.java
##########
@@ -2994,9 +3034,28 @@
// 2.In case vm is running return only offerings greater than
equal to current offering compute and offering's dynamic scalability should
match
if (vmInstance.getState() == VirtualMachine.State.Running) {
- sc.addAnd("cpu", Op.GTEQ, currentVmOffering.getCpu());
- sc.addAnd("speed", Op.GTEQ, currentVmOffering.getSpeed());
- sc.addAnd("ramSize", Op.GTEQ, currentVmOffering.getRamSize());
+ Integer vmCpu = currentVmOffering.getCpu();
+ Integer vmMemory = currentVmOffering.getSpeed();
+ Integer vmSpeed = currentVmOffering.getSpeed();
+ if ((vmCpu == null || vmMemory == null || vmSpeed == null) &&
VirtualMachine.Type.User.equals(vmInstance.getType())) {
+ UserVmVO userVmVO = _userVmDao.findById(vmId);
+ _userVmDao.loadDetails(userVmVO);
+ Map<String, String> details = userVmVO.getDetails();
+ vmCpu =
NumbersUtil.parseInt(details.get(ApiConstants.CPU_NUMBER), 0);
+ if (vmSpeed == null) {
+ vmSpeed =
NumbersUtil.parseInt(details.get(ApiConstants.CPU_SPEED), 0);
+ }
+ vmMemory =
NumbersUtil.parseInt(details.get(ApiConstants.MEMORY), 0);
+ }
+ if (vmCpu != null && vmCpu > 0) {
Review comment:
Not sure if that would add any benefit as that single SearchCriteria
will also be a combination of these three SearchCriterias with AND condition
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]