mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2025-01-20 07:19:18 +01:00
CP-18014: Alter batch hotfixing to use host.patches_requiring_reboot
XenCenter will check host.patches_requiring_reboot when a host restart is due while a batch update is in progress. If the restart is not required, XenCenter will skip relevant PlanActions. The intention here is to check this whenever a restart is due according to the original schedule - this way a completely livepatchable update can prevent the restart while the key batch hotfixing logic is not changed. Signed-off-by: Gabor Apati-Nagy <gabor.apati-nagy@citrix.com>
This commit is contained in:
parent
0174974c93
commit
f55cf77c00
@ -53,6 +53,11 @@ namespace XenAdmin.Diagnostics.Checks
|
||||
|
||||
private readonly Dictionary<string, LivePatchCode> livePatchCodesByHost;
|
||||
|
||||
public PatchPrecheckCheck(Host host, Pool_patch patch)
|
||||
: this(host, patch, null)
|
||||
{
|
||||
}
|
||||
|
||||
public PatchPrecheckCheck(Host host, Pool_patch patch, Dictionary<string, LivePatchCode> livePatchCodesByHost)
|
||||
: base(host)
|
||||
{
|
||||
|
@ -302,7 +302,6 @@ namespace XenAdmin.Wizards.PatchingWizard
|
||||
Thread.Sleep(1000);
|
||||
|
||||
bgw.doneActions.Add(action);
|
||||
|
||||
bgw.ReportProgress((int)((1.0 / (double)bgw.AllActions.Count) * 100), action);
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -38,12 +38,13 @@ using XenAPI;
|
||||
|
||||
namespace XenAdmin.Wizards.PatchingWizard.PlanActions
|
||||
{
|
||||
public class BringBabiesBackAction : PlanActionWithSession
|
||||
public class BringBabiesBackAction : PlanActionWithSession, IAvoidRestartHostsAware
|
||||
{
|
||||
private readonly XenRef<Host> _host;
|
||||
private readonly Host currentHost;
|
||||
private readonly List<XenRef<VM>> _vms;
|
||||
private readonly bool _enableOnly = false;
|
||||
public List<string> AvoidRestartHosts { get; set; }
|
||||
|
||||
public BringBabiesBackAction(List<XenRef<VM>> vms, Host host,bool enableOnly)
|
||||
: base(host.Connection, string.Format(Messages.UPDATES_WIZARD_EXITING_MAINTENANCE_MODE,host.Name))
|
||||
@ -62,6 +63,14 @@ namespace XenAdmin.Wizards.PatchingWizard.PlanActions
|
||||
|
||||
protected override void RunWithSession(ref Session session)
|
||||
{
|
||||
if (Helpers.ElyOrGreater(currentHost) && AvoidRestartHosts != null && AvoidRestartHosts.Contains(currentHost.uuid))
|
||||
{
|
||||
visible = false;
|
||||
log.Debug("Skipped scheduled restart (livepatching succeeded), BringBabiesBackAction is skipped.");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Status = Messages.PLAN_ACTION_STATUS_RECONNECTING_STORAGE;
|
||||
PBD.CheckAndBestEffortPlugPBDsFor(Connection, _vms);
|
||||
|
||||
|
@ -29,15 +29,18 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using XenAdmin.Core;
|
||||
using XenAPI;
|
||||
|
||||
|
||||
namespace XenAdmin.Wizards.PatchingWizard.PlanActions
|
||||
{
|
||||
public class EvacuateHostPlanAction : PlanActionWithSession
|
||||
public class EvacuateHostPlanAction : PlanActionWithSession, IAvoidRestartHostsAware
|
||||
{
|
||||
private readonly XenRef<Host> _host;
|
||||
private readonly Host currentHost;
|
||||
public List<string> AvoidRestartHosts { get; set; }
|
||||
|
||||
public EvacuateHostPlanAction(Host host)
|
||||
: base(host.Connection, string.Format(Messages.PLANACTION_VMS_MIGRATING, host.Name))
|
||||
@ -56,6 +59,30 @@ namespace XenAdmin.Wizards.PatchingWizard.PlanActions
|
||||
{
|
||||
Host hostObject = TryResolveWithTimeout(_host);
|
||||
|
||||
if (Helpers.ElyOrGreater(hostObject))
|
||||
{
|
||||
log.DebugFormat("Checking host.patches_requiring_reboot now on '{0}'...", hostObject);
|
||||
|
||||
if (hostObject.patches_requiring_reboot.Count > 0)
|
||||
{
|
||||
AvoidRestartHosts.Remove(hostObject.uuid);
|
||||
|
||||
log.DebugFormat("Restart is needed now (hostObject.patches_requiring_reboot has {0} items in it). Evacuating now. Will restart after.", hostObject.patches_requiring_reboot.Count);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!AvoidRestartHosts.Contains(hostObject.uuid))
|
||||
{
|
||||
AvoidRestartHosts.Add(hostObject.uuid);
|
||||
}
|
||||
|
||||
this.visible = false;
|
||||
log.Debug("Will skip scheduled restart (livepatching succeeded), because hostObject.patches_requiring_reboot is empty.");
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
PBD.CheckAndPlugPBDsFor(Connection.ResolveAll(hostObject.resident_VMs));
|
||||
|
||||
log.DebugFormat("Disabling host {0}", hostObject.Name);
|
||||
|
@ -29,16 +29,19 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using XenAdmin.Core;
|
||||
using XenAdmin.Network;
|
||||
using XenAPI;
|
||||
|
||||
|
||||
namespace XenAdmin.Wizards.PatchingWizard.PlanActions
|
||||
{
|
||||
public class RebootHostPlanAction : RebootPlanAction
|
||||
public class RebootHostPlanAction : RebootPlanAction, IAvoidRestartHostsAware
|
||||
{
|
||||
|
||||
private readonly Host _host;
|
||||
public List<string> AvoidRestartHosts { get; set; }
|
||||
|
||||
public RebootHostPlanAction(Host host)
|
||||
: base(host.Connection, new XenRef<Host>(host.opaque_ref), string.Format(Messages.UPDATES_WIZARD_REBOOTING, host))
|
||||
@ -48,6 +51,16 @@ namespace XenAdmin.Wizards.PatchingWizard.PlanActions
|
||||
|
||||
protected override void RunWithSession(ref Session session)
|
||||
{
|
||||
if (Helpers.ElyOrGreater(_host))
|
||||
{
|
||||
if (AvoidRestartHosts != null && AvoidRestartHosts.Contains(_host.uuid))
|
||||
{
|
||||
visible = false;
|
||||
log.Debug("Skipping scheduled restart (livepatching succeeded). RebootHostPlanAction is skipped.");
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
_host.Connection.ExpectDisruption = true;
|
||||
try
|
||||
{
|
||||
|
@ -867,6 +867,7 @@
|
||||
<DependentUpon>PatchingWizard_UploadPage.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Wizards\PatchingWizard\PlanActions\ApplyXenServerPatchPlanAction.cs" />
|
||||
<Compile Include="Wizards\PatchingWizard\PlanActions\IAvoidRestartCapable.cs" />
|
||||
<Compile Include="Wizards\PatchingWizard\PlanActions\PatchPrechecksOnMultipleHostsAction.cs" />
|
||||
<Compile Include="Wizards\PatchingWizard\PlanActions\DownloadPatchPlanAction.cs" />
|
||||
<Compile Include="Wizards\PatchingWizard\PlanActions\UploadPatchToMasterPlanAction.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user