private void InitDialog(IXenConnection connection) { this.Owner = Program.MainWindow; SrListBox.Connection = connection; SrListBox.SrHint.Visible = false; // Add events NameTextBox.Text = GetDefaultVDIName(); SrListBox.srListBox.SelectedIndexChanged += new EventHandler(srListBox_SelectedIndexChanged); SrListBox.ItemSelectionNotNull += new EventHandler(SrListBox_ItemSelectionNotNull); SrListBox.ItemSelectionNull += new EventHandler(SrListBox_ItemSelectionNull); srListBox_SelectedIndexChanged(null, null); DiskSizeNumericUpDown.TextChanged += new EventHandler(DiskSizeNumericUpDown_TextChanged); max = (decimal)Math.Pow(1024, 4);//1 Petabit min = 0; comboBoxUnits.SelectedItem = comboBoxUnits.Items[0]; init_alloc_units.SelectedItem = init_alloc_units.Items[1]; incr_alloc_units.SelectedItem = incr_alloc_units.Items[1]; previousUnitsValueIncrAlloc = previousUnitsValueInitAlloc = Messages.VAL_MEGB; comboBoxUnits.SelectedIndexChanged += new EventHandler(comboBoxUnits_SelectedIndexChanged); SetNumUpDownIncrementAndDecimals(DiskSizeNumericUpDown, comboBoxUnits.SelectedItem.ToString()); }
public SrPicker(IXenConnection connection) { this.connection = connection; InitializeComponent(); srListBox.ShowCheckboxes = false; srListBox.ShowDescription = true; srListBox.ShowImages = true; srListBox.NodeIndent = 3; srListBox.SelectedIndexChanged += new EventHandler(srListBox_SelectedIndexChanged); SrHint.Text = usage == SRPickerType.MoveOrCopy ? Messages.IMPORT_WIZARD_TEMPLATE_SR_HINT_TEXT : Messages.IMPORT_WIZARD_VM_SR_HINT_TEXT; Pool pool = Helpers.GetPoolOfOne(connection); if (pool != null) { pool.PropertyChanged -= Server_PropertyChanged; pool.PropertyChanged += Server_PropertyChanged; } SR_CollectionChangedWithInvoke=Program.ProgramInvokeHandler(SR_CollectionChanged); connection.Cache.RegisterCollectionChanged<SR>(SR_CollectionChangedWithInvoke); refresh(); }
/// <summary> /// Displays a dialog informing the user they need a different role to complete the task, and offers the chance to switch user. Optionally logs /// out the elevated session. If successful exposes the elevated session, password and username as fields. /// </summary> /// <param name="connection">The current server connection with the role information</param> /// <param name="session">The session on which we have been denied access</param> /// <param name="authorizedRoles">A list of roles that are able to complete the task</param> /// <param name="actionTitle">A description of the current action, if null or empty will not be displayed</param> public RoleElevationDialog(IXenConnection connection, Session session, List<Role> authorizedRoles, string actionTitle) { InitializeComponent(); Image icon = SystemIcons.Exclamation.ToBitmap(); pictureBox1.Image = icon; pictureBox1.Width = icon.Width; pictureBox1.Height = icon.Height; this.connection = connection; UserDetails ud = session.CurrentUserDetails; labelCurrentUserValue.Text = ud.UserDisplayName ?? ud.UserName ?? Messages.UNKNOWN_AD_USER; labelCurrentRoleValue.Text = Role.FriendlyCSVRoleList(session.Roles); authorizedRoles.Sort((r1, r2) => r2.CompareTo(r1)); labelRequiredRoleValue.Text = Role.FriendlyCSVRoleList(authorizedRoles); labelServerValue.Text = Helpers.GetName(connection); labelServer.Text = Helpers.IsPool(connection) ? Messages.POOL_COLON : Messages.SERVER_COLON; originalUsername = session.Connection.Username; originalPassword = session.Connection.Password; if (string.IsNullOrEmpty(actionTitle)) { labelCurrentAction.Visible = false; labelCurrentActionValue.Visible = false; } else { labelCurrentActionValue.Text = actionTitle; } this.authorizedRoles = authorizedRoles; }
public ExportApplianceWizard(IXenConnection con, SelectedItemCollection selection) : base(con) { InitializeComponent(); m_pageExportAppliance = new ExportAppliancePage(); m_pageRbac = new RBACWarningPage(); m_pageExportSelectVMs = new ExportSelectVMsPage(); m_pageExportEula = new ExportEulaPage(); m_pageExportOptions = new ExportOptionsPage(); m_pageTvmIp = new TvmIpPage(); m_pageFinish = new ExportFinishPage(); m_selectedObject = selection.FirstAsXenObject; if (selection.Count == 1 && (m_selectedObject is VM || m_selectedObject is VM_appliance)) m_pageExportAppliance.ApplianceFileName = m_selectedObject.Name; m_pageExportAppliance.OvfModeOnly = m_selectedObject is VM_appliance; m_pageTvmIp.IsExportMode = true; m_pageFinish.SummaryRetreiver = GetSummary; m_pageExportSelectVMs.SelectedItems = selection; AddPages(m_pageExportAppliance, m_pageExportSelectVMs, m_pageFinish); }
public void PopulateComboBox(IXenConnection connection) { PopulateConnection = connection; Items.Clear(); var pifArray = connection.Cache.PIFs; foreach (var pif in pifArray) { var curPif = pif; var count = (from NetworkComboBoxItem existingItem in Items where existingItem.Network.opaque_ref == curPif.network.opaque_ref select existingItem).Count(); if (count > 0) continue; var item = CreateNewItem(pif); AddItemToComboBox(item); if (item.IsManagement) { SelectedItem = item; } } }
/// <summary> /// Initializes a new instance of the <see cref="SelectedItem"/> class. /// </summary> /// <param name="xenObject">The xen object that is selected.</param> /// <param name="connection">The connection of the xen object.</param> /// <param name="hostAncestor">The host ancestor of the xen object in the tree.</param> /// <param name="poolAncestor">The pool ancestor of the xen object in the tree.</param> public SelectedItem(IXenObject xenObject, IXenConnection connection, Host hostAncestor, Pool poolAncestor) { _xenObject = xenObject; _hostAncestor = hostAncestor; _poolAncestor = poolAncestor; _connection = connection; }
/// <summary> /// This constructor is used to upload a single 'normal' patch /// </summary> /// <param name="connection"></param> /// <param name="path"></param> public UploadPatchAction(IXenConnection connection, string path) : base(connection, null, Messages.UPLOADING_PATCH) { Host master = Helpers.GetMaster(connection); if (master == null) throw new NullReferenceException(); ApiMethodsToRoleCheck.Add("pool.sync_database"); ApiMethodsToRoleCheck.Add("http/put_oem_patch_stream"); ApiMethodsToRoleCheck.Add("http/put_pool_patch_upload"); if (master.isOEM) { embeddedHosts = new List<Host>(connection.Cache.Hosts); embeddedPatchPath = path; retailHosts = new List<Host>(); retailPatchPath = string.Empty; } else { retailHosts = new List<Host>(new Host[] { master }); retailPatchPath = path; embeddedHosts = new List<Host>(); embeddedPatchPath = string.Empty; } Host = master; }
public static Session CreateSession(Session session, IXenConnection connection, int timeout) { if (Helpers.DbProxyIsSimulatorUrl(session.Url)) return new Session(session, DbProxy.GetProxy(connection, session.Url), connection); else return new Session(session, connection, timeout); }
public PatchPrechecksOnMultipleHostsInAPoolPlanAction(IXenConnection connection, XenServerPatch patch, List<Host> hosts, List<PoolPatchMapping> mappings) : base(connection, string.Format("Precheck for {0} in {1}...", patch.Name, connection.Name)) { this.patch = patch; this.hosts = hosts; this.mappings = mappings; }
private void Execute(IXenConnection connection) { if (connection == null) return; Pool pool = Helpers.GetPool(connection); if (pool == null) return; if (Helpers.FeatureForbidden(pool, Host.RestrictHA)) { // Show upsell dialog UpsellDialog dlg = new UpsellDialog(Messages.UPSELL_BLURB_HA, InvisibleMessages.UPSELL_LEARNMOREURL_HA); dlg.ShowDialog(Parent); } else if (pool.ha_enabled) { // Show VM restart priority editor MainWindowCommandInterface.ShowPerConnectionWizard(connection, new EditVmHaPrioritiesDialog(pool)); } else { // Show wizard to enable HA MainWindowCommandInterface.ShowPerConnectionWizard(connection, new HAWizard(pool)); } }
public static Session CreateSession(IXenConnection connection, string hostname, int port) { if (Helpers.DbProxyIsSimulatorUrl(hostname)) return new Session(DbProxy.GetProxy(connection, hostname), connection); else return new Session(Session.STANDARD_TIMEOUT, connection, hostname, port); }
public MigrateVirtualDiskAction(IXenConnection connection, VDI vdi, SR sr) : base(connection, string.Format(Messages.ACTION_MOVING_VDI_TITLE, Helpers.GetName(vdi), Helpers.GetName(sr))) { Description = Messages.ACTION_PREPARING; this.vdi = vdi; SR = sr; }
public MultipleAction(IXenConnection connection, string title, string startDescription, string endDescription, List<AsyncAction> subActions, bool suppressHistory) : base(connection, title, startDescription, suppressHistory) { this.endDescription = endDescription; this.subActions = subActions; this.Completed += MultipleAction_Completed; }
private void Update(IXenConnection connection) { Host master = Helpers.GetMaster(connection); if (master == null) return; Pool pool = Helpers.GetPoolOfOne(connection); labelCHIN.Visible = rbtnCHIN.Visible = !HiddenFeatures.CrossServerPrivateNetworkHidden; if (!pool.vSwitchController) { rbtnCHIN.Checked = false; rbtnCHIN.Enabled = labelCHIN.Enabled = false; labelWarningChinOption.Text = Helpers.FeatureForbidden(connection, Host.RestrictVSwitchController) ? Messages.FIELD_DISABLED : Messages.CHINS_NEED_VSWITCHCONTROLLER; iconWarningChinOption.Visible = labelWarningChinOption.Visible = !HiddenFeatures.CrossServerPrivateNetworkHidden; rbtnExternalNetwork.Checked = true; } else { rbtnCHIN.Enabled = labelCHIN.Enabled = true; iconWarningChinOption.Visible = labelWarningChinOption.Visible = false; } }
public XenServerHealthCheckBundleUpload(IXenConnection _connection) { connection = _connection; server.HostName = connection.Hostname; server.UserName = connection.Username; server.Password = connection.Password; }
public NewCustomFieldDialog(IXenConnection c) { InitializeComponent(); this.connection = c; okButton.Enabled = !string.IsNullOrEmpty(NameTextBox.Text); TypeComboBox.SelectedIndex = 0; }
/// <summary> /// Dialog with defaults taken from an existing IXenConnection /// </summary> /// <param name="connection">The IXenConnection from which the values will be taken. May be null, in which case an appropriate new /// connection will be created when the dialog is completed.</param> public AddServerDialog(IXenConnection connection, bool changedPass) : base(connection) { _changedPass = changedPass; InitializeComponent(); PopulateXenServerHosts(); if (connection != null) { ServerNameComboBox.Text = connection.HostnameWithPort; UsernameTextBox.Text = connection.Username; PasswordTextBox.Text = connection.Password ?? ""; } // we have an inner table layout panel due to the group box. Align the columns by examining lables sizes Label[] labels = { UsernameLabel, PasswordLabel, ServerNameLabel }; int biggest = 0; foreach (Label l in labels) { if (l.Width > biggest) biggest = l.Width; } // set the minimum size of one label from each table which will make sure the columns line up UsernameLabel.MinimumSize = new Size(biggest, UsernameLabel.Height); ServerNameLabel.MinimumSize = new Size(biggest, ServerNameLabel.Height); }
public SaveDataSourceStateAction(IXenConnection connection, IXenObject xmo, List<DataSourceItem> items, List<DesignedGraph> graphs) : base(connection, "Saving DataSources", "Saving DataSources", true) { DataSourceItems = items; XenObject = xmo; Graphs = graphs; }
public PerfmonOptionsDefinitionAction(IXenConnection connection, PerfmonOptionsDefinition perfmonOptions) : base(connection, Messages.ACTION_CHANGE_EMAIL_OPTIONS) { this.perfmonOptions = perfmonOptions; pool = Helpers.GetPoolOfOne(connection); this.Description = string.Format(Messages.ACTION_CHANGING_EMAIL_OPTIONS_FOR, pool); }
public CrossPoolMigrateWizard(IXenConnection con, IEnumerable<SelectedItem> selection, Host targetHostPreSelection) : base(con) { InitializeComponent(); hostPreSelection = targetHostPreSelection; InitialiseWizard(selection); }
private void Update(IXenConnection connection) { Host master = Helpers.GetMaster(connection); if (master == null) return; Pool pool = Helpers.GetPoolOfOne(connection); if (!pool.vSwitchController) { rbtnCHIN.Checked = false; rbtnCHIN.Enabled = labelCHIN.Enabled = false; labelWarningChinOption.Text = Helpers.FeatureForbidden(connection, Host.RestrictVSwitchController) ? string.Format(Messages.FEATURE_NOT_AVAILABLE_NEED_ENTERPRISE_OR_PLATINUM_PLURAL, Messages.CHINS) : Messages.CHINS_NEED_VSWITCHCONTROLLER; iconWarningChinOption.Visible = labelWarningChinOption.Visible = true; rbtnExternalNetwork.Checked = true; } else { rbtnCHIN.Enabled = labelCHIN.Enabled = true; iconWarningChinOption.Visible = labelWarningChinOption.Visible = false; } }
/// <summary> /// All dialog that extend this one MUST be set to the same size as this, otherwise layout will break. /// If you want I different size, I suggest you do it in you derived forms on_load. /// </summary> /// <param name="connection"></param> public DialogWithProgress(IXenConnection connection) : base(connection) { InitializeComponent(); RegisterProgressControls(); }
public ImportVmAction(IXenConnection connection, Host affinity, string filename, SR sr) : base(connection, string.Format(Messages.IMPORTVM_TITLE, filename, Helpers.GetName(connection)), Messages.IMPORTVM_PREP) { Pool = Helpers.GetPoolOfOne(connection); m_affinity = affinity; Host = affinity ?? connection.Resolve(Pool.master); SR = sr; VM = null; m_filename = filename; #region RBAC Dependencies ApiMethodsToRoleCheck.AddRange(ConstantRBACRequirements); if (affinity != null) ApiMethodsToRoleCheck.Add("vm.set_affinity"); //?? //if (startAutomatically) // ApiMethodsToRoleCheck.Add("vm.start"); ApiMethodsToRoleCheck.AddRange(Role.CommonTaskApiList); ApiMethodsToRoleCheck.AddRange(Role.CommonSessionApiList); #endregion }
/// <summary> /// Call this to check the server licenses when a connection has been made or on periodic check. /// If a license has expired, the user is warned. /// The logic for the periodic license warning check: only shows the less than 30 day warnings once every day XC is running. /// </summary> /// <param name="connection">The connection to check licenses on</param> /// <param name="periodicCheck">Whehter it is a periodic check</param> internal bool CheckActiveServerLicense(IXenConnection connection, bool periodicCheck) { if (Helpers.ClearwaterOrGreater(connection)) return false; DateTime now = DateTime.UtcNow - connection.ServerTimeOffset; foreach (Host host in connection.Cache.Hosts) { if (host.IsXCP) continue; DateTime expiryDate = host.LicenseExpiryUTC; TimeSpan timeToExpiry = expiryDate.Subtract(now); if (expiryDate < now) { // License has expired. Pop up the License Manager. Program.Invoke(Program.MainWindow, () => showLicenseSummaryExpired(host, now, expiryDate)); return true; } if (timeToExpiry < CONNECTION_WARN_THRESHOLD && (!periodicCheck || DateTime.UtcNow.Subtract(lastPeriodicLicenseWarning) > RUNNING_WARN_FREQUENCY)) { // If the license is sufficiently close to expiry date, show the warning // If it's a periodic check, only warn if XC has been open for one day if (periodicCheck) lastPeriodicLicenseWarning = DateTime.UtcNow; Program.Invoke(Program.MainWindow, () => showLicenseSummaryWarning(Helpers.GetName(host), now, expiryDate)); return true; } } return false; }
public ImportWizard(IXenConnection con, IXenObject xenObject, string filename, bool ovfModeOnly) : base(con) { InitializeComponent(); m_pageStorage = new ImportSelectStoragePage(); m_pageNetwork = new ImportSelectNetworkPage(); m_pageHost = new ImportSelectHostPage(); m_pageSecurity = new ImportSecurityPage(); m_pageEula = new ImportEulaPage(); m_pageOptions = new ImportOptionsPage(); m_pageFinish = new ImportFinishPage(); m_pageRbac = new RBACWarningPage(); m_pageTvmIp = new TvmIpPage(); m_pageVMconfig = new ImageVMConfigPage(); m_pageImportSource = new ImportSourcePage(); m_pageXvaStorage = new StoragePickerPage(); m_pageXvaNetwork = new NetworkPickerPage(); m_pageXvaHost = new GlobalSelectHost(); lunPerVdiMappingPage = new LunPerVdiImportPage { Connection = con }; m_selectedObject = xenObject; m_pageTvmIp.IsExportMode = false; m_pageFinish.SummaryRetreiver = GetSummary; m_pageXvaStorage.ImportVmCompleted += m_pageXvaStorage_ImportVmCompleted; if (!string.IsNullOrEmpty(filename)) m_pageImportSource.SetFileName(filename); m_pageImportSource.OvfModeOnly = ovfModeOnly; AddPages(m_pageImportSource, m_pageHost, m_pageStorage, m_pageNetwork, m_pageFinish); }
public SetVMOtherConfigAction(IXenConnection connection, VM vm, string key, string val) : base(connection, "Set VM other_config", true) { VM = vm; Key = key; Val = val; }
public CopyPatchFromHostToOther(IXenConnection connection, Host hostDestiny, Pool_patch patchToCopy) : base(connection, Messages.UPLOADING_PATCH, true) { _hostDestiny = hostDestiny; _patchToCopy = patchToCopy; Host = _hostDestiny; }
/// <summary> /// Won't appear in the program history (SuppressHistory == true). /// </summary> /// <param name="masterUuid">The UUID of the host from which to perform the probe (usually the pool master).</param> /// <param name="srType">netapp or iscsi</param> public SrProbeAction(IXenConnection connection, Host host, SR.SRTypes srType, Dictionary<String, String> dconf) : base(connection, string.Format(Messages.ACTION_SCANNING_SR_FROM, Helpers.GetName(connection)), null, true) { this.host = host; this.srType = srType; this.dconf = dconf; switch (srType) { case XenAPI.SR.SRTypes.nfs: Description = string.Format(Messages.ACTION_SR_SCANNING, XenAPI.SR.getFriendlyTypeName(srType), dconf["server"]); break; case XenAPI.SR.SRTypes.lvmoiscsi: Description = string.Format(Messages.ACTION_SR_SCANNING, XenAPI.SR.getFriendlyTypeName(srType), dconf["target"]); break; case XenAPI.SR.SRTypes.lvmohba: String device = dconf.ContainsKey(DEVICE) ? dconf[DEVICE] : dconf[SCSIid]; Description = string.Format(Messages.ACTION_SR_SCANNING, XenAPI.SR.getFriendlyTypeName(srType), device); break; default: Description = string.Format(Messages.ACTION_SR_SCANNING, XenAPI.SR.getFriendlyTypeName(srType), Messages.REPAIRSR_SERVER); // this is a bit minging: CA-22111 break; } smconf = new Dictionary<string, string>(); }
public CrossPoolMigrateWizard(IXenConnection con, IEnumerable<SelectedItem> selection, WizardMode mode) : base(con) { InitializeComponent(); wizardMode = mode; InitialiseWizard(selection); }
/// <summary> /// Boston or greater constructor /// </summary> /// <param name="connection"></param> public SrCslgStorageSystemScanAction(IXenConnection connection, string adapterid, string target, string user, string password) : base(connection, target, user, password) { if (!Helpers.BostonOrGreater(connection)) throw new ArgumentException(@"Invalid connection, it has to be a boston or greater connection", connection.Name); _adapterid = adapterid; }
/// <summary> /// /// </summary> /// <param name="connection"></param> /// <param name="vm">The VM to export.</param> /// <param name="host">Used for filtering purposes. May be null.</param> private void Execute(IXenConnection connection, VM vm, Host host) { /* * These properties have not been copied over to the new save file dialog. * * dlg.AddExtension = true; * dlg.CheckPathExists = true; * dlg.CreatePrompt = false; * dlg.CheckFileExists = false; * dlg.OverwritePrompt = true; * dlg.ValidateNames = true;*/ string filename; bool verify; // Showing this dialog has the (undocumented) side effect of changing the working directory // to that of the file selected. This means a handle to the directory persists, making // it undeletable until the program exits, or the working dir moves on. So, save and // restore the working dir... String oldDir = ""; try { oldDir = Directory.GetCurrentDirectory(); while (true) { ExportVMDialog dlg = new ExportVMDialog(); dlg.DefaultExt = "xva"; dlg.Filter = Messages.MAINWINDOW_XVA_BLURB; dlg.Title = Messages.MAINWINDOW_XVA_TITLE; if (dlg.ShowDialog(Parent) != DialogResult.OK) { return; } filename = dlg.FileName; verify = dlg.Verify; // CA-12975: Warn the user if the export operation does not have enough disk space to // complete. This is an approximation only. Win32.DiskSpaceInfo diskSpaceInfo = Win32.GetDiskSpaceInfo(dlg.FileName); if (diskSpaceInfo == null) { // Could not determine free disk space. Carry on regardless. break; } else { ulong freeSpace = diskSpaceInfo.FreeBytesAvailable; decimal neededSpace = vm.GetRecommendedExportSpace(Properties.Settings.Default.ShowHiddenVMs); ulong spaceLeft = 100 * Util.BINARY_MEGA; // We want the user to be left with some disk space afterwards if (neededSpace >= freeSpace - spaceLeft) { string msg = string.Format(Messages.CONFIRM_EXPORT_NOT_ENOUGH_MEMORY, Util.DiskSizeString((long)neededSpace), Util.DiskSizeString((long)freeSpace), vm.Name); DialogResult dr; using (var d = new ThreeButtonDialog( new ThreeButtonDialog.Details(SystemIcons.Warning, msg), "ExportVmDialogInsufficientDiskSpace", new ThreeButtonDialog.TBDButton(Messages.CONTINUE_WITH_EXPORT, DialogResult.OK), new ThreeButtonDialog.TBDButton(Messages.CHOOSE_ANOTHER_DESTINATION, DialogResult.Retry), ThreeButtonDialog.ButtonCancel)) { dr = d.ShowDialog(Parent); } if (dr == DialogResult.Retry) { continue; } else if (dr == DialogResult.Cancel) { return; } } if (diskSpaceInfo.IsFAT && neededSpace > (4 * Util.BINARY_GIGA) - 1) { string msg = string.Format(Messages.CONFIRM_EXPORT_FAT, Util.DiskSizeString((long)neededSpace), Util.DiskSizeString(4 * Util.BINARY_GIGA), vm.Name); DialogResult dr; using (var d = new ThreeButtonDialog( new ThreeButtonDialog.Details(SystemIcons.Warning, msg), "ExportVmDialogFSLimitExceeded", new ThreeButtonDialog.TBDButton(Messages.CONTINUE_WITH_EXPORT, DialogResult.OK), new ThreeButtonDialog.TBDButton(Messages.CHOOSE_ANOTHER_DESTINATION, DialogResult.Retry), ThreeButtonDialog.ButtonCancel)) { dr = d.ShowDialog(Parent); } if (dr == DialogResult.Retry) { continue; } else if (dr == DialogResult.Cancel) { return; } } break; } } } finally { Directory.SetCurrentDirectory(oldDir); } new ExportVmAction(connection, host, vm, filename, verify).RunAsync(); }
public override void ResetSrName(IXenConnection connection) { SrName = SrWizardHelpers.DefaultSRName(Messages.NEWSR_HBA_DEFAULT_NAME, connection); }
public override void ResetSrName(IXenConnection connection) { SrName = SrWizardHelpers.DefaultSRName(Messages.SRWIZARD_ISCSI_STORAGE, connection); }
public override void ResetSrName(IXenConnection connection) { SrName = SrWizardHelpers.DefaultSRName(Messages.SRWIZARD_CIFS_LIBRARY, connection); }
public virtual void ResetSrName(IXenConnection connection) { SrName = SrWizardHelpers.DefaultSRName(String.Format(Messages.SRWIZARD_STORAGE_NAME, SR.getFriendlyTypeName(Type)), connection); }
private void pageHost_ConnectionSelectionChanged(IXenConnection connection) { ShowXenAppXenDesktopWarning(connection); }
protected override void UpdateWizardContent(XenTabPage page) { Type type = page.GetType(); if (type == typeof(ImportSourcePage)) { #region ImportSourcePage var oldTypeOfImport = m_typeOfImport; //store previous type m_typeOfImport = m_pageImportSource.TypeOfImport; var appliancePages = new XenTabPage[] { m_pageEula, m_pageHost, m_pageStorage, m_pageNetwork, m_pageSecurity, m_pageOptions, m_pageTvmIp }; var imagePages = new XenTabPage[] { m_pageVMconfig, m_pageHost, m_pageStorage, m_pageNetwork, m_pageOptions, m_pageTvmIp }; var xvaPages = new XenTabPage[] { m_pageXvaHost, m_pageXvaStorage, m_pageXvaNetwork }; switch (m_typeOfImport) { case ImportType.Ovf: if (oldTypeOfImport != ImportType.Ovf) { Text = Messages.WIZARD_TEXT_IMPORT_OVF; pictureBoxWizard.Image = Properties.Resources._000_ImportVirtualAppliance_h32bit_32; m_pageFinish.ShowStartVmsGroupBox = false; RemovePages(imagePages); RemovePage(m_pageBootOptions); RemovePages(xvaPages); AddAfterPage(m_pageImportSource, appliancePages); } m_pageEula.SelectedOvfEnvelope = m_pageImportSource.SelectedOvfEnvelope; m_pageSecurity.SelectedOvfPackage = m_pageImportSource.SelectedOvfPackage; CheckDisabledPages(m_pageEula, m_pageSecurity); //decide whether to disable these progress steps ResetVmMappings(m_pageImportSource.SelectedOvfEnvelope); m_pageHost.SelectedOvfEnvelope = m_pageImportSource.SelectedOvfEnvelope; m_pageHost.SetDefaultTarget(m_pageHost.ChosenItem ?? m_selectedObject); m_pageHost.VmMappings = m_vmMappings; m_pageStorage.SelectedOvfEnvelope = m_pageImportSource.SelectedOvfEnvelope; lunPerVdiMappingPage.SelectedOvfEnvelope = m_pageImportSource.SelectedOvfEnvelope; m_pageNetwork.SelectedOvfEnvelope = m_pageImportSource.SelectedOvfEnvelope; NotifyNextPagesOfChange(m_pageEula, m_pageHost, m_pageStorage, m_pageNetwork, m_pageSecurity, m_pageOptions); break; case ImportType.Vhd: if (oldTypeOfImport != ImportType.Vhd) { Text = Messages.WIZARD_TEXT_IMPORT_VHD; pictureBoxWizard.Image = Properties.Resources._000_ImportVM_h32bit_32; m_pageFinish.ShowStartVmsGroupBox = false; RemovePages(appliancePages); RemovePages(xvaPages); AddAfterPage(m_pageImportSource, imagePages); } m_pageVMconfig.IsWim = m_pageImportSource.IsWIM; m_pageHost.SetDefaultTarget(m_pageHost.ChosenItem ?? m_selectedObject); m_pageHost.SelectedOvfEnvelope = null; m_pageHost.VmMappings = m_vmMappings; NotifyNextPagesOfChange(m_pageVMconfig, m_pageHost, m_pageStorage, m_pageNetwork, m_pageOptions); break; case ImportType.Xva: if (oldTypeOfImport != ImportType.Xva) { Text = Messages.WIZARD_TEXT_IMPORT_XVA; pictureBoxWizard.Image = Properties.Resources._000_ImportVM_h32bit_32; m_pageFinish.ShowStartVmsGroupBox = true; RemovePages(imagePages); RemovePage(m_pageBootOptions); RemovePages(appliancePages); AddAfterPage(m_pageImportSource, xvaPages); } m_pageXvaHost.SetDefaultTarget(m_selectedObject); m_pageXvaStorage.FilePath = m_pageImportSource.FilePath; break; } #endregion } else if (type == typeof(ImageVMConfigPage)) { //then use it to create an ovf for the import m_envelopeFromVhd = OVF.CreateOvfEnvelope(m_pageVMconfig.VmName, m_pageVMconfig.CpuCount, m_pageVMconfig.Memory, m_pageBootOptions.BootParams, m_pageBootOptions.PlatformSettings, m_pageImportSource.DiskCapacity, m_pageImportSource.IsWIM, m_pageVMconfig.AdditionalSpace, m_pageImportSource.FilePath, m_pageImportSource.ImageLength); m_pageStorage.SelectedOvfEnvelope = m_envelopeFromVhd; lunPerVdiMappingPage.SelectedOvfEnvelope = m_envelopeFromVhd; m_pageNetwork.SelectedOvfEnvelope = m_envelopeFromVhd; ResetVmMappings(m_envelopeFromVhd); NotifyNextPagesOfChange(m_pageHost, m_pageStorage, m_pageNetwork); } else if (type == typeof(ImportSelectHostPage)) { TargetConnection = m_pageHost.ChosenItem == null ? null : m_pageHost.ChosenItem.Connection; RemovePage(m_pageRbac); ConfigureRbacPage(TargetConnection); m_vmMappings = m_pageHost.VmMappings; m_pageStorage.VmMappings = m_vmMappings; m_pageStorage.Connection = TargetConnection; m_pageNetwork.Connection = TargetConnection; m_pageOptions.Connection = TargetConnection; m_pageTvmIp.Connection = TargetConnection; RemovePage(m_pageBootOptions); if (m_typeOfImport == ImportType.Vhd && BootModesControl.ShowBootModeOptions(TargetConnection)) { AddAfterPage(m_pageNetwork, m_pageBootOptions); m_pageBootOptions.Connection = TargetConnection; } m_pageBootOptions.Connection = TargetConnection; NotifyNextPagesOfChange(m_pageStorage, m_pageNetwork, m_pageOptions, m_pageTvmIp); } else if (type == typeof(ImportSelectStoragePage)) { RemovePage(lunPerVdiMappingPage); lunPerVdiMappingPage.ClearPickerData(); m_vmMappings = m_pageStorage.VmMappings; m_pageNetwork.VmMappings = m_vmMappings; lunPerVdiMappingPage.VmMappings = m_vmMappings; if (lunPerVdiMappingPage.IsAnyPickerDataMappable && lunPerVdiMappingPage.MapLunsToVdisRequired && m_typeOfImport == ImportType.Ovf) { AddAfterPage(m_pageStorage, lunPerVdiMappingPage); } } else if (type == typeof(LunPerVdiImportPage)) { m_vmMappings = lunPerVdiMappingPage.VmMappings; m_pageNetwork.VmMappings = m_vmMappings; } else if (type == typeof(ImportSelectNetworkPage)) { m_vmMappings = m_pageNetwork.VmMappings; m_pageOptions.VmMappings = m_vmMappings; } else if (type == typeof(GlobalSelectHost)) { var con = m_pageXvaHost.SelectedHost == null ? m_pageXvaHost.SelectedConnection : m_pageXvaHost.SelectedHost.Connection; RemovePage(m_pageRbac); ConfigureRbacPage(con); m_pageXvaStorage.SetConnection(con); m_pageXvaStorage.SetTargetHost(m_ignoreAffinitySet ? null : m_pageXvaHost.SelectedHost); m_pageXvaNetwork.SetConnection(con); m_pageXvaNetwork.SetAffinity(m_pageXvaHost.SelectedHost); NotifyNextPagesOfChange(m_pageXvaStorage, m_pageXvaNetwork); } else if (type == typeof(StoragePickerPage)) { m_pageFinish.ShowStartVmsGroupBox = m_pageXvaStorage.ImportedVm != null && !m_pageXvaStorage.ImportedVm.is_a_template; m_pageXvaNetwork.SetVm(m_pageXvaStorage.ImportedVm); NotifyNextPagesOfChange(m_pageXvaNetwork); } if (type != typeof(ImportFinishPage)) { NotifyNextPagesOfChange(m_pageFinish); } }
public static List <CustomFieldDefinition> GetCustomFields(IXenConnection connection) { return(customFieldsCache.GetCustomFields(connection)); }
public AddServerTask(IWin32Window parentForm, IXenConnection connection, Pool destinationPool) { _parentForm = parentForm; _connection = connection; _destinationPool = destinationPool; }
public ParallelAction(IXenConnection connection, string title, string startDescription, string endDescription, List <AsyncAction> subActions) : base(connection, title, startDescription, endDescription, subActions) { _queuePC = new ProduceConsumerQueue(subActions.Count < numberOfSimultaneousActions ? subActions.Count : numberOfSimultaneousActions); }
protected PureAsyncAction(IXenConnection connection, string title, bool suppress_history) : base(connection, title, suppress_history) { }
public static Image GetImage16For(IXenConnection connection) { Icons icon = GetIconFor(connection); return(ImageArray16[(int)icon]); }
protected PureAsyncAction(IXenConnection connection, string title, string description) : base(connection, title, description) { }
/// <summary> /// Tries to find the best SR for the given VDI considering first the /// suggestedSR then the pool's default SR, then other SRs. /// </summary> /// <returns>The SR if a suitable one is found, otherwise null</returns> private SR GetBestDiskStorage(IXenConnection connection, long diskSize, Host affinity, SR suggestedSr, out Image icon, out string tooltip) { icon = Images.StaticImages._000_VirtualStorage_h32bit_16; tooltip = null; var sb = new StringBuilder(); var suggestedSrVisible = suggestedSr != null && suggestedSr.CanBeSeenFrom(affinity); var suggestedSrHasSpace = suggestedSr != null && suggestedSr.VdiCreationCanProceed(diskSize); if (suggestedSrVisible && suggestedSrHasSpace) { return(suggestedSr); } if (suggestedSrVisible) { sb.AppendFormat(Messages.NEWVMWIZARD_STORAGEPAGE_SUGGESTED_NOSPACE, suggestedSr.Name().Ellipsise(50)).AppendLine(); } else if (suggestedSrHasSpace) { sb.AppendFormat(Affinity == null ? Messages.NEWVMWIZARD_STORAGEPAGE_SUGGESTED_LOCAL_NO_HOME : Messages.NEWVMWIZARD_STORAGEPAGE_SUGGESTED_LOCAL, suggestedSr.Name().Ellipsise(50)).AppendLine(); } SR defaultSr = connection.Resolve(Helpers.GetPoolOfOne(connection).default_SR); var defaultSrVisible = defaultSr != null && defaultSr.CanBeSeenFrom(affinity); var defaultSrHasSpace = defaultSr != null && defaultSr.VdiCreationCanProceed(diskSize); if (defaultSrVisible && defaultSrHasSpace) { if (suggestedSr != null) { sb.AppendLine(Messages.NEWVMWIZARD_STORAGEPAGE_XC_SELECTION); tooltip = sb.ToString(); icon = Images.StaticImages._000_Alert2_h32bit_16; } return(defaultSr); } if (defaultSrVisible && !defaultSr.Equals(suggestedSr)) { sb.AppendFormat(Messages.NEWVMWIZARD_STORAGEPAGE_DEFAULT_NOSPACE, defaultSr.Name().Ellipsise(50)).AppendLine(); } else if (defaultSrHasSpace && !defaultSr.Equals(suggestedSr)) { sb.AppendFormat(Affinity == null ? Messages.NEWVMWIZARD_STORAGEPAGE_DEFAULT_LOCAL_NO_HOME : Messages.NEWVMWIZARD_STORAGEPAGE_DEFAULT_LOCAL, defaultSr.Name().Ellipsise(50)).AppendLine(); } foreach (SR sr in connection.Cache.SRs) { if (sr.CanCreateVmOn() && sr.CanBeSeenFrom(affinity) && sr.VdiCreationCanProceed(diskSize)) { if (suggestedSr != null || defaultSr != null) { sb.AppendLine(Messages.NEWVMWIZARD_STORAGEPAGE_XC_SELECTION); tooltip = sb.ToString(); icon = Images.StaticImages._000_Alert2_h32bit_16; } return(sr); } } return(null); }
/// <summary> /// Gets all the patches for the given connection /// </summary> public static List <XenServerPatch> GetAllPatches(IXenConnection conn) { var version = GetCommonServerVersionOfHostsInAConnection(conn, XenServerVersions); return(GetAllPatches(version)); }
protected PureAsyncAction(IXenConnection connection, string title) : base(connection, title) { }
public void CloseActiveWizards(IXenConnection connection) { throw new NotImplementedException(); }
protected PureAsyncAction(IXenConnection connection, string title, string description, bool SuppressHistory) : base(connection, title, description, SuppressHistory) { }
public void TrySelectNewObjectInTree(IXenConnection c, bool selectNode, bool expandNode, bool ensureNodeVisible) { throw new NotImplementedException(); }
public void RemoveConnection(IXenConnection connection) { throw new NotImplementedException(); }
public Session CreateActionSession(Session session, IXenConnection connection) { return(SessionFactory.DuplicateSession(session, connection, ConnectionTimeout)); }
public void ShowPerConnectionWizard(IXenConnection connection, Form wizard, Form parentForm = null) { }
public IWebProxy GetProxyFromSettings(IXenConnection connection) { return(GetProxyFromSettings(connection, true)); }
public TestArchiveTargetAction(IXenConnection connection, Dictionary <string, string> archiveConfig) : base(connection, Messages.TEST_ARCHIVE_LOCATION, true) { _archiveConfig = archiveConfig; }
private void CachePopulatedMethod(IXenConnection conn) { VM.Connection.CachePopulated -= CachePopulatedMethod; refreshDrives(); }
private static AsyncAction.SudoElevationResult FakeSudoDialog(List <Role> roles, IXenConnection connection, string actionTitle) { return(new AsyncAction.SudoElevationResult(true, string.Empty, string.Empty, null)); }
protected override void PageLeaveCore(PageLoadedDirection direction, ref bool cancel) { targetConnection = null; }
public SrCslgStorageSystemScanAction(IXenConnection connection, string adapterid, string target, string user, string password) : base(connection, target, user, password) { _adapterid = adapterid; }
/// <summary> /// Generates a Proxy instance which implements <see cref="Proxy"/> for the specified <see cref="IXenConnection"/> and XML document. /// </summary> /// <param name="connection">The connection.</param> /// <param name="fileName">Name of the file.</param> /// <returns></returns> public static Proxy GetProxy(IXenConnection connection, string fileName) { return((Proxy)generator.CreateProxyInstance(proxyType, ProxyInstance(connection, fileName))); }
/// <summary> /// Should be called before the Affinity is set. /// </summary> public void SetConnection(IXenConnection con) { m_selectedConnection = con; }