Exemplo n.º 1
0
        private void RefreshTab(IVMPolicy policy)
        {
            /* when a policy does not have any VMs, irrespective of
             * the snapshot type, enable Quiesce
             */

            quiesceCheckBox.Enabled = (policy.VMs.Count == 0);

            switch (policy.policy_type)
            {
            case policy_backup_type.checkpoint:
                radioButtonDiskAndMemory.Checked = true;
                quiesceCheckBox.Enabled          = false;
                break;

            case policy_backup_type.snapshot:
                radioButtonDiskOnly.Checked = true;
                break;

            case policy_backup_type.snapshot_with_quiesce:
                radioButtonDiskOnly.Checked = true;

                /* when the snapshot type itself is quiesce then we need to
                 * enable it irrespective of the number of VMs ( > 1 condition)
                 */

                quiesceCheckBox.Enabled = true;
                quiesceCheckBox.Checked = true;
                break;
            }
            EnableShapshotTypes(policy.Connection, quiesceCheckBox.Enabled);
        }
Exemplo n.º 2
0
 public AssignVMsToPolicyAction(IVMPolicy policy, List <XenRef <VM> > selectedVMs, bool suppressHistory)
     : base(policy.Connection, (typeof(T) == typeof(VMPP) ? Messages.ASSIGN_PROTECTION_POLICY_NOAMP : Messages.ASSIGN_VMSS_POLICY_NOAMP), suppressHistory)
 {
     _policy      = policy;
     _selectedVMs = selectedVMs;
     Pool         = Helpers.GetPool(policy.Connection);
 }
Exemplo n.º 3
0
 public RemoveVMsFromPolicyAction(IVMPolicy policy, List <XenRef <VM> > selectedVMs)
     : base(policy.Connection,
            selectedVMs.Count == 1 ?
            string.Format(typeof(T) == typeof(VMPP) ? Messages.REMOVE_VM_FROM_POLICY : Messages.REMOVE_VM_FROM_VMSS, policy.Connection.Resolve(selectedVMs[0]), policy.Name) :
            string.Format(typeof(T) == typeof(VMPP) ? Messages.REMOVE_VMS_FROM_POLICY : Messages.REMOVE_VMS_FROM_VMSS, policy.Name))
 {
     _policy      = policy;
     _selectedVMs = selectedVMs;
     Pool         = Helpers.GetPool(policy.Connection);
 }
Exemplo n.º 4
0
 public PolicyRow(IVMPolicy policy)
 {
     Cells.Add(_name);
     Cells.Add(_status);
     Cells.Add(_numVMs);
     Cells.Add(_nextRunTime);
     Cells.Add(_nextArchiveRuntime);
     Cells.Add(_lastResult);
     _policy = policy;
     RefreshRow();
 }
Exemplo n.º 5
0
 public void RefreshTab(IVMPolicy policy)
 {
     _policy = policy;
     if (_policy == null)
     {
         labelHistory.Text = "";
         comboBox1.Enabled = false;
     }
     else
     {
         comboBox1.Enabled = true;
         StartRefreshTab();
     }
 }
Exemplo n.º 6
0
 public CreateVMPolicy(IVMPolicy record, List <VM> vms, bool runNow)
     : base(record.Connection, Messages.CREATE_POLICY)
 {
     _record = record;
     _vms    = vms;
     _runNow = runNow;
     Pool    = Helpers.GetPool(record.Connection);
     if (typeof(T) == typeof(VMPP))
     {
         ApiMethodsToRoleCheck.Add("VMPP.async_create");
         ApiMethodsToRoleCheck.Add("VM.set_protection_policy");
         ApiMethodsToRoleCheck.Add("VMPP.protect_now");
     }
     else
     {
         ApiMethodsToRoleCheck.Add("VMSS.async_create");
         ApiMethodsToRoleCheck.Add("VM.set_snapshot_schedule");
         ApiMethodsToRoleCheck.Add("VMSS.snapshot_now");
     }
 }
Exemplo n.º 7
0
        private void RefreshButtons()
        {
            if (dataGridView1.SelectedRows.Count == 1)
            {
                currentSelected          = ((PolicyRow)dataGridView1.SelectedRows[0])._policy;
                buttonEnable.Text        = currentSelected.is_enabled? Messages.DISABLE : Messages.ENABLE;
                buttonEnable.Enabled     = currentSelected.VMs.Count == 0 && !currentSelected.is_enabled? false : true;
                buttonProperties.Enabled = true;
                buttonRunNow.Enabled     = currentSelected.is_enabled && !currentSelected.is_archiving && !currentSelected.is_running;
            }
            else
            {
                currentSelected          = null;
                buttonProperties.Enabled = buttonEnable.Enabled = buttonRunNow.Enabled = false;
                policyHistory1.Clear();
            }

            policyHistory1.RefreshTab(currentSelected);
            buttonDelete.Enabled = (dataGridView1.SelectedRows.Count != 0);
        }
        private void RefreshTab(IVMPolicy policy)
        {
            if (ParentForm != null)
            {
                var parentFormType = ParentForm.GetType();

                if (parentFormType == typeof(XenWizardBase))
                {
                    sectionLabelSchedule.LineColor = sectionLabelNumber.LineColor = SystemColors.Window;
                }
                else if (parentFormType == typeof(PropertiesDialog))
                {
                    sectionLabelSchedule.LineColor = sectionLabelNumber.LineColor = SystemColors.ActiveBorder;
                }
            }

            switch (policy.policy_frequency)
            {
            case policy_frequency.hourly:
                radioButtonHourly.Checked = true;
                SetHourlyMinutes(Convert.ToDecimal(policy.backup_schedule_min));
                break;

            case policy_frequency.daily:
                radioButtonDaily.Checked  = true;
                dateTimePickerDaily.Value = new DateTime(1970, 1, 1, Convert.ToInt32(policy.backup_schedule_hour),
                                                         Convert.ToInt32(policy.backup_schedule_min), 0);
                break;

            case policy_frequency.weekly:
                radioButtonWeekly.Checked  = true;
                dateTimePickerWeekly.Value = new DateTime(1970, 1, 1, Convert.ToInt32(policy.backup_schedule_hour),
                                                          Convert.ToInt32(policy.backup_schedule_min), 0);
                daysWeekCheckboxes.Days = policy.backup_schedule_days;
                break;
            }

            numericUpDownRetention.Value = policy.policy_retention;
        }
Exemplo n.º 9
0
 public RunPolicyNowAction(IVMPolicy policy)
     : base(policy.Connection, string.Format(Messages.RUN_POLICY, policy.Name))
 {
     _policy = policy;
     Pool    = Helpers.GetPool(policy.Connection);
 }
 public void SetXenObjects(IXenObject orig, IXenObject clone)
 {
     _policyCopy = (IVMPolicy)clone;
     RefreshTab(_policyCopy);
 }
Exemplo n.º 11
0
 public ChangePolicyEnabledAction(IVMPolicy policy)
     : base(policy.Connection, string.Format(Messages.CHANGE_POLICY_STATUS, policy.Name))
 {
     _policy = policy;
     Pool    = Helpers.GetPool(_policy.Connection);
 }
Exemplo n.º 12
0
 public override void SetXenObjects(IXenObject orig, IXenObject clone)
 {
     _policy = (IVMPolicy)clone;
     RefreshTab(_policy);
 }
Exemplo n.º 13
0
 public PureAsyncAction getAlertsAction(IVMPolicy policy, int hoursfromnow)
 {
     return(new GetVMPPAlertsAction((VMPP)policy, hoursfromnow));
 }