protected override void ExecuteCore(SelectedItemCollection selection)
        {
            VDI vdi = (VDI)selection[0].XenObject;


            MainWindowCommandInterface.ShowPerXenModelObjectWizard(vdi, new MoveVirtualDiskDialog(vdi));
        }
        private void EnterMaintenanceMode(Host host)
        {
            Pool pool = Helpers.GetPool(host.Connection);

            if (pool != null && pool.ha_enabled && host.IsMaster())
            {
                using (var dlg = new ThreeButtonDialog(
                           new ThreeButtonDialog.Details(
                               SystemIcons.Error,
                               String.Format(Messages.HA_CANNOT_EVACUATE_MASTER,
                                             Helpers.GetName(host).Ellipsise(Helpers.DEFAULT_NAME_TRIM_LENGTH)),
                               Messages.XENCENTER)))
                {
                    dlg.ShowDialog(Parent);
                }

                return;
            }

            if (!host.GetRunningVMs().Any() && (pool == null || !host.IsMaster()))
            {
                Program.MainWindow.CloseActiveWizards(host.Connection);
                var action = new EvacuateHostAction(host, null, new Dictionary <XenRef <VM>, string[]>(), AddHostToPoolCommand.NtolDialog, AddHostToPoolCommand.EnableNtolDialog);
                action.Completed += Program.MainWindow.action_Completed;
                action.RunAsync();
                return;
            }

            MainWindowCommandInterface.ShowPerXenModelObjectWizard(host, new EvacuateHostDialog(host));
        }
Exemple #3
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));
            }
        }
Exemple #4
0
 protected override void ExecuteCore(SelectedItemCollection selection)
 {
     if (new CrossPoolMoveVMCommand(MainWindowCommandInterface, selection).CanExecute())
     {
         new CrossPoolMoveVMCommand(MainWindowCommandInterface, selection).Execute();
     }
     else
     {
         VM vm = (VM)selection[0].XenObject;
         MainWindowCommandInterface.ShowPerXenModelObjectWizard(vm, new MoveVMDialog(vm));
     }
 }
        protected override void ExecuteCore(SelectedItemCollection selection)
        {
            VM template = (VM)selection[0].XenObject;

            if (CrossPoolCopyTemplateCommand.CanExecute(template, null))
            {
                new CrossPoolCopyTemplateCommand(MainWindowCommandInterface, selection).Execute();
            }
            else
            {
                MainWindowCommandInterface.ShowPerXenModelObjectWizard(template, new CopyVMDialog(template));
            }
        }
Exemple #6
0
        protected override void ExecuteCore(SelectedItemCollection selection)
        {
            var cmd = new CrossPoolMoveVMCommand(MainWindowCommandInterface, selection);
            var con = selection.GetConnectionOfFirstItem();

            if (cmd.CanExecute() && !Helpers.FeatureForbidden(con, Host.RestrictCrossPoolMigrate))
            {
                cmd.Execute();
            }
            else
            {
                VM vm = (VM)selection[0].XenObject;
                MainWindowCommandInterface.ShowPerXenModelObjectWizard(vm, new MoveVMDialog(vm));
            }
        }
Exemple #7
0
        protected override void ExecuteCore(SelectedItemCollection selection)
        {
            VM vm = (VM)selection[0].XenObject;

            if (vm.VBDs.Count >= vm.MaxVBDsAllowed)
            {
                new ThreeButtonDialog(
                    new ThreeButtonDialog.Details(
                        SystemIcons.Error,
                        FriendlyErrorNames.VBDS_MAX_ALLOWED,
                        Messages.DISK_ATTACH)).ShowDialog(Program.MainWindow);
            }
            else
            {
                MainWindowCommandInterface.ShowPerXenModelObjectWizard(vm, new AttachDiskDialog(vm));
            }
        }
Exemple #8
0
        private void EnterMaintenanceMode(Host host)
        {
            Pool pool = Helpers.GetPool(host.Connection);

            if (pool != null && pool.ha_enabled && host.IsMaster())
            {
                new ThreeButtonDialog(
                    new ThreeButtonDialog.Details(
                        SystemIcons.Error,
                        String.Format(Messages.HA_CANNOT_EVACUATE_MASTER,
                                      Helpers.GetName(host).Ellipsise(Helpers.DEFAULT_NAME_TRIM_LENGTH)),
                        Messages.XENCENTER)).ShowDialog(Parent);
            }
            else
            {
                MainWindowCommandInterface.ShowPerXenModelObjectWizard(host, new EvacuateHostDialog(host));
            }
        }
Exemple #9
0
        protected override void ExecuteCore(SelectedItemCollection selection)
        {
            VM vm = (VM)selection[0].XenObject;

            MainWindowCommandInterface.ShowPerXenModelObjectWizard(vm, new CopyVMDialog(vm));
        }