Maor Lipchuk has uploaded a new change for review.

Change subject: core: Use one line error log instead stack trace.
......................................................................

core: Use one line error log instead stack trace.

Instead logging all the stack trace when failing to perform live
snapshot each time the task try to end the action, we will use one line
that will indicate the error code and the error name got from VDSM.

Change-Id: I1907d94af939bbe6da6a2149428a97c5f33fe826
Signed-off-by: Maor Lipchuk <[email protected]>
Bug-Url: https://bugzilla.redhat.com/908854
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CreateAllSnapshotsFromVmCommand.java
1 file changed, 32 insertions(+), 24 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/77/12977/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CreateAllSnapshotsFromVmCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CreateAllSnapshotsFromVmCommand.java
index 76aa476..ce572fc 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CreateAllSnapshotsFromVmCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CreateAllSnapshotsFromVmCommand.java
@@ -161,34 +161,42 @@
 
     @Override
     protected void endVmCommand() {
-        // The following code must be executed in an inner transaction to make 
the changes visible
-        // to the RunVm command that might occur afterwards
-        TransactionSupport.executeInNewTransaction(new 
TransactionMethod<Void>() {
+        try {
+            // The following code must be executed in an inner transaction to 
make the changes visible
+            // to the RunVm command that might occur afterwards
+            TransactionSupport.executeInNewTransaction(new 
TransactionMethod<Void>() {
 
-            @Override
-            public Void runInTransaction() {
-                final boolean taskGroupSucceeded = 
getParameters().getTaskGroupSuccess();
-                Guid createdSnapshotId =
-                        getSnapshotDao().getId(getVmId(), 
getParameters().getSnapshotType(), SnapshotStatus.LOCKED);
-                if (taskGroupSucceeded) {
-                    getSnapshotDao().updateStatus(createdSnapshotId, 
SnapshotStatus.OK);
+                @Override
+                public Void runInTransaction() {
+                    final boolean taskGroupSucceeded = 
getParameters().getTaskGroupSuccess();
+                    Guid createdSnapshotId =
+                            getSnapshotDao().getId(getVmId(), 
getParameters().getSnapshotType(), SnapshotStatus.LOCKED);
+                    if (taskGroupSucceeded) {
+                        getSnapshotDao().updateStatus(createdSnapshotId, 
SnapshotStatus.OK);
 
-                    if (getParameters().getParentCommand() != 
VdcActionType.RunVm && getVm() != null && getVm().isRunning()
-                            && getVm().getRunOnVds() != null) {
-                        performLiveSnapshot(createdSnapshotId);
+                        if (getParameters().getParentCommand() != 
VdcActionType.RunVm && getVm() != null
+                                && getVm().isRunning()
+                                && getVm().getRunOnVds() != null) {
+                            performLiveSnapshot(createdSnapshotId);
+                        }
+                    } else {
+                        revertToActiveSnapshot(createdSnapshotId);
                     }
-                } else {
-                    revertToActiveSnapshot(createdSnapshotId);
+
+                    incrementVmGeneration();
+
+                    endActionOnDisks();
+                    setSucceeded(taskGroupSucceeded);
+                    getReturnValue().setEndActionTryAgain(false);
+                    return null;
                 }
-
-                incrementVmGeneration();
-
-                endActionOnDisks();
-                setSucceeded(taskGroupSucceeded);
-                getReturnValue().setEndActionTryAgain(false);
-                return null;
-            }
-        });
+            });
+        } catch (VdcBLLException e) {
+            log.errorFormat("Failed to update the qemu process with the new 
created snapshot due to VDSM error {0} with code {1}. will retry again.",
+                    e.getErrorCode(),
+                    e.getErrorCode().getValue());
+            return;
+        }
 
         // if the VM is HA + it went down during the snapshot creation process 
because of an error, run it
         // (during the snapshot creation process the VM couldn't be started 
(rerun))


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

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

Reply via email to