You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by sa...@apache.org on 2013/02/28 16:09:34 UTC
git commit: refs/heads/4.1 - CLOUDSTACK-1403 Storage and
console-proxy related error
Updated Branches:
refs/heads/4.1 f4c62a859 -> f8e3f161f
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.
Signed-off-by: Sateesh Chodapuneedi <sa...@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/f8e3f161
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/f8e3f161
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/f8e3f161
Branch: refs/heads/4.1
Commit: f8e3f161f9aefd51fed1745d0cb02d2d1be25215
Parents: f4c62a8
Author: Sateesh Chodapuneedi <sa...@apache.org>
Authored: Thu Feb 28 20:33:47 2013 +0530
Committer: Sateesh Chodapuneedi <sa...@apache.org>
Committed: Thu Feb 28 20:33:47 2013 +0530
----------------------------------------------------------------------
.../hypervisor/vmware/mo/HypervisorHostHelper.java | 19 ++++++++++++--
1 files changed, 16 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/f8e3f161/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 50f9541..a232bd0 100755
--- a/vmware-base/src/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java
+++ b/vmware-base/src/com/cloud/hypervisor/vmware/mo/HypervisorHostHelper.java
@@ -868,6 +868,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 });
@@ -901,13 +902,25 @@ public class HypervisorHostHelper {
}
}
}
- } finally {
+ } 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();
}
- leaseMo.updateLeaseProgress(100);
+ if (bytesAlreadyWritten == totalBytes) {
+ leaseMo.updateLeaseProgress(100);
+ }
}
} finally {
- leaseMo.completeLease();
+ if (!importSuccess) {
+ s_logger.error("Aborting the lease on " + vmName + " after import operation failed.");
+ leaseMo.abortLease();
+ } else {
+ leaseMo.completeLease();
+ }
}
}
}