incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sate...@apache.org
Subject git commit: refs/heads/master - CLOUDSTACK-1403 Storage and console-proxy related error
Date Fri, 01 Mar 2013 04:15:34 GMT
Updated Branches:
  refs/heads/master b2a9d7558 -> 5d7f42d64


CLOUDSTACK-1403 Storage and console-proxy related error

Aborting lease over VM/template if uploading file fails.
Earlier the lease was completed successfully even if upload fails due to IOException or ConnectionException
while uploading file to HTTP URL.

Porting the fix from 4.1 branch to master.

Signed-off-by: Sateesh Chodapuneedi <sateesh@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/5d7f42d6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/5d7f42d6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/5d7f42d6

Branch: refs/heads/master
Commit: 5d7f42d647c3a138886b729e67f423686b53c8cf
Parents: b2a9d75
Author: Sateesh Chodapuneedi <sateesh@apache.org>
Authored: Fri Mar 1 09:41:30 2013 +0530
Committer: Sateesh Chodapuneedi <sateesh@apache.org>
Committed: Fri Mar 1 09:41:30 2013 +0530

----------------------------------------------------------------------
 .../hypervisor/vmware/mo/HypervisorHostHelper.java |   27 +++++++++++----
 1 files changed, 20 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5d7f42d6/vmware-base/src/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java
----------------------------------------------------------------------
diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java b/vmware-base/src/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java
index 77f6b79..77862d1 100755
--- a/vmware-base/src/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java
+++ b/vmware-base/src/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java
@@ -999,6 +999,7 @@ public class HypervisorHostHelper {
 			s_logger.error(msg);
 			throw new Exception(msg);
 		}
+        boolean importSuccess = true;
 		final HttpNfcLeaseMO leaseMo = new HttpNfcLeaseMO(context, morLease);
 		HttpNfcLeaseState state = leaseMo.waitState(
 			new HttpNfcLeaseState[] { HttpNfcLeaseState.ready, HttpNfcLeaseState.error });
@@ -1032,13 +1033,25 @@ public class HypervisorHostHelper {
 		        			 }  
 			        	 }  
 			        }
-		        } finally {
-		        	progressReporter.close();
-		        }
-		        leaseMo.updateLeaseProgress(100);
-			}
-		} finally {
-			leaseMo.completeLease();
+                } catch (Exception e) {
+                    s_logger.error("Failed to complete file upload task. " + e.getMessage());
+                    // Set flag to cleanup the stale template left due to failed import operation,
if any
+                    importSuccess = false;
+                    throw e;
+                } finally {
+                    progressReporter.close();
+                }
+                if (bytesAlreadyWritten == totalBytes) {
+                    leaseMo.updateLeaseProgress(100);
+                }
+            }
+        } finally {
+            if (!importSuccess) {
+                s_logger.error("Aborting the lease on " + vmName + " after import operation
failed.");
+                leaseMo.abortLease();
+            } else {
+                leaseMo.completeLease();
+            }
 		}
 	}
 }


Mime
View raw message