Github user koushik-das commented on a diff in the pull request: https://github.com/apache/cloudstack/pull/1727#discussion_r95514039 --- Diff: server/src/com/cloud/vm/snapshot/VMSnapshotManagerImpl.java --- @@ -350,6 +368,24 @@ public VMSnapshot allocVMSnapshot(Long vmId, String vsDisplayName, String vsDesc return null; } + /** + * Add entries on vm_snapshot_details if service offering is dynamic. This will allow setting details when revert to vm snapshot + * @param vmId vm id + * @param serviceOfferingId service offering id + * @param vmSnapshotId vm snapshot id + */ + private void addSupportForCustomServiceOffering(long vmId, long serviceOfferingId, long vmSnapshotId) { + ServiceOfferingVO serviceOfferingVO = _serviceOfferingDao.findById(serviceOfferingId); + if (serviceOfferingVO.isDynamic()) { + List<UserVmDetailVO> vmDetails = _userVmDetailsDao.listDetails(vmId); + for (UserVmDetailVO detail : vmDetails) { + if(detail.getName().equalsIgnoreCase("cpuNumber") || detail.getName().equalsIgnoreCase("cpuSpeed") || detail.getName().equalsIgnoreCase("memory")) { + _vmSnapshotDetailsDao.addDetail(vmSnapshotId, detail.getName(), detail.getValue(), true); --- End diff -- Use saveDetails() instead of multiple addDetail() so that it is transaction consistent
--- 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. ---