当前位置: 首页>>代码示例>>C#>>正文


C# Host.AppliedPatches方法代码示例

本文整理汇总了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;
        }
开发者ID:robhoes,项目名称:xenadmin,代码行数:38,代码来源:GeneralTabPage.cs

示例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;
 }
开发者ID:ushamandya,项目名称:xenadmin,代码行数:19,代码来源:PatchingWizard_SelectServers.cs

示例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());
        }
开发者ID:robhoes,项目名称:xenadmin,代码行数:11,代码来源:GeneralTabPage.cs

示例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;
 }
开发者ID:slamj1,项目名称:xenadmin,代码行数:12,代码来源:PatchingWizard_SelectServers.cs

示例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;
        }
开发者ID:ushamandya,项目名称:xenadmin,代码行数:27,代码来源:GeneralTabPage.cs

示例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;
        }
开发者ID:ushamandya,项目名称:xenadmin,代码行数:38,代码来源:GeneralTabPage.cs

示例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());
        }
开发者ID:ushamandya,项目名称:xenadmin,代码行数:19,代码来源:GeneralTabPage.cs

示例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;
 }
开发者ID:robhoes,项目名称:xenadmin,代码行数:12,代码来源:PatchingWizard_SelectServers.cs


注:本文中的XenAPI.Host.AppliedPatches方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。