davidjumani commented on a change in pull request #5420:
URL: https://github.com/apache/cloudstack/pull/5420#discussion_r709778565
##########
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:
Would it be better to have a single method to take cpu number, speed and
memory and return a single sc instead ?
--
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]