Example #1
0
        public override void PageLeave(PageLoadedDirection direction, ref bool cancel)
        {
            if (direction == PageLoadedDirection.Forward)
                CheckUniqueName(txtName.Text);

            base.PageLeave(direction, ref cancel);
        }
        public override void PageLoaded(PageLoadedDirection direction)
        {
            base.PageLoaded(direction);

            textBoxLog.Clear();

            switch (SelectedUpdateType)
            {
                case UpdateType.NewRetail:
                case UpdateType.Existing:
                    textBoxLog.Text = PatchingWizardModeGuidanceBuilder.ModeRetailPatch(SelectedServers, Patch);
                    AutomaticRadioButton.Enabled = true;
                    AutomaticRadioButton.Checked = true;
                    break;
                case UpdateType.NewSuppPack:
                    AutomaticRadioButton.Enabled = true;
                    AutomaticRadioButton.Checked = true;
                    textBoxLog.Text = PatchingWizardModeGuidanceBuilder.ModeSuppPack(SelectedServers);
                    break;
            }

            if (SelectedUpdateType == UpdateType.NewSuppPack || SelectedServers.Exists(server => !Helpers.ClearwaterOrGreater(server)))
            {
                removeUpdateFileCheckBox.Checked = false;
                removeUpdateFileCheckBox.Visible = false;
            }
        }
Example #3
0
		public override void PageLoaded(PageLoadedDirection direction)
		{
			base.PageLoaded(direction);
			SetAddButtonEnabledState();
			SetRemoveButtonEnabledState();
			SetViewButtonEnabledState();
		}
 public override void PageLoaded(PageLoadedDirection direction)
 {
     if (direction == PageLoadedDirection.Back)
     {
         RefreshRechecks();
         return;
     }
     var selectedMasters = new List<Host>(SelectedMasters);
     ManualUpgrade = ManualModeSelected;
     RemoveEventHandlersToMasters();
     SelectedServers.Clear();
     foreach (Host selectedMaster in selectedMasters)
     {
         Host master = selectedMaster;
         if (master != null)
         {
             Pool pool = Helpers.GetPoolOfOne(master.Connection);
             if (pool != null)
                 SelectedServers.AddRange(pool.HostsToUpgrade);
             else
                 SelectedServers.Add(master);
         }
     }
     AddEventHandlersToMasters();
     labelPrechecksFirstLine.Text = Messages.ROLLINGUPGRADE_PRECHECKS;
     RefreshRechecks();
     return;
 }
        public override void PageLeave(PageLoadedDirection direction, ref bool cancel)
        {
            if (direction == PageLoadedDirection.Forward)
            {
                if (!AllSelectedHostsConnected())
                {
                    dataGridView1.Invalidate();
                    cancel = true;
                    return;
                }

                foreach (var selectedMaster in SelectedMasters)
                {
                    if (!(selectedMaster.Connection.Session.IsLocalSuperuser || selectedMaster.Connection.Session.Roles.Any(role => role.name_label == Role.MR_ROLE_POOL_ADMIN)))
                    {
                        new ThreeButtonDialog(
                            new ThreeButtonDialog.Details(SystemIcons.Warning, string.Format(Messages.RBAC_UPGRADE_WIZARD_MESSAGE, selectedMaster.Connection.Username,
                                selectedMaster.Name), Messages.ROLLING_POOL_UPGRADE)).ShowDialog(this);
                        DeselectMaster(selectedMaster);
                        cancel = true;
                        return;
                    }
                }
            }
            base.PageLeave(direction, ref cancel);
        }
Example #6
0
		public override void PageLoaded(PageLoadedDirection direction)
		{
			base.PageLoaded(direction);//call first so the page gets populated

			if (direction == PageLoadedDirection.Forward)
				SetButtonNextEnabled(OkToProceed());
		}
Example #7
0
        public override void PageLoaded(PageLoadedDirection direction)
        {
            base.PageLoaded(direction);
            int alwaysRestartHighPriority = 0, alwaysRestart = 0, bestEffort = 0, doNotRestart = 0;
            foreach (VM.HA_Restart_Priority priority in RestartPriorities)
            {
                switch (priority)
                {
                    case VM.HA_Restart_Priority.AlwaysRestartHighPriority:
                        alwaysRestartHighPriority++;
                        break;
                    case VM.HA_Restart_Priority.AlwaysRestart:
                    case VM.HA_Restart_Priority.Restart:
                        alwaysRestart++;
                        break;
                    case VM.HA_Restart_Priority.BestEffort:
                        bestEffort++;
                        break;
                    case VM.HA_Restart_Priority.DoNotRestart:
                        doNotRestart++;
                        break;
                }
            }
            labelSummary.Text = String.Format(Messages.HAWIZ_SUMMARY_NEW,
                                                HeartbeatSrName.Ellipsise(50),
                                                Ntol,
                                                GetVmNumber(alwaysRestart),
                                                GetVmNumber(bestEffort),
                                                GetVmNumber(doNotRestart));

            // If the user hasn't protected any VMs, show a warning.
            labelNoVmsProtected.Visible = (bestEffort + alwaysRestart + alwaysRestartHighPriority == 0) && doNotRestart > 0;
            labelNoHaGuaranteed.Visible = Ntol == 0;
            pictureBox1.Visible = labelNoVmsProtected.Visible || labelNoHaGuaranteed.Visible;
        }
Example #8
0
        public override void PageLoaded(PageLoadedDirection direction)
        {
            base.PageLoaded(direction);

            if (direction == PageLoadedDirection.Forward)
                HelpersGUI.FocusFirstControl(Controls);
        }
        public override void PageLoaded(PageLoadedDirection direction)
        {
            base.PageLoaded(direction);
            
            canUpload = true;
            canDownload = true;
            UpdateButtons();

            if (SelectedUpdateType == UpdateType.Existing)
                _patch = SelectedExistingPatch;

            if (direction == PageLoadedDirection.Forward)           
            {
                flickerFreeListBox1.Items.Clear();
                var selectedPatch = SelectedUpdateAlert != null ? ((XenServerPatchAlert)SelectedUpdateAlert).Patch : null;
                if (selectedPatch != null && String.IsNullOrEmpty(SelectedNewPatchPath) &&
                    (!AllDownloadedPatches.Any(kvp => kvp.Key == selectedPatch.Uuid)
                        || String.IsNullOrEmpty(AllDownloadedPatches[selectedPatch.Uuid]) 
                        || !File.Exists(AllDownloadedPatches[selectedPatch.Uuid])))
                {
                    DownloadFile();
                    label2.Text = Messages.PATCHINGWIZARD_UPLOADPAGE_MESSAGE_DOWNLOAD_AND_UPLOAD;
                    pageTitle = Messages.PATCHINGWIZARD_UPLOADPAGE_TITLE_DOWNLOAD_AND_UPLOAD; 
                }
                else
                {
                    label2.Text = Messages.PATCHINGWIZARD_UPLOADPAGE_MESSAGE_ONLY_UPLOAD;
                    pageTitle = Messages.PATCHINGWIZARD_UPLOADPAGE_TITLE_ONLY_UPLOAD; 
                    if (selectedPatch != null && AllDownloadedPatches.ContainsKey(selectedPatch.Uuid))
                        SelectedNewPatchPath = AllDownloadedPatches[selectedPatch.Uuid];
                    PrepareUploadActions();
                    TryUploading();
                }
            }
        }
Example #10
0
        public override void PageLoaded(PageLoadedDirection direction)
        {
            base.PageLoaded(direction);
            VM template = SelectedTemplate;
            bool installMethodIsNetwork = SelectedInstallMethod == InstallMethod.Network;

            if (template == Template && InstallMethodIsNetwork == installMethodIsNetwork)
                return;

            Template = template;

            InstallMethodIsNetwork = installMethodIsNetwork;
            if ((!Template.DefaultTemplate && !Template.HasAtLeastOneDisk)
                || (Template.IsHVM && InstallMethodIsNetwork)) // CA-46213 The default should be "diskless" if the install method is "boot from network"
            {
                DisklessVMRadioButton.Checked = true;
            }
            else
                DisksRadioButton.Checked = true;
            DisksGridView.Rows.Clear();
            LoadDisks();
            UpdateEnablement();
            UpdateCloneCheckboxEnablement(true);
            DisksGridView.Select();
        }
Example #11
0
        public override void PageLoaded(PageLoadedDirection direction)
        {
            base.PageLoaded(direction);

            if (direction == PageLoadedDirection.Forward)
                RunAction(CapabilityList, SelectedHosts);
        }
Example #12
0
        public override void PageLoaded(PageLoadedDirection direction)
        {
            base.PageLoaded(direction);

            // if not using CD, use selected template storage host
            // if using CD use CD or template storage host);
           
           if (SelectedInstallMethod != InstallMethod.CD || SelectedCD == null)
            {
                if (SelectedTemplate == Template && CdAffinity == null)
                    return;

                CdAffinity = null;
                Template = SelectedTemplate;
                affinityPicker1.SetAffinity(Connection, Affinity, Template.GetStorageHost(true));
            }
            else
            {
                SR sr = Connection.Resolve(SelectedCD.SR);
                if (sr == null)
                    return;

                Host cdAffinity = sr.GetStorageHost();

                if (SelectedTemplate == Template && cdAffinity == CdAffinity)
                    return;

                Template = SelectedTemplate;
                CdAffinity = cdAffinity;

                affinityPicker1.SetAffinity(Connection, Affinity,
                                           CdAffinity ?? Template.GetStorageHost(false));
            }
            affinityPicker1.Select();
        }
Example #13
0
 public override void PageLeave(PageLoadedDirection direction, ref bool cancel)
 {
     if (direction == PageLoadedDirection.Forward)
         cancel = !Scan();
     
     base.PageLeave(direction, ref cancel);
 }
        public override void PageLoaded(PageLoadedDirection direction)
        {
            base.PageLoaded(direction);

            VM template = SelectedTemplate;
            
            if (!template.Equals(_template))
            {
                _template = template;
                ServersGridView.Rows.Clear();

                if (Helpers.MidnightRideOrGreater(Connection) && template.DefaultTemplate)
                {
                    List<Host> hosts = new List<Host>(Connection.Cache.Hosts);
                    hosts.Sort();
                    foreach (Host host in hosts)
                    {
                        ServerGridRow row = new ServerGridRow(host, false);
                        ServersGridView.Rows.Add(row);

                        if (host == _affinity)
                        {
                            row.Selected = true;
                        }
                    }
                }
                ServersGridView.Enabled = template.DefaultTemplate;
            }
        }
 public override void PageLoaded(PageLoadedDirection direction)
 {
     base.PageLoaded(direction);
     
     if (direction == PageLoadedDirection.Forward)
         SetupLabels();
 }
Example #16
0
		public override void PageLeave(PageLoadedDirection direction, ref bool cancel)
		{
			if (direction == PageLoadedDirection.Forward && IsDirty)
			{
				if (!PerformCheck(CheckValidData))
					cancel = true;
			}
			base.PageLeave(direction, ref cancel);
		}
 public override void PageLoaded(PageLoadedDirection direction)
 {
     base.PageLoaded(direction);
     if (direction == PageLoadedDirection.Forward)
     {
         labelFailoverDescription.Text = String.Format(labelFailoverDescription.Text, Connection.Name);
         labelDryrunDescription.Text = String.Format(labelDryrunDescription.Text, Connection.Name);
     }
 }
 public override void PageLeave(PageLoadedDirection direction, ref bool cancel)
 {
     UnregisterAllStatusUpdateActions();
     ImageAnimator.StopAnimate(animatedImage, onFrameChanged);
     if (direction == PageLoadedDirection.Back)
     {
         planActions.Clear();
     }
     base.PageLeave(direction, ref cancel);
 }
Example #19
0
        /// <summary>
        /// Always remember to call the base method in the BEGINNING when overriding this in derived classes
        /// so the page gets populated
        /// </summary>
        public virtual void PageLoaded(PageLoadedDirection direction)
        {
            if (direction == PageLoadedDirection.Forward && IsFirstLoad)
            {
                if (ImplementsIsDirty())
                    IsDirty = true;

                PopulatePage();
                IsFirstLoad = false;
            }
        }
Example #20
0
        protected override void PageLoadedCore(PageLoadedDirection direction)
        {
            PopulateComboBox();

            Connection.Cache.RegisterCollectionChanged <PBD>(PBD_CollectionChangedWithInvoke);
            foreach (PBD pbd in Connection.Cache.PBDs)
            {
                pbd.PropertyChanged -= server_PropertyChanged;
                pbd.PropertyChanged += server_PropertyChanged;
            }
        }
        public override void PageLoaded(PageLoadedDirection direction)
        {
            base.PageLoaded(direction);

            if (SummaryRetreiver == null)
            {
                return;
            }

            textBoxSummary.Text = SummaryRetreiver.Invoke();
        }
        public override void PageLeave(PageLoadedDirection direction, ref bool cancel)
        {
            if (!CrossPoolMigrateWizard.AllVMsAvailable(VmMappings, Connection))
            {
                cancel = true;
                SetButtonNextEnabled(false);
                SetButtonPreviousEnabled(false);
            }

            base.PageLeave(direction, ref cancel);
        }
Example #23
0
        public override void PageLeave(PageLoadedDirection direction, ref bool cancel)
        {
            if (direction == PageLoadedDirection.Forward && IsDirty)
            {
                m_textBoxFolderName.Text    = m_textBoxFolderName.Text.Trim();
                m_textBoxApplianceName.Text = m_textBoxApplianceName.Text.Trim();
                cancel = !PerformCheck(CheckDestinationFolderExists, CheckApplianceExists, CheckPermissions);
            }

            base.PageLeave(direction, ref cancel);
        }
Example #24
0
        public override void PageLoaded(PageLoadedDirection direction)
        {
            base.PageLoaded(direction);
            if (SelectedTemplate == Template)
                return;

            Template = SelectedTemplate;

            NameTextBox.Text = Helpers.DefaultVMName(Helpers.GetName(Template), Connection);
            NameTextBox.Select();
        }
Example #25
0
 public override void PageLeave(PageLoadedDirection direction, ref bool cancel)
 {
     if (direction == PageLoadedDirection.Forward && IsDirty)
     {
         if (!PerformCheck(CheckValidData))
         {
             cancel = true;
         }
     }
     base.PageLeave(direction, ref cancel);
 }
Example #26
0
        public override void PageLeave(PageLoadedDirection direction, ref bool cancel)
        {
            TargetConnection = null;

            if (!cancel && direction == PageLoadedDirection.Forward && IsDirty && ImplementsIsDirty())
            {
                cancel = !PerformCheck(CheckStorageRequirements);
            }

            base.PageLeave(direction, ref cancel);
        }
Example #27
0
        public override void PageLeave(PageLoadedDirection direction, ref bool cancel)
        {
            DeregisterEventHandlers();
            if (direction == PageLoadedDirection.Back && _worker != null)
            {
                _worker.CancelAsync();
                _worker = null;
            }

            base.PageLeave(direction, ref cancel);
        }
Example #28
0
        public override void PageLeave(PageLoadedDirection direction, ref bool cancel)
        {
            if (!CrossPoolMigrateWizard.AllVMsAvailable(VmMappings, Connection))
            {
                cancel = true;
                SetButtonNextEnabled(false);
                SetButtonPreviousEnabled(false);
            }

            base.PageLeave(direction, ref cancel);
        }
Example #29
0
        protected override void PageLoadedCore(PageLoadedDirection direction)
        {
            if (SelectedTemplate == Template)
            {
                return;
            }

            Template = SelectedTemplate;

            NameTextBox.Text = Helpers.DefaultVMName(Helpers.GetName(Template), Connection);
        }
        protected override void PageLeaveCore(PageLoadedDirection direction, ref bool cancel)
        {
            if (testingAction != null)
            {
                StopUrlTesting();
            }

            if (direction == PageLoadedDirection.Forward && ApplySuppPackAfterUpgrade && !string.IsNullOrEmpty(FilePath))
            {
                SelectedSuppPack = WizardHelpers.ParseSuppPackFile(FilePath, this, ref cancel);
            }
        }
Example #31
0
        protected override void PageLeaveCore(PageLoadedDirection direction, ref bool cancel)
        {
            if (direction == PageLoadedDirection.Forward && IsDirty)
            {
                if (IsUri() && !PerformCheck(CheckDownloadFromUri))
                {
                    cancel = true;
                    return;
                }

                if (!PerformCheck(CheckIsSupportedType, CheckPathExists))
                {
                    cancel = true;
                    return;
                }

                if (!PerformCheck(CheckIsCompressed))
                {
                    cancel = true;
                    return;
                }

                var checks = new List <CheckDelegate>();
                switch (TypeOfImport)
                {
                case ImportWizard.ImportType.Xva:
                    checks.Add(GetDiskCapacityXva);
                    break;

                case ImportWizard.ImportType.Ovf:
                    checks.Add(LoadAppliance);
                    break;

                case ImportWizard.ImportType.Vhd:
                    checks.Add(GetDiskCapacityImage);
                    break;
                }

                if (!PerformCheck(checks.ToArray()))
                {
                    cancel = true;
                    return;
                }

                if (TypeOfImport == ImportWizard.ImportType.Ovf && OVF.HasEncryption(SelectedOvfEnvelope))
                {
                    cancel = true;
                    m_tlpEncryption.Visible = true;
                    m_buttonNextEnabled     = false;
                    OnPageUpdated();
                }
            }
        }
Example #32
0
        public override void PageLoaded(PageLoadedDirection direction)
        {
            base.PageLoaded(direction);
            RefreshListButton.Enabled         = true;
            Updates.CheckForUpdatesCompleted += CheckForUpdates_CheckForUpdatesCompleted;

            if (direction == PageLoadedDirection.Forward)
            {
                PopulatePatchesBox();
                UpdateEnablement();
            }
        }
Example #33
0
        public override void PageLoaded(PageLoadedDirection direction)
        {
            base.PageLoaded(direction);
            if (SelectedTemplate == Template)
            {
                return;
            }

            Template = SelectedTemplate;

            NameTextBox.Text = Helpers.DefaultVMName(Helpers.GetName(Template), Connection);
        }
Example #34
0
        protected override void PageLeaveCore(PageLoadedDirection direction, ref bool cancel)
        {
            if (direction == PageLoadedDirection.Back)
            {
                return;
            }

            if (!userAcceptsWarning())
            {
                cancel = true;
            }
        }
Example #35
0
        protected override void PageLoadedCore(PageLoadedDirection direction)
        {
            if (SelectedTemplate == vmOrTemplate)
            {
                return;
            }

            vmOrTemplate = SelectedTemplate;

            GetCloudConfigParameters();
            ShowHideButtonsAndWarnings(true);
        }
        protected override void PageLoadedCore(PageLoadedDirection direction)
        {
            RefreshPage();

            foreach (var host in Connection.Cache.Hosts)
            {
                host.PropertyChanged += Host_PropertyChanged;
            }

            Connection.Cache.RegisterCollectionChanged <Cluster>(Cluster_CollectionChangedWithInvoke);
            Connection.Cache.RegisterCollectionChanged <Host>(Host_CollectionChangedWithInvoke);
        }
Example #37
0
 public override void PageLoaded(PageLoadedDirection direction)
 {
     base.PageLoaded(direction);
     if (direction == PageLoadedDirection.Forward)
     {
         HelpersGUI.FocusFirstControl(base.Controls);
         this.InitStorageGridList();
         this.SettingValue();
         this.InitNetworkListBox();
         this.InitCredentials();
     }
 }
Example #38
0
        public override void PageLoaded(PageLoadedDirection direction)
        {
            base.PageLoaded(direction);

            if (SelectedTemplate ==  Template)
                return;

            initialising = true;

            Template = SelectedTemplate;
            if (Template.has_ballooning && !Helpers.FeatureForbidden(Template, Host.RestrictDMC))
                memoryMode = (Template.memory_dynamic_max == Template.memory_static_max ? 2 : 3);
            else
                memoryMode = 1;

            memoryRatio = VMMemoryControlsEdit.GetMemoryRatio(Template);

            VcpuSpinner.Minimum = 1;
            VcpuSpinner.Maximum = (decimal)(Template.MaxVCPUsAllowed);
            VcpuSpinner.Value = (decimal)(Template.VCPUs_at_startup);

            FreeSpinnerLimits();

            if (memoryMode == 1)
            {
                spinnerDynMin.Initialize(Messages.MEMORY_COLON, null, Template.memory_static_max, Template.memory_static_max);
                spinnerDynMax.Visible = spinnerStatMax.Visible = false;
            }
            else
            {
                spinnerDynMax.Visible = true;
                spinnerDynMin.Initialize(Messages.DYNAMIC_MIN_COLON, null, Template.memory_dynamic_min, Template.memory_static_max);
                FreeSpinnerLimits();  // same as CA-33831
                spinnerDynMax.Initialize(Messages.DYNAMIC_MAX_COLON, null, Template.memory_dynamic_max, Template.memory_static_max);
                if (memoryMode == 3)
                {
                    FreeSpinnerLimits();
                    spinnerStatMax.Initialize(Messages.STATIC_MAX_COLON, null, Template.memory_static_max, Template.memory_static_max);
                }
                else
                    spinnerStatMax.Visible = false;
            }

            comboBoxTopology.Populate(Template.VCPUs_at_startup, Template.VCPUs_max, Template.CoresPerSocket, Template.MaxCoresPerSocket);

            SetSpinnerLimits();

            VcpuSpinner.Select();
            ValuesUpdated();

            initialising = false;
        }
Example #39
0
        public override void PageLoaded(PageLoadedDirection direction)
        {
            base.PageLoaded(direction);
            int alwaysRestartHighPriority = 0, alwaysRestart = 0, bestEffort = 0, doNotRestart = 0;

            foreach (VM.HA_Restart_Priority priority in RestartPriorities)
            {
                switch (priority)
                {
                case VM.HA_Restart_Priority.AlwaysRestartHighPriority:
                    alwaysRestartHighPriority++;
                    break;

                case VM.HA_Restart_Priority.AlwaysRestart:
                case VM.HA_Restart_Priority.Restart:
                    alwaysRestart++;
                    break;

                case VM.HA_Restart_Priority.BestEffort:
                    bestEffort++;
                    break;

                case VM.HA_Restart_Priority.DoNotRestart:
                    doNotRestart++;
                    break;
                }
            }
            if (Helpers.BostonOrGreater(Connection))
            {
                labelSummary.Text = String.Format(Messages.HAWIZ_SUMMARY_NEW,
                                                  HeartbeatSrName.Ellipsise(50),
                                                  Ntol,
                                                  GetVmNumber(alwaysRestart),
                                                  GetVmNumber(bestEffort),
                                                  GetVmNumber(doNotRestart));
            }
            else
            {
                labelSummary.Text = String.Format(Messages.HAWIZ_SUMMARY,
                                                  HeartbeatSrName.Ellipsise(50),
                                                  Ntol,
                                                  GetVmNumber(alwaysRestartHighPriority),
                                                  GetVmNumber(alwaysRestart),
                                                  GetVmNumber(bestEffort),
                                                  GetVmNumber(doNotRestart));
            }

            // If the user hasn't protected any VMs, show a warning.
            labelNoVmsProtected.Visible = (bestEffort + alwaysRestart + alwaysRestartHighPriority == 0) && doNotRestart > 0;
            labelNoHaGuaranteed.Visible = Ntol == 0;
            pictureBox1.Visible         = labelNoVmsProtected.Visible || labelNoHaGuaranteed.Visible;
        }
Example #40
0
        public override void PageLeave(PageLoadedDirection direction, ref bool cancel)
        {
            var l = new List <VM>();

            l.Add(TheVM);
            if (!CrossPoolMigrateWizard.AllVMsAvailable(l))
            {
                cancel = true;
                SetButtonsEnabled(false);
            }

            base.PageLeave(direction, ref cancel);
        }
Example #41
0
        protected override void PageLoadedCore(PageLoadedDirection direction)
        {
            labelSr.Text           = HeartbeatSrName.Ellipsise(50);
            labelNtol.Text         = Ntol.ToString();
            labelRestart.Text      = GetVmNumber(AlwaysRestart);
            labelBestEffort.Text   = GetVmNumber(BestEffort);
            labelDoNotRestart.Text = GetVmNumber(DoNotRestart);

            // If the user hasn't protected any VMs, show a warning.
            labelNoVmsProtected.Visible = (BestEffort + AlwaysRestart + AlwaysRestartHighPriority == 0) && DoNotRestart > 0;
            labelNoHaGuaranteed.Visible = Ntol == 0;
            pictureBox1.Visible         = labelNoVmsProtected.Visible || labelNoHaGuaranteed.Visible;
        }
        protected override void PageLeaveCore(PageLoadedDirection direction, ref bool cancel)
        {
            if (!PerformCheck())
            {
                cancel = true;
                SetButtonNextEnabled(false);
                return;
            }

            UnregisterHandlers();
            SetDefaultTarget(ChosenItem);
            ClearComboBox();
        }
        public override void PageLeave(PageLoadedDirection direction, ref bool cancel)
        {
            try
            {
                if (direction == PageLoadedDirection.Forward)
                {
                    if (!AllSelectedHostsConnected())
                    {
                        foreach (PatchingHostsDataGridViewRow row in dataGridViewHosts.Rows)
                        {
                            row.UpdateIcon();
                        }
                        dataGridViewHosts.Invalidate();
                        cancel = true;
                        return;
                    }

                    //Upload the patches to the masters if it is necessary
                    List <Host> masters = SelectedMasters;

                    //Do RBAC check
                    foreach (Host master in masters)
                    {
                        if (!(Role.CanPerform(new RbacMethodList("pool_patch.apply"), master.Connection)))
                        {
                            string nameLabel = master.Name;
                            Pool   pool      = Helpers.GetPoolOfOne(master.Connection);
                            if (pool != null)
                            {
                                nameLabel = pool.Name;
                            }

                            using (var dlg = new ThreeButtonDialog(new ThreeButtonDialog.Details(SystemIcons.Warning, string.Format(Messages.RBAC_UPDATES_WIZARD, master.Connection.Username, nameLabel), Messages.UPDATES_WIZARD)))
                            {
                                dlg.ShowDialog(this);
                            }

                            cancel = true;
                            base.PageLeave(direction, ref cancel);
                            return;
                        }
                    }
                }
                base.PageLeave(direction, ref cancel);
            }
            catch (Exception e)
            {
                log.Debug(e);
                throw;//better throw an exception rather than closing the wizard suddenly and silently
            }
        }
Example #44
0
        protected override void PageLeaveCore(PageLoadedDirection direction, ref bool cancel)
        {
            if (direction == PageLoadedDirection.Back)
            {
                return;
            }

            // For Miami hosts we need to ensure an SR.probe()
            // has been performed, and that the user has made a decision. Show the iSCSI choices dialog until
            // they click something other than 'Cancel'. For earlier host versions, warn that data loss may
            // occur.

            Host master = Helpers.GetMaster(Connection);

            if (master == null)
            {
                cancel = true;
                return;
            }

            // Start probe

            List <SR.SRInfo> srs;
            var currentSrType = SrType;

            if (!RunProbe(master, currentSrType, out srs))
            {
                cancel = iscsiProbeError = true;
                return;
            }

            var performSecondProbe = Helpers.KolkataOrGreater(Connection) &&
                                     !Helpers.FeatureForbidden(Connection, Host.CorosyncDisabled);

            if (performSecondProbe && srs.Count == 0)
            {
                // Start second probe
                currentSrType = SrType == SR.SRTypes.gfs2 ? SR.SRTypes.lvmoiscsi : SR.SRTypes.gfs2;

                if (!RunProbe(master, currentSrType, out srs))
                {
                    cancel = iscsiProbeError = true;
                    return;
                }
            }

            // Probe has been performed. Now ask the user if they want to Reattach/Format/Cancel.
            // Will return false on cancel
            cancel = iscsiProbeError = !ExamineIscsiProbeResults(currentSrType, srs);
        }
Example #45
0
        public override void PageLoaded(PageLoadedDirection direction)
        {
            base.PageLoaded(direction);
            SummaryGridView.Rows.Clear();
            
            if (SummaryRetreiver == null)
                return;

            var entries = SummaryRetreiver.Invoke();
            foreach (KeyValuePair<string, string> pair in entries)
                SummaryGridView.Rows.Add(pair.Key, pair.Value);
            
            AutoStartCheckBox.Select();
        }
Example #46
0
        public override void PageLeave(PageLoadedDirection direction, ref bool cancel)
        {
            targetConnection = null;

            if (VmMappings.Select(kvp => kvp.Key).Any(sysId => NetworkData(sysId) == null))
            {
                ShowWarningMessageBox(Messages.CPM_WIZARD_VM_MISSING_ERROR);
                cancel = true;
                SetButtonNextEnabled(false);
                SetButtonPreviousEnabled(false);
            }

            base.PageLeave(direction, ref cancel);
        }
Example #47
0
        public override void PageLeave(PageLoadedDirection direction, ref bool cancel)
        {
            if (direction == PageLoadedDirection.Back)
            {
                return;
            }

            if (!userAcceptsWarning())
            {
                cancel = true;
            }

            base.PageLeave(direction, ref cancel);
        }
Example #48
0
        public override void PageLeave(PageLoadedDirection direction, ref bool cancel)
        {
            if (direction == PageLoadedDirection.Forward)
            {
                var fileName = fileNameTextBox.Text;
                if (downloadUpdateRadioButton.Checked)
                {
                    SelectedUpdateType = UpdateType.NewRetail;
                }
                else
                {
                    if (isValidFile())
                    {
                        if (fileName.EndsWith(".xsupdate"))
                        {
                            SelectedUpdateType = UpdateType.NewRetail;
                        }
                        else if (fileName.EndsWith(".iso"))
                        {
                            SelectedUpdateType = UpdateType.NewSuppPack;
                        }
                        else
                        {
                            SelectedUpdateType = UpdateType.Existing;
                        }
                    }
                }
                SelectedUpdateAlert = downloadUpdateRadioButton.Checked
                                             ? (XenServerPatchAlert)((PatchGridViewRow)dataGridViewPatches.SelectedRows[0]).UpdateAlert
                                             : null;
                FileFromDiskAlert = selectFromDiskRadioButton.Checked
                                             ? GetAlertFromFileName(fileName)
                                             : null;


                if (SelectedExistingPatch != null && !SelectedExistingPatch.Connection.IsConnected)
                {
                    cancel = true;
                    PageLeaveCancelled(string.Format(Messages.UPDATES_WIZARD_CANNOT_DOWNLOAD_PATCH,
                                                     SelectedExistingPatch.Connection.Name));
                }
                else if (!string.IsNullOrEmpty(SelectedNewPatch) && !File.Exists(SelectedNewPatch))
                {
                    cancel = true;
                    PageLeaveCancelled(string.Format(Messages.UPDATES_WIZARD_FILE_NOT_FOUND, SelectedNewPatch));
                }
            }
            Updates.CheckForUpdatesCompleted -= CheckForUpdates_CheckForUpdatesCompleted;
            base.PageLeave(direction, ref cancel);
        }
Example #49
0
        protected override void PageLeaveCore(PageLoadedDirection direction, ref bool cancel)
        {
            if (direction != PageLoadedDirection.Forward)
            {
                return;
            }

            if (!PerformCheck(CheckPathValid, CheckDestinationFolderExists, CheckCredentialsEntered, CheckUploadAuthentication))
            {
                cancel = true;
                return;
            }

            string path = OutputFile;

            if (File.Exists(path)) //confirm ok to overwrite
            {
                using (var dlg = new WarningDialog(string.Format(Messages.FILE_X_EXISTS_OVERWRITE, path),
                                                   ThreeButtonDialog.ButtonOK,
                                                   new ThreeButtonDialog.TBDButton(Messages.CANCEL, DialogResult.Cancel, selected: true)))
                {
                    if (dlg.ShowDialog(this) != DialogResult.OK)
                    {
                        cancel = true;
                        return;
                    }
                }
            }

            // Check we can write to the destination file - otherwise we only find out at the
            // end of the ZipStatusReportAction, and the downloaded server files are lost,
            // and the user will have to run the wizard again.
            try
            {
                using (File.OpenWrite(path)) { }
            }
            catch (Exception exn)
            {
                // Failure
                using (var dlg = new ErrorDialog(string.Format(Messages.COULD_NOT_WRITE_FILE, path, exn.Message)))
                    dlg.ShowDialog(this);

                cancel = true;
                return;
            }

            // Save away the output directory for next time
            Properties.Settings.Default.ServerStatusPath = m_textBoxLocation.Text.Trim();
        }
        public override void PageLoaded(PageLoadedDirection direction)
        {
            base.PageLoaded(direction);
            if (direction == PageLoadedDirection.Forward)
            {
                SetupLabels();
            }

            PopulateSrList();

            if (dataGridViewSRs.Rows.Count > 0)
            {
                SortRows();
            }
        }
Example #51
0
        public override void PageLoaded(PageLoadedDirection direction)
        {
            base.PageLoaded(direction);

            if (direction == PageLoadedDirection.Forward)
            {
                vgpuSettings.Clear();
                ShowWarning(null);

                if (SelectedOvfEnvelope == null || VmMappings.Count < 1)
                    return;

                vgpuSettings = FindVgpuSettings(SelectedOvfEnvelope);
            }
        }
Example #52
0
        public override void PageLoaded(PageLoadedDirection direction)
        {
            base.PageLoaded(direction);

            textBoxLog.Clear();

            var unknownType = false;

            var someHostMayRequireRestart = false; // If a host has restartHost guidance, even if is a live patch,  we want this true (as live patch may fail)

            switch (SelectedUpdateType)
            {
            case UpdateType.NewRetail:
            case UpdateType.Existing:
                textBoxLog.Text = PatchingWizardModeGuidanceBuilder.ModeRetailPatch(SelectedServers, Patch, out someHostMayRequireRestart);
                break;

            case UpdateType.ISO:
                AutomaticRadioButton.Enabled = true;
                AutomaticRadioButton.Checked = true;
                textBoxLog.Text = PoolUpdate != null
                        ? PatchingWizardModeGuidanceBuilder.ModeRetailPatch(SelectedServers, PoolUpdate, LivePatchCodesByHost, out someHostMayRequireRestart)
                        : PatchingWizardModeGuidanceBuilder.ModeSuppPack(SelectedServers, out someHostMayRequireRestart);

                break;

            default:
                unknownType = true;
                break;
            }

            var automaticDisabled = unknownType || (AnyPoolForbidsAutoRestart() && someHostMayRequireRestart);

            AutomaticRadioButton.Enabled = !automaticDisabled;
            AutomaticRadioButton.Checked = !automaticDisabled;
            ManualRadioButton.Checked    = automaticDisabled;

            if (automaticDisabled)
            {
                tableLayoutPanel1.MouseMove += tableLayoutPanel1_MouseMove;
            }

            if (SelectedUpdateType == UpdateType.ISO || SelectedServers.Exists(server => !Helpers.ClearwaterOrGreater(server)))
            {
                removeUpdateFileCheckBox.Checked = false;
                removeUpdateFileCheckBox.Visible = false;
            }
        }
        public override void PageLoaded(PageLoadedDirection direction)
        {
            base.PageLoaded(direction);
            try
            {
                if (SelectedUpdateType == UpdateType.Existing)
                {
                    _patch = SelectedExistingPatch;
                }

                // catch selected servers, in order to restore selection after the dataGrid is reloaded
                List <Host> selectedServers = SelectedServers;

                dataGridViewHosts.Rows.Clear();
                List <IXenConnection> xenConnections = ConnectionsManager.XenConnectionsCopy;
                xenConnections.Sort();
                foreach (IXenConnection xenConnection in xenConnections)
                {
                    Pool pool    = Helpers.GetPool(xenConnection);
                    bool hasPool = true;
                    if (pool != null)
                    {
                        int  index  = dataGridViewHosts.Rows.Add(new PatchingHostsDataGridViewRow(pool));
                        Host master = pool.Connection.Resolve(pool.master);
                        EnabledRow(master, SelectedUpdateType, index);
                    }
                    else
                    {
                        hasPool = false;
                    }
                    Host[] hosts = xenConnection.Cache.Hosts;
                    Array.Sort(hosts);
                    foreach (Host host in hosts)
                    {
                        int index = dataGridViewHosts.Rows.Add(new PatchingHostsDataGridViewRow(host, hasPool));
                        EnabledRow(host, SelectedUpdateType, index);
                    }
                }

                // restore server selection
                SelectServers(selectedServers);
            }
            catch (Exception e)
            {
                log.Error(e, e);
                throw;//better throw an exception rather than closing the wizard suddenly and silently
            }
        }
        public override void PageLoaded(PageLoadedDirection direction)
        {
            base.PageLoaded(direction);

            textBoxLog.Clear();

            switch (SelectedUpdateType)
            {
                case UpdateType.NewRetail:
                case UpdateType.Existing:
                    textBoxLog.Text = PatchingWizardModeGuidanceBuilder.ModeRetailPatch(SelectedServers, Patch);
                    if (Helpers.MidnightRideOrGreater(SelectedServers[0].Connection))
                    {
                        AutomaticRadioButton.Enabled = true;
                        AutomaticRadioButton.Checked = true;
                    }
                    else
                    {
                        AutomaticRadioButton.Enabled = false;
                        ManualRadioButton.Checked = true;
                    }
                    break;
                case UpdateType.NewOem:
                    ManualRadioButton.Checked = true;
                    AutomaticRadioButton.Enabled = false;
                    textBoxLog.Text = PatchingWizardModeGuidanceBuilder.ModeNewOem(SelectedServers);
                    break;
                case UpdateType.NewSuppPack:
                    AutomaticRadioButton.Enabled = true;
                    AutomaticRadioButton.Checked = true;
                    textBoxLog.Text = PatchingWizardModeGuidanceBuilder.ModeSuppPack(SelectedServers);
                    break;
            }

            if (SelectedUpdateType == UpdateType.NewSuppPack)
            {
                removeUpdateFileCheckBox.Visible = false;
            }
        }
Example #55
0
        public override void PageLoaded(PageLoadedDirection direction)
        {
            base.PageLoaded(direction);
            VM template = SelectedTemplate;
            string vmName = SelectedName;

            if (Template == template && VmName == vmName)
                return;

            Template = template;
            VmName = vmName;

            panelDefaultTemplateInfo.Visible = Template.DefaultTemplate;

            BoxTitle.Text = string.Format(Messages.NEWVMWIZARD_NETWORKINGPAGE_VIFSON, VmName);//CA-56794 Helpers.TrimStringIfRequired(VmName, 50));

            LoadNetworks();

            if (NetworksGridView.Rows.Count > 0)
                NetworksGridView.Rows[0].Selected = true;

            UpdateEnablement();
            NetworksGridView.Select();
        }
        public override void PageLoaded(PageLoadedDirection direction)
        {
            base.PageLoaded(direction);
            SetupLabels();

            try
            {
                if (direction == PageLoadedDirection.Back)
                    return;

                RefreshRechecks();
            }
            catch (Exception e)
            {
                log.Error(e, e);
                throw;//better throw an exception rather than closing the wizard suddenly and silently
            }
        }
 public override void PageLeave(PageLoadedDirection direction, ref bool cancel)
 {
     if (direction == PageLoadedDirection.Back)
     {
         _worker.CancelAsync();
         _worker = null;
     }
     base.PageLeave(direction, ref cancel);
 }
Example #58
0
        public override void PageLeave(PageLoadedDirection direction, ref bool cancel)
        {
            if (direction == PageLoadedDirection.Forward)
                cancel = !PerformCheck(CheckPathValid, CheckCredentialsEntered, CheckUploadAuthentication);

            base.PageLeave(direction, ref cancel);
        }
Example #59
0
 public override void PageLoaded(PageLoadedDirection direction)
 {
     base.PageLoaded(direction);
     PerformCheck(CheckPathValid, CheckCredentialsEntered);
 }
Example #60
0
		public override void PageLeave(PageLoadedDirection direction, ref bool cancel)
		{
			if (direction == PageLoadedDirection.Forward && IsDirty)
				cancel = !OkToProceed();

			base.PageLeave(direction, ref cancel);
		}