public override void PageLoaded(PageLoadedDirection direction) { base.PageLoaded(direction); if (SelectedTemplate == Template) { return; } initialising = true; Template = SelectedTemplate; if (Template.has_ballooning && Helpers.MidnightRideOrGreater(Template.Connection) && !Helpers.FeatureForbidden(Template, Host.RestrictDMC)) { memoryMode = (Template.memory_dynamic_max == Template.memory_static_max ? 2 : 3); } else { memoryMode = 1; } memoryRatio = VMMemoryControlsEdit.GetMemoryRatio(Template); VcpuSpinner.Minimum = 1; VcpuSpinner.Maximum = (decimal)(Template.MaxVCPUsAllowed); VcpuSpinner.Value = (decimal)(Template.VCPUs_at_startup); FreeSpinnerLimits(); if (memoryMode == 1) { spinnerDynMin.Initialize(Messages.MEMORY_COLON, null, Template.memory_static_max); spinnerDynMax.Visible = spinnerStatMax.Visible = false; } else { spinnerDynMax.Visible = true; spinnerDynMin.Initialize(Messages.DYNAMIC_MIN_COLON, null, Template.memory_dynamic_min); FreeSpinnerLimits(); // same as CA-33831 spinnerDynMax.Initialize(Messages.DYNAMIC_MAX_COLON, null, Template.memory_dynamic_max); if (memoryMode == 3) { FreeSpinnerLimits(); spinnerStatMax.Initialize(Messages.STATIC_MAX_COLON, null, Template.memory_static_max); } else { spinnerStatMax.Visible = false; } } comboBoxTopology.Populate(Template.VCPUs_at_startup, Template.VCPUs_max, Template.CoresPerSocket, Template.MaxCoresPerSocket); SetSpinnerLimits(); VcpuSpinner.Select(); ValuesUpdated(); initialising = false; }
public override void PageLoaded(PageLoadedDirection direction) { base.PageLoaded(direction); if (SelectedTemplate == Template) { return; } initialising = true; Template = SelectedTemplate; if (Template.has_ballooning && !Helpers.FeatureForbidden(Template, Host.RestrictDMC)) { memoryMode = (Template.memory_dynamic_max == Template.memory_static_max ? 2 : 3); } else { memoryMode = 1; } memoryRatio = VMMemoryControlsEdit.GetMemoryRatio(Template); FreeSpinnerLimits(); if (memoryMode == 1) { spinnerDynMin.Initialize(Messages.MEMORY_COLON, null, Template.memory_static_max, Template.memory_static_max); spinnerDynMax.Visible = spinnerStatMax.Visible = false; } else { spinnerDynMax.Visible = true; spinnerDynMin.Initialize(Messages.DYNAMIC_MIN_COLON, null, Template.memory_dynamic_min, Template.memory_static_max); FreeSpinnerLimits(); // same as CA-33831 spinnerDynMax.Initialize(Messages.DYNAMIC_MAX_COLON, null, Template.memory_dynamic_max, Template.memory_static_max); if (memoryMode == 3) { FreeSpinnerLimits(); spinnerStatMax.Initialize(Messages.STATIC_MAX_COLON, null, Template.memory_static_max, Template.memory_static_max); } else { spinnerStatMax.Visible = false; } } isVcpuHotplugSupported = Template.SupportsVcpuHotplug; _prevVCPUsMax = Template.VCPUs_max; // we use variable in RefreshCurrentVCPUs for checking if VcpusAtStartup and VcpusMax were equal before VcpusMax changed label5.Text = GetRubric(); InitialiseVcpuControls(); SetSpinnerLimitsAndIncrement(); ValuesUpdated(); initialising = false; }
public BallooningDialog(VM vm) : base(vm.Connection) { InitializeComponent(); _vm = vm; if (vm.advanced_ballooning()) { memoryControls = new VMMemoryControlsAdvanced(); labelRubric.Text = vm.is_a_template ? Messages.BALLOONING_RUBRIC_ADVANCED_TEMPLATE : Messages.BALLOONING_RUBRIC_ADVANCED; } else { memoryControls = new VMMemoryControlsBasic(); ((VMMemoryControlsBasic)memoryControls).InstallTools += BallooningDialog_InstallTools; labelRubric.Text = vm.is_a_template ? Messages.BALLOONING_RUBRIC_TEMPLATE : Messages.BALLOONING_RUBRIC; } panel1.Controls.Add(memoryControls); }
public BallooningDialog(VM vm, bool advanced) : base(vm.Connection) { InitializeComponent(); vmList = new List <VM>(1) { vm }; origStaticMax = vm.memory_static_max; this.advanced = advanced; if (advanced) { memoryControls = new VMMemoryControlsAdvanced(); labelRubric.Text = vm.is_a_template ? Messages.BALLOONING_RUBRIC_ADVANCED_TEMPLATE : Messages.BALLOONING_RUBRIC_ADVANCED; } else { memoryControls = new VMMemoryControlsBasic(); ((VMMemoryControlsBasic)memoryControls).InstallTools += BallooningDialog_InstallTools; labelRubric.Text = vm.is_a_template ? Messages.BALLOONING_RUBRIC_TEMPLATE : Messages.BALLOONING_RUBRIC; } panel1.Controls.Add(memoryControls); }
protected override void PageLoadedCore(PageLoadedDirection direction) { if (SelectedTemplate == Template) { return; } initialising = true; Template = SelectedTemplate; if (Template.has_ballooning() && !Helpers.FeatureForbidden(Template, Host.RestrictDMC)) { memoryMode = Template.memory_dynamic_max == Template.memory_static_max ? MemoryMode.MinimumAndMaximum : MemoryMode.MinimumMaximumAndStaticMax; } else { memoryMode = MemoryMode.JustMemory; } memoryRatio = VMMemoryControlsEdit.GetMemoryRatio(Template); FreeSpinnerLimits(); if (memoryMode == MemoryMode.JustMemory) { spinnerDynMin.Initialize(Template.memory_static_max, Template.memory_static_max); labelDynMin.Text = Messages.MEMORY_COLON; } else { labelDynMin.Text = Messages.DYNAMIC_MIN_COLON; spinnerDynMin.Initialize(Template.memory_dynamic_min, Template.memory_static_max); FreeSpinnerLimits(); // same as CA-33831 spinnerDynMax.Initialize(Template.memory_dynamic_max, Template.memory_static_max); if (memoryMode == MemoryMode.MinimumMaximumAndStaticMax) { FreeSpinnerLimits(); spinnerStatMax.Initialize(Template.memory_static_max, Template.memory_static_max); } } labelDynMaxInfo.Visible = labelDynMax.Visible = spinnerDynMax.Visible = memoryMode == MemoryMode.MinimumAndMaximum || memoryMode == MemoryMode.MinimumMaximumAndStaticMax; labelStatMaxInfo.Visible = labelStatMax.Visible = spinnerStatMax.Visible = memoryMode == MemoryMode.MinimumMaximumAndStaticMax; isVcpuHotplugSupported = Template.SupportsVcpuHotplug(); minVCPUs = Template.MinVCPUs(); _prevVCPUsMax = Template.VCPUs_max; // we use variable in RefreshCurrentVCPUs for checking if VcpusAtStartup and VcpusMax were equal before VcpusMax changed label5.Text = GetRubric(); InitialiseVcpuControls(); SetSpinnerLimitsAndIncrement(); ValuesUpdated(); initialising = false; }
private void ChooseControls(bool advanced) { if (advanced) { memoryControlsBasic.Visible = false; memoryControls = memoryControlsAdvanced; } else { memoryControlsAdvanced.Visible = false; memoryControls = memoryControlsBasic; } memoryControls.Visible = true; }
protected override void PageLoadedCore(PageLoadedDirection direction) { if (!_changed) { return; } if (VMs != null && VMs.Count > 0 && VMs[0].advanced_ballooning()) { memoryControlsBasic.Visible = false; memoryControls = memoryControlsAdvanced; } else { memoryControlsAdvanced.Visible = false; memoryControls = memoryControlsBasic; } memoryControls.VMs = VMs; memoryControls.Visible = true; }
private void SetSpinnerLimitsAndIncrement() { spinnerDynMin.Increment = spinnerDynMax.Increment = spinnerStatMax.Increment = VMMemoryControlsEdit.CalcIncrement(Template.memory_static_max, spinnerDynMin.Units); long maxMemAllowed = MaxMemAllowed; double min = Template.memory_static_min; if (memoryMode == MemoryMode.JustMemory) { spinnerDynMin.SetRange(min, maxMemAllowed); ShowMemoryMinMaxInformation(labelDynMinInfo, min, maxMemAllowed); return; } long min2 = (long)(SelectedMemoryStaticMax * memoryRatio); if (min < min2) { min = min2; } double max = SelectedMemoryDynamicMax; if (max < min) { max = min; } spinnerDynMin.SetRange(min, max); ShowMemoryMinMaxInformation(labelDynMinInfo, min, max); spinnerDynMax.SetRange(SelectedMemoryDynamicMin, memoryMode == MemoryMode.MinimumAndMaximum ? maxMemAllowed : SelectedMemoryStaticMax); ShowMemoryMinMaxInformation(labelDynMaxInfo, SelectedMemoryDynamicMin, memoryMode == MemoryMode.MinimumAndMaximum ? maxMemAllowed : SelectedMemoryStaticMax); spinnerStatMax.SetRange(SelectedMemoryDynamicMax, maxMemAllowed); ShowMemoryMinMaxInformation(labelStatMaxInfo, SelectedMemoryDynamicMax, maxMemAllowed); }