Omer Frenkel has uploaded a new change for review.

Change subject: core: Add disk device after disk is added
......................................................................

core: Add disk device after disk is added

Currently, AddDiskCommand adds the device to the DB,
before the disk is there, this cause the boot order not to take the new
disk into consideration.

In this patch the addition of the device is moved after the disk is
created by the disk is in the db.

Change-Id: I2f2fc8e6771ed2b352f2bde7b4e313481df76b90
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1131018
Signed-off-by: Omer Frenkel <ofren...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddDiskCommand.java
1 file changed, 14 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/67/31867/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddDiskCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddDiskCommand.java
index 297260d..e61e4fd 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddDiskCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddDiskCommand.java
@@ -419,16 +419,6 @@
         parameters.setStoragePoolId(getStorageDomain().getStoragePoolId());
         if (getVm() != null) {
             setVmSnapshotIdForDisk(parameters);
-            
getCompensationContext().snapshotNewEntity(VmDeviceUtils.addManagedDevice(new 
VmDeviceId(getParameters().getDiskInfo()
-                    .getId(),
-                    getVmId()),
-                    VmDeviceGeneralType.DISK,
-                    VmDeviceType.DISK,
-                    null,
-                    shouldDiskBePlugged(),
-                    
Boolean.TRUE.equals(getParameters().getDiskInfo().getReadOnly()),
-                    null));
-            getCompensationContext().stateChanged();
         }
         VdcReturnValueBase tmpRetValue =
                 
runInternalActionWithTasksContext(VdcActionType.AddImageFromScratch,
@@ -438,6 +428,20 @@
         setLock(null);
         ArrayList<Guid> taskList = isExecutedAsChildCommand() ? 
getReturnValue().getInternalVdsmTaskIdList() : 
getReturnValue().getVdsmTaskIdList();
         taskList.addAll(tmpRetValue.getInternalVdsmTaskIdList());
+
+        if (getVm() != null) {
+            
getCompensationContext().snapshotNewEntity(VmDeviceUtils.addManagedDevice(new 
VmDeviceId(getParameters().getDiskInfo()
+                            .getId(),
+                            getVmId()),
+                    VmDeviceGeneralType.DISK,
+                    VmDeviceType.DISK,
+                    null,
+                    shouldDiskBePlugged(),
+                    
Boolean.TRUE.equals(getParameters().getDiskInfo().getReadOnly()),
+                    null));
+            getCompensationContext().stateChanged();
+        }
+
         if (tmpRetValue.getActionReturnValue() != null) {
             DiskImage diskImage = (DiskImage) 
tmpRetValue.getActionReturnValue();
             addDiskPermissions(diskImage);


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2f2fc8e6771ed2b352f2bde7b4e313481df76b90
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.5
Gerrit-Owner: Omer Frenkel <ofren...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to