Liron Ar has uploaded a new change for review.

Change subject: core: further handling of unmanaged disk devices
......................................................................

core: further handling of unmanaged disk devices

When attempting to restore vm configuration from a snapshot -
1. Currently attached unmanaged disk devices will be removed.

2. Unmanaged disk devices from the snapshot configuration won't be
added- they will be added during the vm run if needed.

Change-Id: Ia0cd3a95de9b04d49cc655981e15abed4f1adab7
Signed-off-by: Liron Aravot <lara...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/snapshots/SnapshotsManager.java
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/utils/VmDeviceUtils.java
2 files changed, 5 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/31/21731/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 e3ad7cf..f95934f 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
@@ -342,16 +342,11 @@
      * of the snapshot. Other disks shouldn't be removed as they are not part 
of the snapshot).
      */
     private boolean deviceCanBeRemoved(VmDevice vmDevice) {
-        if (!vmDevice.getDevice().equals(VmDeviceType.DISK.getName())) {
+        if (!vmDevice.getDevice().equals(VmDeviceType.DISK.getName()) || 
!vmDevice.getIsManaged()) {
             return true;
         }
 
-        if (vmDevice.getSnapshotId() == null) {
-           Disk disk = getDiskDao().get(vmDevice.getDeviceId());
-           return disk != null && disk.isAllowSnapshot();
-        }
-
-        return false;
+        return vmDevice.getSnapshotId() == null && 
getDiskDao().get(vmDevice.getDeviceId()).isAllowSnapshot();
     }
 
     /**
diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/utils/VmDeviceUtils.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/utils/VmDeviceUtils.java
index 31cfec4..7b2f2cc 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/utils/VmDeviceUtils.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/utils/VmDeviceUtils.java
@@ -838,7 +838,9 @@
             addSoundCard(entity);
         }
         for (VmDevice vmDevice : entity.getUnmanagedDeviceList()) {
-            vmDeviceToAdd.add(vmDevice);
+            if (!VmDeviceCommonUtils.isDisk(vmDevice)) {
+                vmDeviceToAdd.add(vmDevice);
+            }
         }
     }
 


-- 
To view, visit http://gerrit.ovirt.org/21731
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia0cd3a95de9b04d49cc655981e15abed4f1adab7
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Liron Ar <lara...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to