protected override Problem RunCheck() { if (!Host.IsLive) { return(new HostNotLiveWarning(this, Host)); } if (!Host.Connection.IsConnected) { throw new EndOfStreamException(Helpers.GetName(Host.Connection)); } Session session = Host.Connection.DuplicateSession(); // // Check patch isn't already applied here // if ((Patch != null && Patch.AppliedOn(Host) != DateTime.MaxValue) || (Update != null && Update.AppliedOn(Host))) { return(new PatchAlreadyApplied(this, Host)); } try { if (Patch != null) { string result = Pool_patch.precheck(session, Patch.opaque_ref, Host.opaque_ref); log.DebugFormat("Pool_patch.precheck returned: '{0}'", result); return(FindProblem(result)); } else if (Helpers.ElyOrGreater(Host)) { var livepatchStatus = Pool_update.precheck(session, Update.opaque_ref, Host.opaque_ref); log.DebugFormat("Pool_update.precheck returned livepatch_status: '{0}'", livepatchStatus); if (livePatchCodesByHost != null) { livePatchCodesByHost[Host.uuid] = livepatchStatus; } } return(null); } catch (Failure f) { log.Error(f.ToString()); if (f.ErrorDescription.Count > 0) { log.Error(f.ErrorDescription[0]); } if (f.ErrorDescription.Count > 1) { log.Error(f.ErrorDescription[1]); } if (f.ErrorDescription.Count > 2) { log.Error(f.ErrorDescription[2]); } if (f.ErrorDescription.Count > 3) { log.Error(f.ErrorDescription[3]); } // try and find problem from the xapi failure Problem problem = FindProblem(f); return(problem ?? new PrecheckFailed(this, Host, f)); } }
protected override Problem RunCheck() { // // Check that the SR where the update was uploaded is still attached // if (srUploadedUpdates != null && ((srUploadedUpdates.shared && !srUploadedUpdates.CanBeSeenFrom(Host)) || (!srUploadedUpdates.shared && srUploadedUpdates.IsBroken()))) { return(new BrokenSRWarning(this, Host, srUploadedUpdates)); } // // Check patch isn't already applied here // if ((Patch != null && Patch.AppliedOn(Host) != DateTime.MaxValue) || (Update != null && Update.AppliedOn(Host))) { return(new PatchAlreadyApplied(this, Host)); } if (!Host.IsLive()) { return(new HostNotLiveWarning(this, Host)); } if (!Host.Connection.IsConnected) { throw new EndOfStreamException(Helpers.GetName(Host.Connection)); } Session session = Host.Connection.DuplicateSession(); try { if (Patch != null) { string result = Pool_patch.precheck(session, Patch.opaque_ref, Host.opaque_ref); log.DebugFormat("Pool_patch.precheck returned: '{0}'", result); return(FindProblem(result)); } if (Update != null) { var livepatchStatus = Pool_update.precheck(session, Update.opaque_ref, Host.opaque_ref); log.DebugFormat("Pool_update.precheck returned livepatch_status: '{0}'", livepatchStatus); if (livePatchCodesByHost != null) { livePatchCodesByHost[Host.uuid] = livepatchStatus; } return(null); } //trying to apply update to partially upgraded pool if (Helpers.ElyOrGreater(Helpers.GetMaster(Host.Connection)) && !Helpers.ElyOrGreater(Host)) { return(new WrongServerVersion(this, Host)); } return(null); } catch (Failure f) { log.Error(f.ToString()); if (f.ErrorDescription.Count > 0) { log.Error(f.ErrorDescription[0]); } if (f.ErrorDescription.Count > 1) { log.Error(f.ErrorDescription[1]); } if (f.ErrorDescription.Count > 2) { log.Error(f.ErrorDescription[2]); } if (f.ErrorDescription.Count > 3) { log.Error(f.ErrorDescription[3]); } // try and find problem from the xapi failure Problem problem = FindProblem(f); return(problem ?? new PrecheckFailed(this, Host, f)); } }