mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-23 12:30:50 +01:00
Further work on CA-380738: After updates are applied retrieve the new metadata from the host in order to refresh the server status.
Signed-off-by: Konstantina Chremmou <Konstantina.Chremmou@cloud.com>
This commit is contained in:
parent
81841c2a2b
commit
b32168d8d8
@ -120,22 +120,25 @@ namespace XenAdmin.Core
|
||||
CdnUpdateInfoChanged?.Invoke(connection);
|
||||
}
|
||||
|
||||
public static void CheckForCdnUpdates(IXenConnection connection)
|
||||
public static void CheckForCdnUpdates(IXenConnection connection, bool isPlanAction = false)
|
||||
{
|
||||
var pool = Helpers.GetPoolOfOne(connection);
|
||||
if (pool == null)
|
||||
return;
|
||||
|
||||
if (Helpers.XapiEqualOrGreater_23_18_0(connection))
|
||||
if (!isPlanAction)
|
||||
{
|
||||
if (pool.last_update_sync == Util.GetUnixMinDateTime() ||
|
||||
connection.Cache.Hosts.All(h => h.latest_synced_updates_applied == latest_synced_updates_applied_state.yes))
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pool.repositories.Count == 0)
|
||||
return;
|
||||
if (Helpers.XapiEqualOrGreater_23_18_0(connection))
|
||||
{
|
||||
if (pool.last_update_sync == Util.GetUnixMinDateTime() ||
|
||||
connection.Cache.Hosts.All(h => h.latest_synced_updates_applied == latest_synced_updates_applied_state.yes))
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pool.repositories.Count == 0)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!pool.allowed_operations.Contains(pool_allowed_operations.get_updates))
|
||||
@ -143,7 +146,11 @@ namespace XenAdmin.Core
|
||||
|
||||
var action = new CheckForCdnUpdatesAction(connection);
|
||||
action.Completed += CheckForCdnUpdatesAction_Completed;
|
||||
action.RunAsync();
|
||||
|
||||
if (isPlanAction)
|
||||
action.RunSync(action.Session);
|
||||
else
|
||||
action.RunAsync();
|
||||
}
|
||||
|
||||
private static void CheckForCdnUpdatesAction_Completed(ActionBase sender)
|
||||
|
@ -197,6 +197,7 @@ namespace XenAdmin.Wizards.PatchingWizard
|
||||
}
|
||||
|
||||
planActionsPerHost.Add(new ApplyCdnUpdatesPlanAction(host, poolUpdateInfo));
|
||||
delayedActionsPerHost.Add(new CheckForCdnUpdatesPlanAction(host.Connection));
|
||||
|
||||
return new HostPlan(host, null, planActionsPerHost, delayedActionsPerHost);
|
||||
}
|
||||
|
@ -30,6 +30,7 @@
|
||||
|
||||
using XenAdmin.Actions;
|
||||
using XenAdmin.Core;
|
||||
using XenAdmin.Network;
|
||||
using XenAPI;
|
||||
|
||||
|
||||
@ -62,4 +63,19 @@ namespace XenAdmin.Wizards.PatchingWizard.PlanActions
|
||||
new ApplyUpdatesFromCdnAction(host, _updateInfo).RunSync(session);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class CheckForCdnUpdatesPlanAction : PlanActionWithSession
|
||||
{
|
||||
public CheckForCdnUpdatesPlanAction(IXenConnection connection)
|
||||
: base(connection)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void RunWithSession(ref Session session)
|
||||
{
|
||||
AddProgressStep(string.Format(Messages.UPDATES_WIZARD_REFRESHING_CDN_UPDATES_LIST, Connection.Name));
|
||||
Updates.CheckForCdnUpdates(Connection, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
9
XenModel/Messages.Designer.cs
generated
9
XenModel/Messages.Designer.cs
generated
@ -38389,6 +38389,15 @@ namespace XenAdmin {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Refreshing the updates list for {0}... .
|
||||
/// </summary>
|
||||
public static string UPDATES_WIZARD_REFRESHING_CDN_UPDATES_LIST {
|
||||
get {
|
||||
return ResourceManager.GetString("UPDATES_WIZARD_REFRESHING_CDN_UPDATES_LIST", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Deleting update installation file {0} from {1}... .
|
||||
/// </summary>
|
||||
|
@ -13255,6 +13255,9 @@ Please check your settings and try again.</value>
|
||||
<data name="UPDATES_WIZARD_REBOOTING" xml:space="preserve">
|
||||
<value>Rebooting {0}...</value>
|
||||
</data>
|
||||
<data name="UPDATES_WIZARD_REFRESHING_CDN_UPDATES_LIST" xml:space="preserve">
|
||||
<value>Refreshing the updates list for {0}... </value>
|
||||
</data>
|
||||
<data name="UPDATES_WIZARD_REMOVING_UPDATE" xml:space="preserve">
|
||||
<value>Deleting update installation file {0} from {1}... </value>
|
||||
</data>
|
||||
|
Loading…
Reference in New Issue
Block a user