本文整理汇总了C#中XenAPI.Host.AppliedPatches方法的典型用法代码示例。如果您正苦于以下问题:C# Host.AppliedPatches方法的具体用法?C# Host.AppliedPatches怎么用?C# Host.AppliedPatches使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XenAPI.Host
的用法示例。
在下文中一共展示了Host.AppliedPatches方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckServerUpdates
/// <summary>
/// Checks the server has been restarted after any patches that require a restart were applied and returns a list of reboot warnings
/// </summary>
/// <param name="host"></param>
/// <returns></returns>
private List<KeyValuePair<String, String>> CheckServerUpdates(Host host)
{
List<Pool_patch> patches = host.AppliedPatches();
List<KeyValuePair<String, String>> warnings = new List<KeyValuePair<String, String>>();
double bootTime = host.BootTime;
double agentStart = host.AgentStartTime;
if (bootTime == 0.0 || agentStart == 0.0)
return warnings;
foreach (Pool_patch patch in patches)
{
double applyTime = Util.ToUnixTime(patch.AppliedOn(host));
if (patch.after_apply_guidance.Contains(after_apply_guidance.restartHost)
&& applyTime > bootTime)
{
//TODO: Could we come up with a better key string than foopatch on blahhost? Also needs i18
warnings.Add(new KeyValuePair<String, String>(
String.Format("{0} on {1}", patch.Name, host.Name),
String.Format(Messages.GENERAL_PANEL_UPDATE_WARNING, host.Name, patch.Name)));
}
else if (patch.after_apply_guidance.Contains(after_apply_guidance.restartXAPI)
&& applyTime > agentStart)
{
// Actually, it only needs xapi restart, but we have no UI to do that.
warnings.Add(new KeyValuePair<String, String>(
String.Format("{0} on {1}", patch.Name, host.Name),
String.Format(Messages.GENERAL_PANEL_UPDATE_WARNING, host.Name, patch.Name)));
}
}
return warnings;
}
示例2: isPatchApplied
private bool isPatchApplied(string uuid, Host host)
{
if (Helpers.ElyOrGreater(host))
{
return host.AppliedUpdates().Any(u => u != null && string.Equals(u.uuid, uuid, StringComparison.InvariantCultureIgnoreCase));
}
else
{
List<Pool_patch> hostPatches = host.AppliedPatches();
foreach (Pool_patch patch in hostPatches)
{
if (string.Equals(patch.uuid, uuid, StringComparison.OrdinalIgnoreCase))
{
return true;
}
}
}
return false;
}
示例3: hostAppliedPatches
private string hostAppliedPatches(Host host)
{
List<string> result = new List<string>();
foreach (Pool_patch patch in host.AppliedPatches())
result.Add(patch.Name);
result.Sort(StringUtility.NaturalCompare);
return string.Join("\n", result.ToArray());
}
示例4: isPatchApplied
private bool isPatchApplied(string uuid, Host host)
{
List<Pool_patch> hostPatches = host.AppliedPatches();
foreach (Pool_patch patch in hostPatches)
{
if (patch.uuid.Equals(uuid))
{
return true;
}
}
return false;
}
示例5: CheckServerUpdates
/// <summary>
/// Checks the server has been restarted after any patches that require a restart were applied and returns a list of reboot warnings
/// </summary>
/// <param name="host"></param>
/// <returns></returns>
private List<KeyValuePair<String, String>> CheckServerUpdates(Host host)
{
List<Pool_patch> patches = host.AppliedPatches();
List<KeyValuePair<String, String>> warnings = new List<KeyValuePair<String, String>>();
double bootTime = host.BootTime;
double agentStart = host.AgentStartTime;
if (bootTime == 0.0 || agentStart == 0.0)
return warnings;
foreach (Pool_patch patch in patches)
{
double applyTime = Util.ToUnixTime(patch.AppliedOn(host));
if (patch.after_apply_guidance.Contains(after_apply_guidance.restartHost) && applyTime > bootTime
|| patch.after_apply_guidance.Contains(after_apply_guidance.restartXAPI) && applyTime > agentStart)
{
warnings.Add(CreateWarningRow(host, patch));
}
}
return warnings;
}
示例6: CheckHostUpdatesRequiringReboot
/// <summary>
/// Creates a list of warnings for updates that require the host to be rebooted
/// </summary>
/// <param name="host"></param>
/// <returns></returns>
private List<KeyValuePair<String, String>> CheckHostUpdatesRequiringReboot(Host host)
{
var warnings = new List<KeyValuePair<String, String>>();
// Updates that require host restart
var updateRefs = host.updates_requiring_reboot;
foreach (var updateRef in updateRefs)
{
var update = host.Connection.Resolve(updateRef);
warnings.Add(CreateWarningRow(host, update));
}
// For Toolstack restart, legacy code has to be used to determine this - pool_patches are still populated for backward compatibility
List<Pool_patch> patches = host.AppliedPatches();
double bootTime = host.BootTime;
double agentStart = host.AgentStartTime;
if (bootTime == 0.0 || agentStart == 0.0)
return warnings;
foreach (Pool_patch patch in patches)
{
double applyTime = Util.ToUnixTime(patch.AppliedOn(host));
if (patch.after_apply_guidance.Contains(after_apply_guidance.restartXAPI)
&& applyTime > agentStart)
{
warnings.Add(CreateWarningRow(host, patch));
}
}
return warnings;
}
示例7: hostAppliedPatches
private string hostAppliedPatches(Host host)
{
List<string> result = new List<string>();
if (Helpers.ElyOrGreater(host))
{
foreach (var update in host.AppliedUpdates())
result.Add(update.Name);
}
else
{
foreach (Pool_patch patch in host.AppliedPatches())
result.Add(patch.Name);
}
result.Sort(StringUtility.NaturalCompare);
return string.Join("\n", result.ToArray());
}
示例8: isPatchApplied
private bool isPatchApplied(string uuid, Host host)
{
List<Pool_patch> hostPatches = host.AppliedPatches();
foreach (Pool_patch patch in hostPatches)
{
if (string.Equals(patch.uuid, uuid, StringComparison.OrdinalIgnoreCase))
{
return true;
}
}
return false;
}