[GitHub] cloudstack pull request #914: BUG-ID CLOUDSTACK-8939 VM Snapshot size with m...
Github user yvsubhash commented on a diff in the pull request: https://github.com/apache/cloudstack/pull/914#discussion_r109123538 --- Diff: plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java --- @@ -3206,25 +3206,33 @@ public long getVMSnapshotChainSize(final Connection conn, final VolumeObjectTO v } } if (volumeTo.getVolumeType() == Volume.Type.ROOT) { -final Map allVMs = VM.getAllRecords(conn); -// add size of memory snapshot vdi -if (allVMs != null && allVMs.size() > 0) { -for (final VM vmr : allVMs.keySet()) { -try { -final String vName = vmr.getNameLabel(conn); -if (vName != null && vName.contains(vmName) && vmr.getIsASnapshot(conn)) { -final VDI memoryVDI = vmr.getSuspendVDI(conn); -if (!isRefNull(memoryVDI)) { -size = size + memoryVDI.getPhysicalUtilisation(conn); -final VDI pMemoryVDI = memoryVDI.getParent(conn); -if (!isRefNull(pMemoryVDI)) { -size = size + pMemoryVDI.getPhysicalUtilisation(conn); +VM vm = getVM(conn, vmName); --- End diff -- @sudhansu7 exception needs to be caught at the callers otherwise it would end up setting zero size --- 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. ---
[GitHub] cloudstack pull request #914: BUG-ID CLOUDSTACK-8939 VM Snapshot size with m...
Github user sudhansu7 commented on a diff in the pull request: https://github.com/apache/cloudstack/pull/914#discussion_r111375928 --- Diff: plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java --- @@ -3206,25 +3206,33 @@ public long getVMSnapshotChainSize(final Connection conn, final VolumeObjectTO v } } if (volumeTo.getVolumeType() == Volume.Type.ROOT) { -final Map allVMs = VM.getAllRecords(conn); -// add size of memory snapshot vdi -if (allVMs != null && allVMs.size() > 0) { -for (final VM vmr : allVMs.keySet()) { -try { -final String vName = vmr.getNameLabel(conn); -if (vName != null && vName.contains(vmName) && vmr.getIsASnapshot(conn)) { -final VDI memoryVDI = vmr.getSuspendVDI(conn); -if (!isRefNull(memoryVDI)) { -size = size + memoryVDI.getPhysicalUtilisation(conn); -final VDI pMemoryVDI = memoryVDI.getParent(conn); -if (!isRefNull(pMemoryVDI)) { -size = size + pMemoryVDI.getPhysicalUtilisation(conn); +VM vm = getVM(conn, vmName); --- End diff -- LGTM for code change --- 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. ---
[GitHub] cloudstack pull request #914: BUG-ID CLOUDSTACK-8939 VM Snapshot size with m...
Github user sudhansu7 commented on a diff in the pull request: https://github.com/apache/cloudstack/pull/914#discussion_r90809764 --- Diff: plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java --- @@ -3206,25 +3206,33 @@ public long getVMSnapshotChainSize(final Connection conn, final VolumeObjectTO v } } if (volumeTo.getVolumeType() == Volume.Type.ROOT) { -final Map allVMs = VM.getAllRecords(conn); -// add size of memory snapshot vdi -if (allVMs != null && allVMs.size() > 0) { -for (final VM vmr : allVMs.keySet()) { -try { -final String vName = vmr.getNameLabel(conn); -if (vName != null && vName.contains(vmName) && vmr.getIsASnapshot(conn)) { -final VDI memoryVDI = vmr.getSuspendVDI(conn); -if (!isRefNull(memoryVDI)) { -size = size + memoryVDI.getPhysicalUtilisation(conn); -final VDI pMemoryVDI = memoryVDI.getParent(conn); -if (!isRefNull(pMemoryVDI)) { -size = size + pMemoryVDI.getPhysicalUtilisation(conn); +VM vm = getVM(conn, vmName); --- End diff -- @yvsubhash getVm() raises CloudRuntimeException if Vm is not found. Scenario: Deploy a vm and ensure its in running state. Take a VM snapshot ( either disk or disk + memory ) for VM. After snapshot operation is sucessful , destroy the VM. Observation : VM destroy Fails with reason VM with name: i-2-7-VM does not exist. SNapshot moves to Expunging state , and VM moves to stopped state. Solution : Place your changes within a try.. catch block --- 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. ---