protected override void Run() { bool value = !_policy.enabled; Description = value ? string.Format(Messages.ENABLING_VMSS, _policy.Name()) : string.Format(Messages.DISABLING_VMSS, _policy.Name()); VMSS.set_enabled(Session, _policy.opaque_ref, !_policy.enabled); Description = value ? string.Format(Messages.ENABLED_VMSS, _policy.Name()) : string.Format(Messages.DISABLED_VMSS, _policy.Name()); }
public RemoveVMsFromPolicyAction(VMSS policy, List <XenRef <VM> > selectedVMs) : base(policy.Connection, selectedVMs.Count == 1 ? string.Format(Messages.REMOVE_VM_FROM_VMSS, policy.Connection.Resolve(selectedVMs[0]), policy.Name()) : string.Format(Messages.REMOVE_VMS_FROM_VMSS, policy.Name())) { _policy = policy; _selectedVMs = selectedVMs; Pool = Helpers.GetPool(policy.Connection); }
protected override void Run() { Description = string.Format(Messages.CREATING_VMSS, _record.Name()); RelatedTask = VMSS.async_create(Session, _record); PollToCompletion(); var vmssref = new XenRef <VMSS>(Result); Connection.WaitForCache(vmssref); foreach (var selectedVM in _vms) { VM.set_snapshot_schedule(Session, selectedVM.opaque_ref, vmssref.opaque_ref); } Description = string.Format(Messages.CREATED_VMSS, _record.Name()); PercentComplete = 60; if (_runNow) { VMSS.snapshot_now(Session, vmssref); } PercentComplete = 100; }
private void RefreshRow() { PolicyName = _policy.Name(); PolicyVmCount = _policy.VMs.FindAll(vm => _policy.Connection.Resolve(vm).is_a_real_vm()).Count; PolicyStatus = _policy.enabled ? Messages.ENABLED : Messages.DISABLED; if (_serverLocalTime.HasValue) { PolicyNextRunTime = _policy.GetNextRunTime(_serverLocalTime.Value); } else { PolicyNextRunTime = null; } if (_alertMessages.Count > 0) { if (_alertMessages[0].priority == PolicyAlert.INFO_PRIORITY) { PolicyLastResult = Messages.VMSS_SUCCEEDED; PolicyLastResultImage = Resources._075_TickRound_h32bit_16; } else { PolicyLastResult = Messages.FAILED; PolicyLastResultImage = Resources._075_WarningRound_h32bit_16; } } else { PolicyLastResult = Messages.NOT_YET_RUN; PolicyLastResultImage = null; } _name.Value = PolicyName; _numVMs.Value = PolicyVmCount; _status.Value = PolicyStatus; _lastResult.Value = PolicyLastResult; _lastResult.Image = PolicyLastResultImage; _nextRunTime.Value = PolicyNextRunTime.HasValue ? HelpersGUI.DateTimeToString(PolicyNextRunTime.Value, Messages.DATEFORMAT_DMY_HM, true) : Messages.VMSS_HOST_NOT_LIVE; }
public ChangePolicyEnabledAction(VMSS policy) : base(policy.Connection, string.Format(Messages.CHANGE_POLICY_STATUS, policy.Name())) { _policy = policy; Pool = Helpers.GetPool(_policy.Connection); }
protected override void Run() { Result = VMSS.snapshot_now(Session, _policy.opaque_ref); Description = string.Format(Messages.RUN_POLICY_STARTED, _policy.Name()); }
public RunPolicyNowAction(VMSS policy) : base(policy.Connection, string.Format(Messages.RUN_POLICY, policy.Name())) { _policy = policy; Pool = Helpers.GetPool(policy.Connection); }