From 7d0c2e9b3631a5b2daffc9c978078657d59ca8a8 Mon Sep 17 00:00:00 2001 From: Gabor Apati-Nagy Date: Thu, 20 Oct 2016 17:20:51 +0100 Subject: [PATCH] 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 --- .../SupplementalPack/UploadSupplementalPackAction.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/XenModel/Actions/SupplementalPack/UploadSupplementalPackAction.cs b/XenModel/Actions/SupplementalPack/UploadSupplementalPackAction.cs index c5c0285da..ac150f6cc 100644 --- a/XenModel/Actions/SupplementalPack/UploadSupplementalPackAction.cs +++ b/XenModel/Actions/SupplementalPack/UploadSupplementalPackAction.cs @@ -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);