private void upgradeHostPlanAction_Timeout(object sender, EventArgs e) { var dialog = new NotModalThreeButtonDialog(SystemIcons.Exclamation, Messages.ROLLING_UPGRADE_TIMEOUT.Replace("\\n", "\n"), Messages.KEEP_WAITING_BUTTON_LABEL.Replace("\\n", "\n"), Messages.CANCEL); Program.Invoke(this, () => dialog.ShowDialog(this)); if (dialog.DialogResult != DialogResult.OK) // Cancel or Unknown { UpgradeHostPlanAction action = (UpgradeHostPlanAction)sender; action.Cancel(); } }
private void ManageSemiAutomaticPlanAction(UpgradeManualHostPlanAction planAction) { if (UpgradeStatus == RollingUpgradeStatus.Cancelled) { return; } var upgradeHostPlanAction = planAction; //Show dialog prepare host boot from CD or PXE boot and click OK to reboot string msg = string.Format(Messages.ROLLING_UPGRADE_REBOOT_MESSAGE, planAction.Host.Name()); UpgradeManualHostPlanAction action = upgradeHostPlanAction; Program.Invoke(this, () => { using (Dialog = new NotModalThreeButtonDialog(SystemIcons.Information, msg, Messages.REBOOT, Messages.SKIP_SERVER)) { Dialog.ShowDialog(this); if (Dialog.DialogResult != DialogResult.OK) // Cancel or Unknown { completedTitleLabel = Messages.ROLLING_UPGRADE_UPGRADE_NOT_COMPLETED; if (action.Host.IsMaster()) { throw new ApplicationException(Messages.EXCEPTION_USER_CANCELLED_MASTER); } throw new ApplicationException(Messages.EXCEPTION_USER_CANCELLED); } } }); string beforeRebootProductVersion = upgradeHostPlanAction.Host.LongProductVersion(); string hostName = upgradeHostPlanAction.Host.Name(); upgradeHostPlanAction.Timeout += new EventHandler(upgradeHostPlanAction_Timeout); try { do { if (UpgradeStatus == RollingUpgradeStatus.Cancelled) { break; } //Reboot with timeout of 20 min upgradeHostPlanAction.Run(); //if comes back and does not have a different product version if (Helpers.SameServerVersion(upgradeHostPlanAction.Host, beforeRebootProductVersion)) { using (var dialog = new NotModalThreeButtonDialog(SystemIcons.Exclamation, string.Format(Messages.ROLLING_UPGRADE_REBOOT_AGAIN_MESSAGE, hostName) , Messages.REBOOT_AGAIN_BUTTON_LABEL, Messages.SKIP_SERVER)) { Program.Invoke(this, () => dialog.ShowDialog(this)); if (dialog.DialogResult != DialogResult.OK) // Cancel or Unknown { throw new Exception(Messages.HOST_REBOOTED_SAME_VERSION); } else { upgradeHostPlanAction = new UpgradeManualHostPlanAction(upgradeHostPlanAction.Host); } } } } while (Helpers.SameServerVersion(upgradeHostPlanAction.Host, beforeRebootProductVersion)); } finally { upgradeHostPlanAction.Timeout -= new EventHandler(upgradeHostPlanAction_Timeout); } }
private void ManageSemiAutomaticPlanAction(object sender, ManageSemiAutomaticPlanActionArgs e) { if (UpgradeStatus == RollingUpgradeStatus.Cancelled) return; var upgradeHostPlanAction = e.Action; //Show dialog prepare host boot from CD or PXE boot and click OK to reboot string msg = string.Format(Messages.ROLLING_UPGRADE_REBOOT_MESSAGE, upgradeHostPlanAction.Host.Name); UpgradeManualHostPlanAction action = upgradeHostPlanAction; Program.Invoke(this, () => { using (Dialog = new NotModalThreeButtonDialog(SystemIcons.Information, msg, Messages.REBOOT, Messages.SKIP_SERVER)) { Dialog.ShowDialog(this); if (Dialog.DialogResult != DialogResult.OK) // Cancel or Unknown { completedTitleLabel = Messages.ROLLING_UPGRADE_UPGRADE_NOT_COMPLETED; if(action.Host.IsMaster()) throw new ApplicationException(Messages.EXCEPTION_USER_CANCELLED_MASTER); throw new ApplicationException(Messages.EXCEPTION_USER_CANCELLED); } } }); string beforeRebootProductVersion = upgradeHostPlanAction.Host.LongProductVersion; string hostName = upgradeHostPlanAction.Host.Name; upgradeHostPlanAction.Timeout += new EventHandler(upgradeHostPlanAction_Timeout); try { do { if (UpgradeStatus == RollingUpgradeStatus.Cancelled) break; //Reboot with timeout of 20 min upgradeHostPlanAction.Run(); //if comes back and does not have a different product version if (Helpers.SameServerVersion(upgradeHostPlanAction.Host, beforeRebootProductVersion)) { using (var dialog = new NotModalThreeButtonDialog(SystemIcons.Exclamation, string.Format(Messages.ROLLING_UPGRADE_REBOOT_AGAIN_MESSAGE, hostName) , Messages.REBOOT_AGAIN_BUTTON_LABEL, Messages.SKIP_SERVER)) { Program.Invoke(this, () => dialog.ShowDialog(this)); if (dialog.DialogResult != DialogResult.OK) // Cancel or Unknown throw new Exception(Messages.HOST_REBOOTED_SAME_VERSION); else upgradeHostPlanAction = new UpgradeManualHostPlanAction(upgradeHostPlanAction.Host); } } } while (Helpers.SameServerVersion(upgradeHostPlanAction.Host, beforeRebootProductVersion)); } finally { upgradeHostPlanAction.Timeout -= new EventHandler(upgradeHostPlanAction_Timeout); } }