Liron Aravot has uploaded a new change for review.

Change subject: core: import vm -persist disks with correct storage domain
......................................................................

core: import vm -persist disks with correct storage domain

When importing template, the added disks were persisted with the
export domain as their storage domain rather then the target storage
domain.

note: the correct storage domain is set only for the saved disks and
not to all of it's snapshots - if the operation is successful then the
storage domain will be set to all snapshots from end method of
MoveOrCopyImageGroup, otherwise the disk will be removed.

Change-Id: I43280c97f2e444720044966eead7276999bdce1a
Signed-off-by: Liron Aravot <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ImportVmCommand.java
1 file changed, 10 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/27/11327/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 d671312..d95cbaf 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
@@ -609,6 +609,8 @@
                     disk.setvolume_format(diskImageBase.getvolume_format());
                     disk.setvolume_type(diskImageBase.getvolume_type());
                 }
+                setDiskStorageDomainInfo(disk);
+
                 diskGuidList.add(disk.getId());
                 imageGuidList.add(disk.getImageId());
                 if (getParameters().isImportAsNewEntity()) {
@@ -634,6 +636,8 @@
                 diskGuidList.add(disk.getId());
                 imageGuidList.add(disk.getImageId());
                 disk.setactive(false);
+                setDiskStorageDomainInfo(disk);
+
                 saveImage(disk);
                 snapshotId = disk.getvm_snapshot_id().getValue();
                 saveSnapshotIfNotExists(snapshotId, disk);
@@ -655,6 +659,12 @@
         }
     }
 
+    private void setDiskStorageDomainInfo(DiskImage disk) {
+        ArrayList<Guid> storageDomain = new ArrayList<Guid>();
+        storageDomain.add(imageToDestinationDomainMap.get(disk.getId()));
+        disk.setstorage_ids(storageDomain);
+    }
+
     /** Saves the base disk object */
     protected void saveBaseDisk(DiskImage disk) {
         getBaseDiskDao().save(disk);


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I43280c97f2e444720044966eead7276999bdce1a
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Liron Aravot <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to