示例#1
0
        /// <summary>
        /// Apply optimization to a pool
        /// </summary>
        /// <param name="sender">object</param>
        /// <param name="e">EventArgs</param>
        private void ButtonApply_Click(object sender, EventArgs e)
        {
            if (this._pool == null)
                return;

            applyButton.Enabled = false;

            action = HelpersGUI.FindActiveOptAction(_xenObject.Connection);
            if ((action != null && action.GetType() != typeof(WlbOptimizePoolAction)) || action == null)
            {
                new WlbOptimizePoolAction(_pool, _vmOptList, _optId).RunAsync();

                // Switch to logs tab, since this action takes a while and there's no feedback on the HA tab
                Program.MainWindow.SwitchToTab(MainWindow.Tab.History);
                Program.MainWindow.UpdateToolbars();
            }
        }
示例#2
0
        /// <summary>
        /// Build optimize pool list view properly
        /// </summary>
        private void BuildRecList()
        {
            Program.AssertOnEventThread();

            if(_xenObject == null)
                return;

            if (Helpers.WlbEnabled(_xenObject.Connection))
            {
                try
                {
                    if (_xenObject is Pool)
                    {
                        _pool = (Pool)_xenObject;

                        // get any active WLB action
                        action = HelpersGUI.FindActiveWLBAction(_xenObject.Connection);

                        // make sure we are not initializing, starting or stopping WLB
                        if (action is DisableWLBAction || action is EnableWLBAction || action is InitializeWLBAction)
                            return;

                        optimizePoolListView.BeginUpdate();

                        // check whether optimize pool is running before load optimize pool listview
                        if ((action != null && action is WlbOptimizePoolAction)
                            || (action == null && _pool.other_config.ContainsKey(WlbOptimizationRecommendation.OPTIMIZINGPOOL)
                                && _pool.other_config[WlbOptimizationRecommendation.OPTIMIZINGPOOL] == Messages.IN_PROGRESS))
                        {
                            //statusLabel.Text = Messages.WLB_OPT_OPTIMIZING;
                            this.applyButton.Text = Messages.WLB_OPT_OPTIMIZING;
                            EnableControls(false, false);
                        }
                        else if (action == null || (action != null && action.GetType() != typeof(WlbRetrieveRecommendationAction)))
                        {
                            this.applyButton.Text = Messages.WLB_OPT_APPLY_RECOMMENDATIONS;
                            // retrieve recommendations, and load optimize pool listview properly
                            WlbRetrieveRecommendationAction optAction = new WlbRetrieveRecommendationAction(_pool);
                            optAction.Completed += this.OptRecRetrieveAction_Completed;
                            optAction.RunAsync();
                        }
                    }
                }
                catch (Failure f)
                {
                    statusLabel.Text = Messages.WLB_OPT_LOADING_ERROR;
                    log.Error(f, f);
                }
                catch (Exception e)
                {
                    statusLabel.Text = Messages.WLB_OPT_LOADING_ERROR;
                    log.ErrorFormat("There was an error calling retrieve_wlb_recommendations on pool {0}", _pool.name_label);
                    log.Error(e, e);
                }

                finally
                {
                    optimizePoolListView.EndUpdate();
                }
            }
            else
            {
                this.WLBOptDisable(true);
            }
        }
示例#3
0
        /// <summary>
        /// Apply optimization to a pool
        /// </summary>
        /// <param name="sender">object</param>
        /// <param name="e">EventArgs</param>
        private void ButtonApply_Click(object sender, EventArgs e)
        {
            if (this._pool == null)
                return;

            applyButton.Enabled = false;

            action = HelpersGUI.FindActiveOptAction(_xenObject.Connection);
            if ((action != null && action.GetType() != typeof(WlbOptimizePoolAction)) || action == null)
            {
                new WlbOptimizePoolAction(_pool, _vmOptList, _optId).RunAsync();
                Program.MainWindow.UpdateToolbars();
            }
        }