本文整理匯總了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;
}