mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2025-01-20 07:19:18 +01:00
CA-122558: Generate a license alert when the license status is expired. Fixed incorrect
timestamp for both license expiring and license expired alerts. Indentation. Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
This commit is contained in:
parent
572125c5be
commit
60bf086b3b
@ -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
|
||||
|
@ -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.
|
||||
/// </summary>
|
||||
/// <param name="host"></param>
|
||||
/// <param name="now"></param>
|
||||
/// <param name="expiryDate">Should be expressed in local time.</param>
|
||||
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
|
||||
|
15
XenModel/Messages.Designer.cs
generated
15
XenModel/Messages.Designer.cs
generated
@ -6085,7 +6085,7 @@ namespace XenAdmin {
|
||||
return ResourceManager.GetString("CHECKING_VMPR_STATUS", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Checking the possible presence of WSS appliances.
|
||||
/// </summary>
|
||||
@ -8723,7 +8723,7 @@ namespace XenAdmin {
|
||||
return ResourceManager.GetString("DEBIAN_SARGE_31", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Disconnecting Workload Balancing..
|
||||
/// </summary>
|
||||
@ -18486,6 +18486,15 @@ namespace XenAdmin {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to The XenServer license on '{0}' has expired..
|
||||
/// </summary>
|
||||
public static string MAINWINDOW_EXPIRE_MESSAGE_TOO_LATE {
|
||||
get {
|
||||
return ResourceManager.GetString("MAINWINDOW_EXPIRE_MESSAGE_TOO_LATE", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to &Export to File....
|
||||
/// </summary>
|
||||
@ -26588,7 +26597,7 @@ namespace XenAdmin {
|
||||
return ResourceManager.GetString("RPU_WIZARD_VMPR_VMPP_DEPRECATION", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to '{0}': The use of WSS servers has been removed in XenServer 6.2.
|
||||
/// </summary>
|
||||
|
@ -6445,6 +6445,9 @@ This will permanently delete and reinitialize all local storage on the servers.
|
||||
<data name="MAINWINDOW_EXPIRE_MESSAGE" xml:space="preserve">
|
||||
<value>The XenServer license on '{0}' will expire in {1}.</value>
|
||||
</data>
|
||||
<data name="MAINWINDOW_EXPIRE_MESSAGE_TOO_LATE" xml:space="preserve">
|
||||
<value>The XenServer license on '{0}' has expired.</value>
|
||||
</data>
|
||||
<data name="MAINWINDOW_EXPORT_TEMPLATE" xml:space="preserve">
|
||||
<value>&Export to File...</value>
|
||||
</data>
|
||||
|
Loading…
Reference in New Issue
Block a user