mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
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>
This commit is contained in:
parent
b2a9d7558c
commit
5d7f42d647
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user