Liron Aravot has uploaded a new change for review.

Change subject: core : ImportVm - not all disks are actually copied
......................................................................

core : ImportVm - not all disks are actually copied

When importing a vm, lists of disk ids and image ids are being populated
in order to be used when creating the parameters for 
MoveOrCopyImageGroupCommand.
When vm has snapshots, vm.getImages() returnes the DiskImage instances
of all the disks snapshots as well - that caused that when importing the vm
that has snapshots, same disk id was added few times to the disk's id list.

When creating the tasks for copying the disks, the iteration is
according to the disk count, meaning that possibly we will execute copy
of the same image group while other image groups won't be copied at all
- which will cause that the imported vm will have only some of it's disks.

the proposed fix adds only the disk id\image of the leaf disk, so
duplicate id's won't be added.

Change-Id: Ib850d2d22ea6acb37320ad2b1bd6c571e1048faa
Bug-Url: https://bugzilla.redhat.com/912697
Signed-off-by: Liron Aravot <lara...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImportVmCommand.java
1 file changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/97/12297/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImportVmCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImportVmCommand.java
index 5b1c514..a09ea32 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImportVmCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImportVmCommand.java
@@ -670,8 +670,6 @@
         } else {
             Guid snapshotId = null;
             for (DiskImage disk : getVm().getImages()) {
-                diskGuidList.add(disk.getId());
-                imageGuidList.add(disk.getImageId());
                 disk.setActive(false);
                 setDiskStorageDomainInfo(disk);
 
@@ -684,6 +682,8 @@
             int aliasCounter = 0;
             for (List<DiskImage> diskList : images.values()) {
                 DiskImage disk = diskList.get(diskList.size() - 1);
+                diskGuidList.add(disk.getId());
+                imageGuidList.add(disk.getImageId());
                 snapshotId = disk.getVmSnapshotId().getValue();
                 disk.setActive(true);
                 ImagesHandler.setDiskAlias(disk, getVm(), ++aliasCounter);


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

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

Reply via email to