Пример #1
0
        public static void CheckHotfixEligibility()
        {
            var alerts = new List <HotfixEligibilityAlert>();

            foreach (var connection in ConnectionsManager.XenConnectionsCopy)
            {
                if (!connection.IsConnected)
                {
                    continue;
                }

                var master = Helpers.GetMaster(connection);
                if (master == null)
                {
                    continue;
                }

                var hotfixEligibility = HotfixEligibility(master, out var xenServerVersion);
                if (!HotfixEligibilityAlert.IsAlertNeeded(hotfixEligibility, xenServerVersion, !master.IsFreeLicenseOrExpired()))
                {
                    continue;
                }

                alerts.Add(new HotfixEligibilityAlert(connection, xenServerVersion));
            }

            Alert.RemoveAlert(a => a is HotfixEligibilityAlert);
            Alert.AddAlertRange(alerts);
        }
Пример #2
0
        public static void CheckHotfixEligibility(IXenConnection connection)
        {
            var master = Helpers.GetMaster(connection);

            if (master == null)
            {
                return;
            }

            var hotfixEligibility = HotfixEligibility(master, out var xenServerVersion);

            if (!HotfixEligibilityAlert.IsAlertNeeded(hotfixEligibility, xenServerVersion, !master.IsFreeLicenseOrExpired()))
            {
                Alert.RemoveAlert(a => a is HotfixEligibilityAlert && connection.Equals(a.Connection));
                return;
            }

            var alertIndex = Alert.FindAlertIndex(a => a is HotfixEligibilityAlert alert && connection.Equals(alert.Connection) && xenServerVersion == alert.Version);

            if (alertIndex == -1)
            {
                Alert.RemoveAlert(a => a is HotfixEligibilityAlert && connection.Equals(a.Connection)); // ensure that there is no other alert for this connection
                Alert.AddAlert(new HotfixEligibilityAlert(connection, xenServerVersion));
            }
            else
            {
                Alert.RefreshAlertAt(alertIndex);
            }
        }