예제 #1
0
        private void Execute(IXenConnection connection)
        {
            if (connection == null)
            {
                return;
            }

            Pool pool = Helpers.GetPool(connection);

            if (pool == null)
            {
                return;
            }

            if (Helpers.FeatureForbidden(pool, Host.RestrictHA))
            {
                // Show upsell dialog
                using (var dlg = new UpsellDialog(HiddenFeatures.LinkLabelHidden ? Messages.UPSELL_BLURB_HA : Messages.UPSELL_BLURB_HA + Messages.UPSELL_BLURB_TRIAL,
                                                  InvisibleMessages.UPSELL_LEARNMOREURL_TRIAL))
                    dlg.ShowDialog(Parent);
            }
            else if (pool.ha_enabled)
            {
                // Show VM restart priority editor
                MainWindowCommandInterface.ShowPerConnectionWizard(connection, new EditVmHaPrioritiesDialog(pool));
            }
            else
            {
                // Show wizard to enable HA
                MainWindowCommandInterface.ShowPerConnectionWizard(connection, new HAWizard(pool));
            }
        }
예제 #2
0
        protected override void ExecuteCore(SelectedItemCollection selection)
        {
            VM vm = selection[0].XenObject as VM;

            if (vm != null)
            {
                if (vm.VBDs.Count < vm.MaxVBDsAllowed)
                {
                    MainWindowCommandInterface.ShowPerXenModelObjectWizard(vm, new NewDiskDialog(vm.Connection, vm));
                }
                else
                {
                    new ThreeButtonDialog(
                        new ThreeButtonDialog.Details(
                            SystemIcons.Error,
                            FriendlyErrorNames.VBDS_MAX_ALLOWED,
                            Messages.DISK_ADD)).ShowDialog(Program.MainWindow);
                }
            }
            else
            {
                SR sr = (SR)selection[0].XenObject;
                MainWindowCommandInterface.ShowPerConnectionWizard(sr.Connection, new NewDiskDialog(sr.Connection, sr));
            }
        }
        protected override void ExecuteCore(SelectedItemCollection selection)
        {
            var con = selection.GetConnectionOfFirstItem();

            MainWindowCommandInterface.ShowPerConnectionWizard(con,
                                                               new CrossPoolMigrateWizard(con, selection, preSelectedHost, WizardMode.Copy));
        }
예제 #4
0
        protected override void ExecuteCore(SelectedItemCollection selection)
        {
            if (Helpers.FeatureForbidden(selection[0].XenObject, Host.RestrictWLB))
            {
                // Show upsell dialog
                UpsellDialog dlg = new UpsellDialog(Messages.UPSELL_BLURB_WLB, InvisibleMessages.UPSELL_LEARNMOREURL_WLB);
                dlg.ShowDialog(Parent);
                return;
            }

            try
            {
                WorkloadReports WlbReportWin = new WorkloadReports(_reportFile, _run)
                {
                    Pool  = selection[0].PoolAncestor,
                    Hosts = selection[0].Connection.Cache.Hosts
                };

                MainWindowCommandInterface.ShowPerConnectionWizard(selection[0].Connection, WlbReportWin);
            }
            catch (Failure exn)
            {
                log.Error(exn, exn);
            }
        }
예제 #5
0
 private void Execute(SR sr)
 {
     if (CanReattachSR(sr))
     {
         MainWindowCommandInterface.ShowPerConnectionWizard(sr.Connection, new NewSRWizard(sr.Connection, sr));
     }
 }
예제 #6
0
파일: HACommand.cs 프로젝트: ywscr/xenadmin
        private void Execute(IXenConnection connection)
        {
            if (connection == null)
            {
                return;
            }

            Pool pool = Helpers.GetPool(connection);

            if (pool == null)
            {
                return;
            }

            if (Helpers.FeatureForbidden(pool, Host.RestrictHA))
            {
                // Show upsell dialog
                using (var dlg = new UpsellDialog(HiddenFeatures.LinkLabelHidden ? Messages.UPSELL_BLURB_HA : Messages.UPSELL_BLURB_HA + Messages.UPSELL_BLURB_TRIAL,
                                                  InvisibleMessages.UPSELL_LEARNMOREURL_TRIAL))
                    dlg.ShowDialog(Parent);
            }
            else if (pool.ha_enabled)
            {
                if (pool.ha_statefiles.All(sf => pool.Connection.Resolve(new XenRef <VDI>(sf)) == null))//empty gives true, which is correct
                {
                    log.ErrorFormat("Cannot resolve HA statefile VDI (pool {0} has {1} statefiles).",
                                    pool.Name(), pool.ha_statefiles.Length);

                    using (var dlg = new ErrorDialog(string.Format(Messages.HA_CONFIGURE_NO_STATEFILE, Helpers.GetName(pool).Ellipsise(30)),
                                                     ThreeButtonDialog.ButtonOK)
                    {
                        WindowTitle = Messages.CONFIGURE_HA
                    })
                    {
                        dlg.ShowDialog(Program.MainWindow);
                    }
                }
                else if (!Role.CanPerform(HA_PERMISSION_CHECKS, pool.Connection))
                {
                    var msg = string.Format(Messages.RBAC_HA_CONFIGURE_WARNING,
                                            Role.FriendlyCSVRoleList(Role.ValidRoleList(HA_PERMISSION_CHECKS, pool.Connection)),
                                            Role.FriendlyCSVRoleList(pool.Connection.Session.Roles));

                    using (var dlg = new ErrorDialog(msg))
                        dlg.ShowDialog(Parent);
                }
                else
                {
                    MainWindowCommandInterface.ShowPerConnectionWizard(connection, new EditVmHaPrioritiesDialog(pool));
                }
            }
            else
            {
                MainWindowCommandInterface.ShowPerConnectionWizard(connection, new HAWizard(pool));
            }
        }
예제 #7
0
 protected override void ExecuteCore(SelectedItemCollection selection)
 {
     if (selection[0].XenObject is Host host)
     {
         MainWindowCommandInterface.ShowPerConnectionWizard(host.Connection, new ChangeServerPasswordDialog(host));
     }
     else if (selection[0].XenObject is Pool pool)
     {
         MainWindowCommandInterface.ShowPerConnectionWizard(pool.Connection, new ChangeServerPasswordDialog(pool));
     }
 }
예제 #8
0
 protected override void ExecuteCore(SelectedItemCollection selection)
 {
     if (selection.FirstIsStorageLink)
     {
         new NewSRWizard(null, null, (IStorageLinkObject)selection[0].XenObject).Show(Parent);
     }
     else
     {
         MainWindowCommandInterface.ShowPerConnectionWizard(selection[0].Connection, new NewSRWizard(selection[0].Connection));
     }
 }
예제 #9
0
        protected override void ExecuteCore(SelectedItemCollection selection)
        {
            var con = selection.GetConnectionOfFirstItem();

            if (Helpers.FeatureForbidden(con, Host.RestrictCrossPoolMigrate))
            {
                ShowUpsellDialog(Parent);
            }
            else
            {
                MainWindowCommandInterface.ShowPerConnectionWizard(con, new CrossPoolMigrateWizard(con, selection, preSelectedHost));
            }
        }
예제 #10
0
        private void Execute(IXenConnection connection)
        {
            if (connection == null)
            {
                return;
            }

            Pool pool = Helpers.GetPool(connection);

            if (pool == null)
            {
                return;
            }

            if (Helpers.FeatureForbidden(pool, Host.RestrictHA))
            {
                // Show upsell dialog
                using (var dlg = new UpsellDialog(HiddenFeatures.LinkLabelHidden ? Messages.UPSELL_BLURB_HA : Messages.UPSELL_BLURB_HA + Messages.UPSELL_BLURB_TRIAL,
                                                  InvisibleMessages.UPSELL_LEARNMOREURL_TRIAL))
                    dlg.ShowDialog(Parent);
            }
            else if (pool.ha_enabled)
            {
                if (pool.ha_statefiles.Any(sf => pool.Connection.Resolve(new XenRef <VDI>(sf)) != null))
                {
                    // Show VM restart priority editor
                    MainWindowCommandInterface.ShowPerConnectionWizard(connection, new EditVmHaPrioritiesDialog(pool));
                }
                else
                {
                    log.ErrorFormat("Cannot resolve HA statefile VDI (pool {0} has {1} statefiles).",
                                    pool.Name(), pool.ha_statefiles.Length);

                    using (var dlg = new ThreeButtonDialog(
                               new ThreeButtonDialog.Details(
                                   SystemIcons.Error,
                                   string.Format(Messages.HA_CONFIGURE_NO_STATEFILE, Helpers.GetName(pool).Ellipsise(30)),
                                   Messages.CONFIGURE_HA),
                               "HADisable",
                               ThreeButtonDialog.ButtonOK))
                    {
                        dlg.ShowDialog(Program.MainWindow);
                    }
                }
            }
            else
            {
                // Show wizard to enable HA
                MainWindowCommandInterface.ShowPerConnectionWizard(connection, new HAWizard(pool));
            }
        }
예제 #11
0
        protected override void ExecuteCore(SelectedItemCollection selection)
        {
            Host host = selection[0].XenObject as Host;
            Pool pool = selection[0].XenObject as Pool;

            if (host != null)
            {
                MainWindowCommandInterface.ShowPerConnectionWizard(selection[0].Connection, new ChangeServerPasswordDialog(host));
            }
            if (pool != null)
            {
                MainWindowCommandInterface.ShowPerConnectionWizard(selection[0].Connection, new ChangeServerPasswordDialog(pool));
            }
        }
예제 #12
0
 protected override void ExecuteCore(SelectedItemCollection selection)
 {
     if (selection[0].XenObject is VM vm)
     {
         if (vm.VBDs.Count < vm.MaxVBDsAllowed())
         {
             new NewDiskDialog(vm.Connection, vm).ShowPerXenObject(vm, Program.MainWindow);
         }
         else
         {
             using (var dlg = new ErrorDialog(FriendlyErrorNames.VBDS_MAX_ALLOWED)
             {
                 WindowTitle = Messages.DISK_ADD
             })
             {
                 dlg.ShowDialog(Program.MainWindow);
             }
         }
     }
     else if (selection[0].XenObject is SR sr)
     {
         MainWindowCommandInterface.ShowPerConnectionWizard(sr.Connection, new NewDiskDialog(sr.Connection, sr));
     }
 }
예제 #13
0
 protected void GetNumber(SelectedItemCollection selection)
 {
     MainWindowCommandInterface.ShowPerConnectionWizard(selection[0].Connection, new InstantVMsWizard(selection[0]));
 }
예제 #14
0
        protected override void ExecuteCore(SelectedItemCollection selection)
        {
            var con = selection.GetConnectionOfFirstItem();

            MainWindowCommandInterface.ShowPerConnectionWizard(con, new ExportApplianceWizard(con, selection));
        }
예제 #15
0
        protected override void ExecuteCore(SelectedItemCollection selection)
        {
            var con = selection.GetConnectionOfFirstItem();

            MainWindowCommandInterface.ShowPerConnectionWizard(con, new ImportWizard(con, selection.FirstAsXenObject, null, false));
        }
예제 #16
0
 protected override void ExecuteCore(SelectedItemCollection selection)
 {
     MainWindowCommandInterface.ShowPerConnectionWizard(selection[0].Connection, new NewSRWizard(selection[0].Connection));
 }
예제 #17
0
 protected override void ExecuteCore(SelectedItemCollection selection)
 {
     MainWindowCommandInterface.ShowPerConnectionWizard(selection[0].Connection,
                                                        VMGroup <T> .NewGroupWizard(Helpers.GetPoolOfOne(selection[0].Connection), selection.AsXenObjects <VM>()));
 }
예제 #18
0
 private void Execute(IXenConnection connection, Host DefaultAffinity, VM DefaultTemplate)
 {
     MainWindowCommandInterface.ShowPerConnectionWizard(connection, new NewVMWizard(connection, DefaultTemplate, DefaultAffinity));
 }