コード例 #1
0
        protected override void Run()
        {
            ActionCountCompleted = 0;
            ActionCountTotal     = VmsToResume.Count + VmsToStart.Count;

            foreach (VM vm in VmsToResume)
            {
                Description = string.Format(Messages.ACTION_RESUMEANDSTARTVMS_RESUMINGN, ActionCountCompleted, VmsToResume.Count);

                AsyncAction action;
                if (CanVMBootOnHost(vm, Host))
                {
                    action = new VMResumeOnAction(vm, Host, _warningDialogHAInvalidConfig, _startDiagnosisForm);
                }
                else
                {
                    action = new VMResumeAction(vm, _warningDialogHAInvalidConfig, _startDiagnosisForm);
                }

                action.Changed += action_Changed;
                action.RunExternal(Session);
                ActionCountCompleted++;
            }

            foreach (VM vm in VmsToStart)
            {
                Description = string.Format(Messages.ACTION_RESUMEANDSTARTVMS_STARTINGN, ActionCountCompleted - VmsToResume.Count, VmsToStart.Count);

                AsyncAction action;
                if (CanVMBootOnHost(vm, Host))
                {
                    action = new VMStartOnAction(vm, Host, _warningDialogHAInvalidConfig, _startDiagnosisForm);
                }
                else
                {
                    action = new VMStartAction(vm, _warningDialogHAInvalidConfig, _startDiagnosisForm);
                }

                action.Changed += action_Changed;
                action.RunExternal(Session);
                ActionCountCompleted++;
            }
        }
コード例 #2
0
        protected override void Run()
        {
            ActionCountCompleted = 0;
            ActionCountTotal = VmsToResume.Count + VmsToStart.Count;

            foreach (VM vm in VmsToResume)
            {
                Description = string.Format("Resuming VM {0} of {1}", ActionCountCompleted, VmsToResume.Count);

                AsyncAction action;
                if (CanVMBootOnHost(vm, Host))
                    action = new VMResumeOnAction(vm, Host, _warningDialogHAInvalidConfig, _startDiagnosisForm);
                else
                    action = new VMResumeAction(vm, _warningDialogHAInvalidConfig, _startDiagnosisForm);

                action.Changed += action_Changed;
                action.RunExternal(Session);
                ActionCountCompleted++;
            }

            foreach (VM vm in VmsToStart)
            {
                Description = string.Format("Starting VM {0} of {1}", ActionCountCompleted - VmsToResume.Count, VmsToStart.Count);

                AsyncAction action;
                if (CanVMBootOnHost(vm, Host))
                    action = new VMStartOnAction(vm, Host, _warningDialogHAInvalidConfig, _startDiagnosisForm);
                else
                    action = new VMStartAction(vm, _warningDialogHAInvalidConfig, _startDiagnosisForm);

                action.Changed += action_Changed;
                action.RunExternal(Session);
                ActionCountCompleted++;
            }
        }