public UploadPatchToMasterPlanAction(IXenConnection connection, XenServerPatch patch, List <PoolPatchMapping> mappings, Dictionary <XenServerPatch, string> allDownloadedPatches) : base(connection, string.Format(Messages.UPDATES_WIZARD_UPLOADING_UPDATE, patch.Name, connection.Name)) { this.patch = patch; this.mappings = mappings; this.AllDownloadedPatches = allDownloadedPatches; }
public PatchPrecheckOnHostPlanAction(IXenConnection connection, XenServerPatch patch, Host host, List<PoolPatchMapping> mappings) : base(connection) { this.patch = patch; this.host = host; this.mappings = mappings; }
public ApplyXenServerPatchPlanAction(Host host, XenServerPatch xenServerPatch, List <PoolPatchMapping> mappings) : base(host.Connection, string.Format(Messages.UPDATES_WIZARD_APPLYING_UPDATE, xenServerPatch.Name, host.Name)) { this.host = host; this.xenServerPatch = xenServerPatch; this.mappings = mappings; }
public RemoveUpdateFileFromMasterPlanAction(Host master, List <PoolPatchMapping> patchMappings, XenServerPatch patch) : base(master.Connection, string.Format(Messages.UPDATES_WIZARD_REMOVING_UPDATES_FROM_POOL, master.Name)) { this.patchMappings = patchMappings; this.patch = patch; this.master = master; }
public void TestAlertWithConnectionAndHosts() { XenServerPatch p = new XenServerPatch("uuid", "name", "My description", "guidance", "6.0.1", "http://url", "http://patchUrl", new DateTime(2011, 4, 1).ToString(), ""); XenServerPatchAlert alert = new XenServerPatchAlert(p); alert.IncludeConnection(connA.Object); alert.IncludeConnection(connB.Object); alert.IncludeHosts(new List<Host>() { hostA.Object, hostB.Object }); IUnitTestVerifier validator = new VerifyGetters(alert); validator.Verify(new AlertClassUnitTestData { AppliesTo = "HostAName, HostBName, ConnAName, ConnBName", FixLinkText = "Go to Web Page", HelpID = "XenServerPatchAlert", Description = "My description", HelpLinkText = "Help", Title = "New Update Available - name", Priority = "Priority2" }); Assert.IsFalse(alert.CanIgnore); VerifyConnExpectations(Times.Once); VerifyHostsExpectations(Times.Once); }
public void TestAlertWithHostsAndNoConnection() { XenServerPatch p = new XenServerPatch("uuid", "name", "My description", "guidance", "6.0.1", "http://url", "http://patchUrl", new DateTime(2011, 4, 1).ToString(), "1"); XenServerPatchAlert alert = new XenServerPatchAlert(p); alert.IncludeHosts(new List <Host>() { hostA.Object, hostB.Object }); IUnitTestVerifier validator = new VerifyGetters(alert); validator.Verify(new AlertClassUnitTestData { AppliesTo = "HostAName, HostBName", FixLinkText = "Go to Web Page", HelpID = "XenServerPatchAlert", Description = "My description", HelpLinkText = "Help", Title = "New Update Available - name", Priority = "Priority1" }); Assert.IsFalse(alert.CanIgnore); VerifyConnExpectations(Times.Never); VerifyHostsExpectations(Times.Once); }
public RemoveUpdateFileFromMasterPlanAction(Host master, List <HostUpdateMapping> patchMappings, XenServerPatch xenServerPatch) : base(master.Connection) { this.patchMappings = patchMappings; this.xenServerPatch = xenServerPatch; this.master = master; }
public PatchPrechecksOnMultipleHostsInAPoolPlanAction(IXenConnection connection, XenServerPatch patch, List <Host> hosts, List <PoolPatchMapping> mappings) : base(connection, string.Format(Messages.UPDATES_WIZARD_RUNNING_PRECHECK, patch.Name, connection.Name)) { this.patch = patch; this.hosts = hosts; this.mappings = mappings; }
public PatchPrechecksOnMultipleHostsInAPoolPlanAction(IXenConnection connection, XenServerPatch patch, List<Host> hosts, List<PoolPatchMapping> mappings) : base(connection, string.Format("Precheck for {0} in {1}...", patch.Name, connection.Name)) { this.patch = patch; this.hosts = hosts; this.mappings = mappings; }
public ApplyXenServerPatchPlanAction(Host host, XenServerPatch xenServerPatch, List<PoolPatchMapping> mappings) : base(host.Connection, string.Format(Messages.UPDATES_WIZARD_APPLYING_UPDATE, xenServerPatch.Name, host.Name)) { this.host = host; this.xenServerPatch = xenServerPatch; this.mappings = mappings; }
public UploadPatchToMasterPlanAction(IXenConnection connection, XenServerPatch patch, List <PoolPatchMapping> mappings, Dictionary <XenServerPatch, string> allDownloadedPatches) : base(connection, string.Format("Uploading update {0} to {1}...", patch.Name, connection.Name)) { this.patch = patch; this.mappings = mappings; this.AllDownloadedPatches = allDownloadedPatches; }
public PatchPrechecksOnMultipleHostsInAPoolPlanAction(IXenConnection connection, XenServerPatch patch, List <Host> hosts, List <PoolPatchMapping> mappings) : base(connection, string.Format("Precheck for {0} in {1}...", patch.Name, connection.Name)) { this.patch = patch; this.hosts = hosts; this.mappings = mappings; }
public XenServerPatchAlert(XenServerPatch patch) { Patch = patch; _priority = patch.Priority; _timestamp = Patch.TimeStamp; canIgnore = true; }
public DownloadPatchPlanAction(IXenConnection connection, XenServerPatch patch, Dictionary <XenServerPatch, string> allDownloadedPatches, KeyValuePair <XenServerPatch, string> patchFromDisk) : base(connection, string.Format(Messages.PATCHINGWIZARD_DOWNLOADUPDATE_ACTION_TITLE_WAITING, patch.Name)) { this.patch = patch; this.AllDownloadedPatches = allDownloadedPatches; this.patchFromDisk = patchFromDisk; }
public ApplyXenServerPatchPlanAction(Host host, XenServerPatch xenServerPatch, List <HostUpdateMapping> mappings) : base(host.Connection) { this.host = host; this.xenServerPatch = xenServerPatch; this.mappings = mappings; }
public DownloadPatchPlanAction(IXenConnection connection, XenServerPatch patch, Dictionary <XenServerPatch, string> allDownloadedPatches, KeyValuePair <XenServerPatch, string> patchFromDisk) : base(connection) { this.patch = patch; this.AllDownloadedPatches = allDownloadedPatches; this.patchFromDisk = patchFromDisk; }
public UploadPatchToMasterPlanAction(IXenConnection connection, XenServerPatch patch, List <PoolPatchMapping> mappings, Dictionary <XenServerPatch, string> allDownloadedPatches, KeyValuePair <XenServerPatch, string> patchFromDisk) : base(connection) { this.patch = patch; this.mappings = mappings; this.AllDownloadedPatches = allDownloadedPatches; this.patchFromDisk = patchFromDisk; }
public PatchPrecheckOnHostPlanAction(IXenConnection connection, XenServerPatch patch, Host host, List <PoolPatchMapping> mappings, List <string> hostsThatWillRequireReboot) : base(connection) { this.patch = patch; this.host = host; this.mappings = mappings; this.hostsThatWillRequireReboot = hostsThatWillRequireReboot; }
public PatchPrecheckOnHostPlanAction(IXenConnection connection, XenServerPatch xenServerPatch, Host host, List <HostUpdateMapping> mappings, List <string> hostsThatWillRequireReboot, Dictionary <string, List <string> > livePatchAttempts) : base(connection) { this.xenServerPatch = xenServerPatch; this.host = host; this.mappings = mappings; this.hostsThatWillRequireReboot = hostsThatWillRequireReboot; this.livePatchAttempts = livePatchAttempts; }
/// <summary> /// Creates a patch alert /// </summary> /// <param name="patch">The patch</param> /// <param name="newServerVersion">The version that the patch installs, or null if the patch doesn't update the server version</param> public XenServerPatchAlert(XenServerPatch patch, XenServerVersion newServerVersion = null) { Patch = patch; NewServerVersion = newServerVersion; if (NewServerVersion != null) { RequiredXenCenterVersion = Updates.GetRequiredXenCenterVersion(NewServerVersion); } _priority = patch.Priority; _timestamp = Patch.TimeStamp; }
public ApplyXenServerPatchPlanAction(Host host, XenServerPatch xenServerPatch, List <PoolPatchMapping> mappings) : base(host.Connection, string.Format(Messages.UPDATES_WIZARD_APPLYING_UPDATE, xenServerPatch.Name, host.Name())) { this.host = host; this.xenServerPatch = xenServerPatch; this.mappings = mappings; var master = Helpers.GetMaster(host.Connection); this.masterUuid = master.uuid; }
public ApplyXenServerPatchPlanAction(Host host, XenServerPatch xenServerPatch, List <PoolPatchMapping> mappings) : base(host.Connection) { this.host = host; this.xenServerPatch = xenServerPatch; this.mappings = mappings; var master = Helpers.GetMaster(host.Connection); this.masterUuid = master.uuid; }
public UploadPatchToMasterPlanAction(Control invokingControl, IXenConnection connection, XenServerPatch xenServerPatch, List <HostUpdateMapping> mappings, Dictionary <XenServerPatch, string> allDownloadedPatches, KeyValuePair <XenServerPatch, string> patchFromDisk, bool skipDiskSpaceCheck = false) : base(connection) { this.invokingControl = invokingControl; this.xenServerPatch = xenServerPatch; this.mappings = mappings; AllDownloadedPatches = allDownloadedPatches; this.patchFromDisk = patchFromDisk; this.skipDiskSpaceCheck = skipDiskSpaceCheck; }
private List <PlanAction> GetMandatoryActionListForPatch(Host host, XenServerPatch patch) { var actions = new List <PlanAction>(); if (!patch.GuidanceMandatory) { return(actions); } actions = GetAfterApplyGuidanceActionsForPatch(host, patch); return(actions); }
public PoolPatchMapping(XenServerPatch xenServerPatch, Pool_patch pool_patch, Host masterHost) { if (xenServerPatch == null) throw new ArgumentNullException("xenServerPatch"); if (pool_patch == null) throw new ArgumentNullException("pool_patch"); if (masterHost == null) throw new ArgumentNullException("masterHost"); this.XenServerPatch = xenServerPatch; this.Pool_patch = pool_patch; this.MasterHost = masterHost; }
private static List <XenServerVersion> GetAVersionWithGivenNumberOfPatches(int numberOfPatches) { var serverVersions = new List <XenServerVersion>(); var version = new XenServerVersion("7.0.0", "XenServer Test 7", true, false, "", new List <XenServerPatch>(), new List <XenServerPatch>(), DateTime.MinValue.ToString(), "buildNo", "", false, ""); for (int ii = 0; ii < numberOfPatches; ii++) { var patch = new XenServerPatch("patch_uuid_" + ii, "patch name " + ii, "patch description" + ii, "", "", "1.0", "", "", "1970-01-01T00:00:00Z", "", "1000", "1000"); version.Patches.Add(patch); version.MinimalPatches.Add(patch); } serverVersions.Add(version); return(serverVersions); }
private List <Pool_patch> GenerateMockPoolPatches(List <XenServerPatch> xenServerPatches) { List <Pool_patch> patches = new List <Pool_patch>(); foreach (string installedHotfix in InstalledHotfixes) { string hotfix = installedHotfix; XenServerPatch match = xenServerPatches.Find(m => m.Name.Contains(hotfix)); if (match == null) { throw new CFUValidationException("No patch could be found in the XML matching " + hotfix); } Mock <Pool_patch> pp = mom.NewXenObject <Pool_patch>(id); pp.Setup(p => p.uuid).Returns(match.Uuid); patches.Add(pp.Object); } return(patches); }
public void TestAlertWithNoConnectionAndNoHosts() { XenServerPatch p = new XenServerPatch("uuid", "name", "My description", "guidance", string.Empty, "6.0.1", "http://url", "http://patchUrl", new DateTime(2011, 4, 1).ToString(), "5", "", ""); XenServerPatchAlert alert = new XenServerPatchAlert(p); ClassVerifiers.VerifyGetters(alert, new AlertClassUnitTestData { AppliesTo = string.Empty, FixLinkText = "Go to Web Page", HelpID = "XenServerPatchAlert", Description = "My description", HelpLinkText = "Help", Title = "New Update Available - name", Priority = "Priority5" }); Assert.IsTrue(alert.CanIgnore); VerifyConnExpectations(Times.Never); VerifyHostsExpectations(Times.Never); }
public PoolPatchMapping(XenServerPatch xenServerPatch, Pool_patch pool_patch, Host masterHost) { if (xenServerPatch == null) { throw new ArgumentNullException("xenServerPatch"); } if (pool_patch == null) { throw new ArgumentNullException("pool_patch"); } if (masterHost == null) { throw new ArgumentNullException("masterHost"); } this.XenServerPatch = xenServerPatch; this.Pool_patch = pool_patch; this.MasterHost = masterHost; }
public bool Matches(Host masterHost, XenServerPatch xenServerPatch) { return(Matches(masterHost) && XenServerPatch.Equals(xenServerPatch)); }
protected XenServerPatchMapping(XenServerPatch xenServerPatch, Host masterHost) : base(masterHost) { XenServerPatch = xenServerPatch ?? throw new ArgumentNullException("xenServerPatch"); }
public bool Matches(Host masterHost, XenServerPatch xenServerPatch, Pool_update update) { return(Matches(masterHost, xenServerPatch) && update != null && string.Equals(update.uuid, Pool_update.uuid, StringComparison.OrdinalIgnoreCase)); }
public void TestAlertWithNoConnectionAndNoHosts() { XenServerPatch p = new XenServerPatch("uuid", "name", "My description", "guidance", "6.0.1", "http://url", "http://patchUrl", new DateTime(2011, 4, 1).ToString(), "5"); XenServerPatchAlert alert = new XenServerPatchAlert(p); IUnitTestVerifier validator = new VerifyGetters(alert); validator.Verify(new AlertClassUnitTestData { AppliesTo = string.Empty, FixLinkText = "Go to Web Page", HelpID = "XenServerPatchAlert", Description = "My description", HelpLinkText = "Help", Title = "New Update Available - name", Priority = "Priority5" }); Assert.IsTrue(alert.CanIgnore); VerifyConnExpectations(Times.Never); VerifyHostsExpectations(Times.Never); }
private static XenServerPatchAlert GetServerPatchAlert(List<XenServerPatchAlert> alerts, XenServerPatch patch) { XenServerPatchAlert alert = new XenServerPatchAlert(patch); XenServerPatchAlert existingAlert = alerts.Find(al => al.Equals(alert)); if (existingAlert != null) alert = existingAlert; else alerts.Add(alert); return alert; }
private List<PlanAction> GetMandatoryActionListForPatch(List<PlanAction> delayedGuidances, Host host, XenServerPatch patch) { var actions = new List<PlanAction>(); if (!patch.GuidanceMandatory) return actions; actions = GetAfterApplyGuidanceActionsForPatch(host, patch); return actions; }
private void UpdateDelayedAfterPatchGuidanceActionListForHost(List<PlanAction> delayedGuidances, Host host, XenServerPatch patch) { List<PlanAction> actions = GetAfterApplyGuidanceActionsForPatch(host, patch); //if this is a restart, clean delayed list if (patch.after_apply_guidance == after_apply_guidance.restartHost) delayedGuidances.Clear(); if (!patch.GuidanceMandatory) { //not mandatory, so these actions will have to be run later //add the ones that are not yet there foreach (var ap in actions) if (!delayedGuidances.Any(da => da.GetType() == ap.GetType())) { //special rules //do not add restartXAPI if there is already a restartHost on the list if (delayedGuidances.Any(da => da is RebootHostPlanAction) && ap is RestartAgentPlanAction) continue; delayedGuidances.Add(ap); } } else { //remove delayed action of the same kind for this host (because it is mandatory and will run immediately) delayedGuidances.RemoveAll(dg => actions.Any(ma => ma.GetType() == dg.GetType())); } }
private static List<XenServerVersion> GetAVersionWithGivenNumberOfPatches(int numberOfPatches) { var serverVersions = new List<XenServerVersion>(); var version = new XenServerVersion("7.0.0", "XenServer Test 7", true, "", new List<XenServerPatch>(), new List<XenServerPatch>(), DateTime.MinValue.ToString(), "buildNo"); for (int ii = 0; ii < numberOfPatches; ii++) { var patch = new XenServerPatch("patch_uuid_" + ii, "patch name " + ii, "patch description" + ii, "", "", "1.0", "", "", "1970-01-01T00:00:00Z", "", "1000"); version.Patches.Add(patch); version.MinimalPatches.Add(patch); } serverVersions.Add(version); return serverVersions; }
public PoolPatchMapping(XenServerPatch xenServerPatch, Pool_patch pool_patch, Host masterHost) : base(xenServerPatch, masterHost) { Pool_patch = pool_patch ?? throw new ArgumentNullException("pool_patch"); }
protected override void Run() { this.Description = Messages.AVAILABLE_UPDATES_SEARCHING; XmlDocument xdoc = FetchCheckForUpdatesXml(UpdateXmlUrl); // XenCenter Versions foreach (XmlNode versions in xdoc.GetElementsByTagName(XenCenterVersionsNode)) { foreach (XmlNode version in versions.ChildNodes) { string version_lang = ""; string name = ""; bool is_latest = false; string url = ""; string timestamp = ""; foreach (XmlAttribute attrib in version.Attributes) { if (attrib.Name == "value") { version_lang = attrib.Value; } else if (attrib.Name == "name") { name = attrib.Value; } else if (attrib.Name == "latest") { is_latest = attrib.Value.ToUpperInvariant() == bool.TrueString.ToUpperInvariant(); } else if (attrib.Name == "url") { url = attrib.Value; } else if (attrib.Name == "timestamp") { timestamp = attrib.Value; } } XenCenterVersions.Add(new XenCenterVersion(version_lang, name, is_latest, url, timestamp)); } } // Patches foreach (XmlNode versions in xdoc.GetElementsByTagName(PatchesNode)) { foreach (XmlNode version in versions.ChildNodes) { string uuid = ""; string name = ""; string description = ""; string guidance = ""; string patchVersion = ""; string url = ""; string patchUrl = ""; string timestamp = ""; string priority = ""; foreach (XmlAttribute attrib in version.Attributes) { if (attrib.Name == "uuid") { uuid = attrib.Value; } else if (attrib.Name == "name-label") { name = attrib.Value; } else if (attrib.Name == "name-description") { description = attrib.Value; } else if (attrib.Name == "after-apply-guidance") { guidance = attrib.Value; } else if (attrib.Name == "version") { patchVersion = attrib.Value; } else if (attrib.Name == "url") { url = attrib.Value; } else if (attrib.Name == "patch-url") { patchUrl = attrib.Value; } else if (attrib.Name == "timestamp") { timestamp = attrib.Value; } else if (attrib.Name == "priority") { priority = attrib.Value; } } XenServerPatches.Add(new XenServerPatch(uuid, name, description, guidance, patchVersion, url, patchUrl, timestamp, priority)); } } // XenServer Versions foreach (XmlNode versions in xdoc.GetElementsByTagName(XenServerVersionsNode)) { foreach (XmlNode version in versions.ChildNodes) { string version_oem = ""; string name = ""; bool is_latest = false; string url = ""; string timestamp = ""; string buildNumber = ""; foreach (XmlAttribute attrib in version.Attributes) { if (attrib.Name == "value") { version_oem = attrib.Value; } else if (attrib.Name == "name") { name = attrib.Value; } else if (attrib.Name == "latest") { is_latest = attrib.Value.ToUpperInvariant() == bool.TrueString.ToUpperInvariant(); } else if (attrib.Name == "url") { url = attrib.Value; } else if (attrib.Name == "timestamp") { timestamp = attrib.Value; } else if (attrib.Name == "build-number") { buildNumber = attrib.Value; } } List <XenServerPatch> patches = new List <XenServerPatch>(); foreach (XmlNode childnode in version.ChildNodes) { if (childnode.Name != "patch") { continue; } XenServerPatch patch = XenServerPatches.Find(new Predicate <XenServerPatch>(delegate(XenServerPatch item) { return(item.Uuid == childnode.Attributes["uuid"].Value); })); if (patch == null) { continue; } patches.Add(patch); } XenServerVersions.Add(new XenServerVersion(version_oem, name, is_latest, url, patches, timestamp, buildNumber)); } } }
private static List<PlanAction> GetAfterApplyGuidanceActionsForPatch(Host host, XenServerPatch patch) { List<PlanAction> actions = new List<PlanAction>(); List<XenRef<VM>> runningVMs = RunningVMs(host); if (patch.after_apply_guidance == after_apply_guidance.restartHost) { actions.Add(new EvacuateHostPlanAction(host)); actions.Add(new RebootHostPlanAction(host)); actions.Add(new BringBabiesBackAction(runningVMs, host, false)); } if (patch.after_apply_guidance == after_apply_guidance.restartXAPI) { actions.Add(new RestartAgentPlanAction(host)); } if (patch.after_apply_guidance == after_apply_guidance.restartHVM) { actions.Add(new RebootVMsPlanAction(host, RunningHvmVMs(host))); } if (patch.after_apply_guidance == after_apply_guidance.restartPV) { actions.Add(new RebootVMsPlanAction(host, RunningPvVMs(host))); } return actions; }
public IgnorePatchAction(IXenConnection connection, XenServerPatch patch) : base(connection, "ignore_patch", "ignore_patch", true) { Patch = patch; }
public DownloadPatchPlanAction(IXenConnection connection, XenServerPatch patch, Dictionary<XenServerPatch, string> allDownloadedPatches) : base(connection, string.Format(Messages.PATCHINGWIZARD_DOWNLOADUPDATE_ACTION_TITLE_WAITING, patch.Name)) { this.patch = patch; this.AllDownloadedPatches = allDownloadedPatches; }