Merge pull request #1349 from GaborApatiNagy/CA-236566

CA-236566: test-hotfix-basic-7 throws error 'VDI is in use by some other operation'
This commit is contained in:
Mihaela Stoica 2016-12-20 16:21:11 +00:00 committed by GitHub
commit 3d9d05b342

View File

@ -164,10 +164,24 @@ namespace XenAdmin.Actions
}
catch (Exception ex)
{
log.ErrorFormat("{0} {1}", "Failed to import a virtual disk over HTTP.", ex.Message);
if (vdiRef != null)
RemoveVDI(Session, vdiRef);
throw;
log.ErrorFormat("{0} {1}", "Failed to import a virtual disk over HTTP.", ex.Message);
if (vdiRef != null)
{
log.DebugFormat("Removing the VDI on a best effort basis.");
try
{
RemoveVDI(Session, vdiRef);
}
catch (Exception removeEx)
{
//best effort
log.Error("Failed to remove the VDI.", removeEx);
}
}
throw ex; //after having tried to remove the VDI, the original exception is thrown for the UI
}
finally
{