Github user miguelaferreira commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/741#discussion_r37956660
  
    --- Diff: 
plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockVmManagerImpl.java
 ---
    @@ -449,12 +450,34 @@ public Answer CleanupNetworkRules(final 
CleanupNetworkRulesCmd cmd, final Simula
     
         @Override
         public Answer scaleVm(final ScaleVmCommand cmd) {
    -        return null;  //To change body of implemented methods use File | 
Settings | File Templates.
    +        TransactionLegacy txn = 
TransactionLegacy.open(TransactionLegacy.SIMULATOR_DB);
    +        try {
    +            txn.start();
    +            final String vmName = cmd.getVmName();
    +            final MockVMVO vm = _mockVmDao.findByVmName(vmName);
    +            if (vm == null) {
    +                return new ScaleVmAnswer(cmd, false, "Can't find VM " + 
vmName);
    +            }
    +            vm.setCpu(cmd.getCpus() * cmd.getMaxSpeed());
    +            vm.setMemory(cmd.getMaxRam());
    +            _mockVmDao.update(vm.getId(), vm);
    +            s_logger.debug("Scaled up VM " + vmName);
    +            txn.commit();
    +            return new ScaleVmAnswer(cmd, true, null);
    +        } catch (final Exception ex) {
    +            txn.rollback();
    +            throw new CloudRuntimeException("Unable to scale up VM", ex);
    +        } finally {
    +            txn.close();
    +            txn = TransactionLegacy.open(TransactionLegacy.CLOUD_DB);
    --- End diff --
    
    Check. Thanks for the info


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to