XenCenter: Handle already uploaded updates

Introduce fails with a Failure if the uploaded update has already been introduced, in that case XenCenter will use the existing Pool_update

Signed-off-by: Gabor Apati-Nagy <gabor.apati-nagy@citrix.com>
This commit is contained in:
Gabor Apati-Nagy 2016-10-20 17:20:51 +01:00
parent f4a0f3ae40
commit 7d0c2e9b36

View File

@ -189,6 +189,15 @@ namespace XenAdmin.Actions
var poolUpdateRef = Pool_update.introduce(Connection.Session, vdiRef);
poolUpdate = Connection.WaitForCache(poolUpdateRef);
}
catch (Failure ex)
{
if (ex.ErrorDescription != null && ex.ErrorDescription.Count > 1 && "UPDATE_ALREADY_EXISTS".Equals(ex.ErrorDescription[0], StringComparison.InvariantCultureIgnoreCase))
{
string uuidFound = ex.ErrorDescription[1];
poolUpdate = Connection.Cache.Pool_updates.FirstOrDefault(pu => string.Equals(pu.uuid, uuidFound, System.StringComparison.InvariantCultureIgnoreCase));
}
}
catch (Exception ex)
{
log.ErrorFormat("Upload failed when introducing update from VDI {0} on {1}: {2}", vdi.opaque_ref, Connection, ex.Message);