Federico Simoncelli has uploaded a new change for review.

Change subject: backend: unlock images when GetImageInfo fails
......................................................................

backend: unlock images when GetImageInfo fails

In BaseImagesCommand.endSuccessfully() we try to update the image
information contacting VDSM. If VDSM is down or for any other error
we should fail gracefully (logging) and release the locks on the
image.

Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1018876
Change-Id: I980e60ba5ad4fcc07752d065c3eaca03af025896
Signed-off-by: Federico Simoncelli <fsimo...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/BaseImagesCommand.java
1 file changed, 17 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/69/20669/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/BaseImagesCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/BaseImagesCommand.java
index 8f3c5e7..f49602d 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/BaseImagesCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/BaseImagesCommand.java
@@ -14,6 +14,7 @@
 import org.ovirt.engine.core.common.businessentities.ImageStatus;
 import org.ovirt.engine.core.common.businessentities.Snapshot.SnapshotType;
 import org.ovirt.engine.core.common.businessentities.image_storage_domain_map;
+import org.ovirt.engine.core.common.errors.VdcBLLException;
 import 
org.ovirt.engine.core.common.vdscommands.GetImageInfoVDSCommandParameters;
 import org.ovirt.engine.core.common.vdscommands.VDSCommandType;
 import org.ovirt.engine.core.common.vdscommands.VDSReturnValue;
@@ -311,18 +312,24 @@
             Guid newStorageDomainID = 
getDestinationDiskImage().getStorageIds().get(0);
 
             // complete IRS data to DB disk image:
-            DiskImage newImageIRS = (DiskImage) runVdsCommand(
-                    VDSCommandType.GetImageInfo,
-                    new GetImageInfoVDSCommandParameters(storagePoolId, 
newStorageDomainID, newImageGroupId,
-                            newImageId)).getReturnValue();
+            try {
+                DiskImage newImageIRS = (DiskImage) runVdsCommand(
+                        VDSCommandType.GetImageInfo,
+                        new GetImageInfoVDSCommandParameters(storagePoolId, 
newStorageDomainID, newImageGroupId,
+                                newImageId)).getReturnValue();
 
-            if (newImageIRS != null) {
-                completeImageData(newImageIRS);
+                if (newImageIRS != null) {
+                    completeImageData(newImageIRS);
+                }
+            } catch (VdcBLLException e) {
+                // Logging only
+                log.errorFormat("Unable to update the image info for image {0} 
(image group: {1}) on domain {2}",
+                        newImageId, newImageGroupId, newStorageDomainID);
+            } finally {
+                // Unlock destination image:
+                getDestinationDiskImage().setImageStatus(ImageStatus.OK);
+                getImageDao().update(getDestinationDiskImage().getImage());
             }
-
-            // Unlock destination image:
-            getDestinationDiskImage().setImageStatus(ImageStatus.OK);
-            getImageDao().update(getDestinationDiskImage().getImage());
         }
 
         unLockImage();


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

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

Reply via email to