Github user koushik-das commented on a diff in the pull request:

    https://github.com/apache/cloudstack/pull/1727#discussion_r95514745
  
    --- Diff: server/src/com/cloud/vm/snapshot/VMSnapshotManagerImpl.java ---
    @@ -707,16 +802,41 @@ private UserVm orchestrateRevertToVMSnapshot(Long 
vmSnapshotId) throws Insuffici
                 throw new InvalidParameterValueException("There is other 
active vm snapshot tasks on the instance, please try again later");
             }
     
    +        revertUserVmDetailsFromVmSnapshot(userVm, vmSnapshotVo);
    +
             try {
                 VMSnapshotStrategy strategy = 
findVMSnapshotStrategy(vmSnapshotVo);
                 strategy.revertVMSnapshot(vmSnapshotVo);
    +            updateUserVmServiceOffering(userVm, vmSnapshotVo);
                 return userVm;
             } catch (Exception e) {
                 s_logger.debug("Failed to revert vmsnapshot: " + vmSnapshotId, 
e);
                 throw new CloudRuntimeException(e.getMessage());
             }
         }
     
    +    /**
    +     * Update or add user vm details from vm snapshot for vms with custom 
service offerings
    +     * @param userVm user vm
    +     * @param vmSnapshotVo vm snapshot
    +     */
    +    private void revertUserVmDetailsFromVmSnapshot(UserVmVO userVm, 
VMSnapshotVO vmSnapshotVo) {
    +        ServiceOfferingVO serviceOfferingVO = 
_serviceOfferingDao.findById(vmSnapshotVo.getServiceOfferingId());
    +        if (serviceOfferingVO.isDynamic()) {
    +            List<VMSnapshotDetailsVO> vmSnapshotDetails = 
_vmSnapshotDetailsDao.listDetails(vmSnapshotVo.getId());
    +            for (VMSnapshotDetailsVO detail : vmSnapshotDetails) {
    --- End diff --
    
    Check if saveDetails() can be used here or all the individual calls to 
update details need to be wrapped in transaction


---
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