Liron Ar has uploaded a new change for review. Change subject: core: SnapshotManager - disk devices might not represent engine disks ......................................................................
core: SnapshotManager - disk devices might not represent engine disks When using the snapshot manager there is an attempt to remove the disks that aren't part of the snaposhot. That's being done by loading the vm disk devices, load the disk for each device and remove it if needed. If the device represented disk isn't a disk known by the engine, do not remove it (as being done for disks that aren't snappable/snapshot disks). Note - This method could be refactored to load the vm disks directly instead of the devices and then the disks. In this patch the null check is be added, while further refactor would be done in follow up changes (the device are synced multiple times, the vm disks could be loaded instead of the devices..etc). Change-Id: Ie38c39c0f0409988a73610fe1dfb9a22afee5553 Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1032807 Signed-off-by: Liron Aravot <[email protected]> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/snapshots/SnapshotsManager.java 1 file changed, 8 insertions(+), 2 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/54/21654/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/snapshots/SnapshotsManager.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/snapshots/SnapshotsManager.java index 101316f..e8185d5 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/snapshots/SnapshotsManager.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/snapshots/SnapshotsManager.java @@ -345,7 +345,13 @@ if (!vmDevice.getDevice().equals(VmDeviceType.DISK.getName())) { return true; } - return vmDevice.getSnapshotId() == null && getDiskDao().get(vmDevice.getDeviceId()).isAllowSnapshot(); + + if (vmDevice.getSnapshotId() == null) { + Disk disk = getDiskDao().get(vmDevice.getDeviceId()); + return disk != null && disk.isAllowSnapshot(); + } + + return false; } /** @@ -513,7 +519,7 @@ vmId, VmDeviceGeneralType.DISK, VmDeviceType.DISK.getName())) { if (!diskIdsFromSnapshot.contains(vmDevice.getDeviceId()) && vmDevice.getSnapshotId() == null) { Disk disk = getDiskDao().get(vmDevice.getDeviceId()); - if (disk.isAllowSnapshot()) { + if (disk != null && disk.isAllowSnapshot()) { getBaseDiskDao().remove(vmDevice.getDeviceId()); getVmDeviceDao().remove(vmDevice.getId()); } -- To view, visit http://gerrit.ovirt.org/21654 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie38c39c0f0409988a73610fe1dfb9a22afee5553 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: ovirt-engine-3.3 Gerrit-Owner: Liron Ar <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
