Lee Yarwood has uploaded a new change for review.

Change subject: core: Avoid marking imported images as illegal when removing a 
guest from an import domain.
......................................................................

core: Avoid marking imported images as illegal when removing a guest from an 
import domain.

Change-Id: I08a2163caaa48f58c5f24f32483cc43d03078348
Signed-off-by: Lee Yarwood <lyarw...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveAllVmImagesCommand.java
1 file changed, 18 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/08/18708/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveAllVmImagesCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveAllVmImagesCommand.java
index 1e673c2..7daa9a4 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveAllVmImagesCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveAllVmImagesCommand.java
@@ -59,21 +59,28 @@
                     
getReturnValue().getInternalVdsmTaskIdList().addAll(vdcReturnValue.getInternalVdsmTaskIdList());
                 } else {
                     failedRemoving.add(image);
-                    log.errorFormat("Can't remove image id: {0} for VM id: {1} 
due to: {2}. Image will be set at illegal state with no snapshot id.",
+                    log.errorFormat("Can't remove image id: {0} for VM id: {1} 
due to: {2}.",
                             image.getImageId(),
                             getParameters().getVmId(),
                             vdcReturnValue.getFault().getMessage());
 
-                    
TransactionSupport.executeInScope(TransactionScopeOption.Required,
-                            new TransactionMethod<Object>() {
-                                @Override
-                                public Object runInTransaction() {
-                                    // If VDSM task didn't succeed to initiate 
a task we change the disk to at illegal
-                                    // state.
-                                    updateDiskImagesToIllegal(image);
-                                    return true;
-                                }
-                            });
+                    if (getParameters().getParentCommand() != 
VdcActionType.RemoveVmFromImportExport
+                            && getParameters().getParentCommand() != 
VdcActionType.RemoveVmTemplateFromImportExport) {
+                        log.error("Image will be set at illegal state with no 
snapshot id.");
+
+                        
TransactionSupport.executeInScope(TransactionScopeOption.Required,
+                                new TransactionMethod<Object>() {
+                                    @Override
+                                    public Object runInTransaction() {
+                                        // If VDSM task didn't succeed to 
initiate a task we change the disk to at illegal
+                                        // state.
+                                        updateDiskImagesToIllegal(image);
+                                        return true;
+                                    }
+                                });
+                    } else {
+                        log.error("Image is on an import domain and will not 
be marked as illegal.");
+                    }
                 }
             }
         }


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

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

Reply via email to