diff --git a/XenAdmin/Alerts/Types/LicenseAlert.cs b/XenAdmin/Alerts/Types/LicenseAlert.cs
index 8d3af4458..4a2117e2d 100644
--- a/XenAdmin/Alerts/Types/LicenseAlert.cs
+++ b/XenAdmin/Alerts/Types/LicenseAlert.cs
@@ -52,6 +52,7 @@ namespace XenAdmin.Alerts
hostName = hostname;
nowDate = now;
expiryDate = expiry;
+ _timestamp = now;
}
public LicenseManagerLauncher LicenseManagerLauncher { get; set; }
@@ -67,6 +68,9 @@ namespace XenAdmin.Alerts
{
get
{
+ if (expiryDate < nowDate)
+ return string.Format(Messages.MAINWINDOW_EXPIRE_MESSAGE_TOO_LATE, hostName.Ellipsise(25));
+
string timeleft = GetLicenseTimeLeftString(expiryDate.Subtract(nowDate), false);
return string.Format(Messages.MAINWINDOW_EXPIRE_MESSAGE, hostName.Ellipsise(25), timeleft);
}
@@ -74,7 +78,12 @@ namespace XenAdmin.Alerts
public override AlertPriority Priority
{
- get { return AlertPriority.Priority3; }
+ get
+ {
+ return expiryDate < nowDate
+ ? AlertPriority.Priority2
+ : AlertPriority.Priority3;
+ }
}
public override string AppliesTo
diff --git a/XenAdmin/LicenseTimer.cs b/XenAdmin/LicenseTimer.cs
index 559a29e86..8bccb3f53 100644
--- a/XenAdmin/LicenseTimer.cs
+++ b/XenAdmin/LicenseTimer.cs
@@ -90,10 +90,7 @@ namespace XenAdmin
if (expiryDate < now)
{
// License has expired. Pop up the License Manager.
- Program.Invoke(Program.MainWindow, delegate()
- {
- showLicenseSummaryExpired(host, expiryDate);
- });
+ Program.Invoke(Program.MainWindow, () => showLicenseSummaryExpired(host, now, expiryDate));
return true;
}
if (timeToExpiry < CONNECTION_WARN_THRESHOLD &&
@@ -103,10 +100,7 @@ namespace XenAdmin
// If it's a periodic check, only warn if XC has been open for one day
if (periodicCheck)
lastPeriodicLicenseWarning = DateTime.UtcNow;
- Program.Invoke(Program.MainWindow, delegate()
- {
- showLicenseSummaryWarning(Helpers.GetName(host), now, expiryDate);
- });
+ Program.Invoke(Program.MainWindow, () => showLicenseSummaryWarning(Helpers.GetName(host), now, expiryDate));
return true;
}
}
@@ -154,12 +148,19 @@ namespace XenAdmin
/// Shows the license summary dialog to the user as their license has expired.
///
///
+ ///
/// Should be expressed in local time.
- private void showLicenseSummaryExpired(Host host, DateTime expiryDate)
+ private void showLicenseSummaryExpired(Host host, DateTime now, DateTime expiryDate)
{
Program.AssertOnEventThread();
- log.InfoFormat("Server {0} has expired ({1}). Show License Summary if needed", host.Name, HelpersGUI.DateTimeToString(expiryDate, Messages.DATEFORMAT_DMY_HMS, true));
+ log.InfoFormat("Server {0} has expired ({1}). Show License Summary if needed",
+ host.Name,
+ HelpersGUI.DateTimeToString(expiryDate, Messages.DATEFORMAT_DMY_HMS, true));
+
+ var alert = new LicenseAlert(host.Name, now, expiryDate) { LicenseManagerLauncher = licenseManagerLauncher };
+ Alert.AddAlert(alert);
+
if (Program.RunInAutomatedTestMode)
log.DebugFormat("In automated test mode: quashing license expiry warning");
else
diff --git a/XenModel/Messages.Designer.cs b/XenModel/Messages.Designer.cs
index a734eeb2a..e1abeafb6 100644
--- a/XenModel/Messages.Designer.cs
+++ b/XenModel/Messages.Designer.cs
@@ -6085,7 +6085,7 @@ namespace XenAdmin {
return ResourceManager.GetString("CHECKING_VMPR_STATUS", resourceCulture);
}
}
-
+
///
/// Looks up a localized string similar to Checking the possible presence of WSS appliances.
///
@@ -8723,7 +8723,7 @@ namespace XenAdmin {
return ResourceManager.GetString("DEBIAN_SARGE_31", resourceCulture);
}
}
-
+
///
/// Looks up a localized string similar to Disconnecting Workload Balancing..
///
@@ -18486,6 +18486,15 @@ namespace XenAdmin {
}
}
+ ///
+ /// Looks up a localized string similar to The XenServer license on '{0}' has expired..
+ ///
+ public static string MAINWINDOW_EXPIRE_MESSAGE_TOO_LATE {
+ get {
+ return ResourceManager.GetString("MAINWINDOW_EXPIRE_MESSAGE_TOO_LATE", resourceCulture);
+ }
+ }
+
///
/// Looks up a localized string similar to &Export to File....
///
@@ -26588,7 +26597,7 @@ namespace XenAdmin {
return ResourceManager.GetString("RPU_WIZARD_VMPR_VMPP_DEPRECATION", resourceCulture);
}
}
-
+
///
/// Looks up a localized string similar to '{0}': The use of WSS servers has been removed in XenServer 6.2.
///
diff --git a/XenModel/Messages.resx b/XenModel/Messages.resx
index 801dcee0b..57e26ad2c 100644
--- a/XenModel/Messages.resx
+++ b/XenModel/Messages.resx
@@ -6445,6 +6445,9 @@ This will permanently delete and reinitialize all local storage on the servers.
The XenServer license on '{0}' will expire in {1}.
+
+ The XenServer license on '{0}' has expired.
+
&Export to File...