diff --git a/.gitignore b/.gitignore index 590612a24..e0bd548f2 100644 --- a/.gitignore +++ b/.gitignore @@ -27,7 +27,6 @@ Thumbs.db packages/* !packages/DOTNET_BUILD_LOCATION -!packages/download_packages.ps1 _ReSharper.*/ *.opensdf diff --git a/.travis.yml b/.travis.yml index d3af8a6b7..1d062ad14 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,11 @@ language: c +os: windows +install: + # package support for windows is not great; this is ugly, but will do for now + - choco install cyg-get + - cyg-get.bat aspell aspell-en + - powershell 'Set-ExecutionPolicy -ExecutionPolicy ByPass' script: - - bash ./devtools/copyrightcheck/copyrightcheck.sh - - bash ./devtools/i18ncheck/i18ncheck.sh - - bash ./devtools/spellcheck/spellcheck.sh \ No newline at end of file + - powershell './scripts/check_copyright.ps1 -NOISY' + - powershell './scripts/check_i18n.ps1 -NOISY' + - powershell '$env:Path+=";C:\tools\cygwin\bin"; ./scripts/check_spelling.ps1 -NOISY' diff --git a/Jenkinsfile b/Jenkinsfile index da159b668..01671b515 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -125,7 +125,7 @@ node('xencenter') { stage('Download dependencies') { def remoteDotnet = readFile("${env.WORKSPACE}\\xenadmin.git\\packages\\DOTNET_BUILD_LOCATION").trim() - def downloadSpec = readFile("${env.WORKSPACE}\\xenadmin.git\\mk\\deps-map.json").trim().replaceAll("@REMOTE_DOTNET@", remoteDotnet) + def downloadSpec = readFile("${env.WORKSPACE}\\xenadmin.git\\scripts\\deps-map.json").trim().replaceAll("@REMOTE_DOTNET@", remoteDotnet) def server = Artifactory.server('repo') server.download(downloadSpec) @@ -133,19 +133,15 @@ node('xencenter') { if ("${XC_BRANDING}" == 'citrix') { println "Downloading hotfixes." - def hotFixSpec = readFile("${env.WORKSPACE}\\xenadmin.git\\mk\\hotfix-map.json").trim() + def hotFixSpec = readFile("${env.WORKSPACE}\\xenadmin.git\\scripts\\hotfix-map.json").trim() server.download(hotFixSpec) } } stage('Run checks') { - List list = ["copyrightcheck/copyrightcheck.sh", "i18ncheck/i18ncheck.sh", "spellcheck/spellcheck.sh"] - - for (String item : list) { - bat """ - cd ${env.WORKSPACE}\\xenadmin.git\\devtools - sh "${item}" - """ + dir("${env.WORKSPACE}\\xenadmin.git") { + powershell ".\\scripts\\check_copyright.ps1" + powershell ".\\scripts\\check_i18n.ps1" } } @@ -154,7 +150,7 @@ node('xencenter') { bat """ cd ${env.WORKSPACE} -sh xenadmin.git/mk/xenadmin-build.sh ${GLOBAL_BUILD_NUMBER} ${env.SIGNING_NODE_NAME} ${sbe} ${env.SELFSIGN_THUMBPRINT_SHA1} ${env.SELFSIGN_THUMBPRINT_SHA256} ${env.TIMESTAMP_SERVER_URL} +sh xenadmin.git/scripts/xenadmin-build.sh ${GLOBAL_BUILD_NUMBER} ${env.SIGNING_NODE_NAME} ${sbe} ${env.SELFSIGN_THUMBPRINT_SHA1} ${env.SELFSIGN_THUMBPRINT_SHA256} ${env.TIMESTAMP_SERVER_URL} """ } diff --git a/WixInstaller/en-us.wxl b/WixInstaller/en-us.wxl index 978dab48d..43e225b44 100644 --- a/WixInstaller/en-us.wxl +++ b/WixInstaller/en-us.wxl @@ -1,4 +1,37 @@ + + + Open XVA File diff --git a/WixInstaller/ja-jp.wxl b/WixInstaller/ja-jp.wxl index fabd3163a..43a7691ea 100644 --- a/WixInstaller/ja-jp.wxl +++ b/WixInstaller/ja-jp.wxl @@ -1,4 +1,37 @@ + + + 開く XVA ファイル @@ -13,10 +46,10 @@ 保存済みの検索 このインストールには、Microsoft .NET Framework 4.6 以降が必要です。https://www.microsoft.com/net/download/framework からインストールしてください。 README.TXT - サーバーから Citrix Insight Services に定期的にデータをアップロードして Citrix Hypervisor プールのヘルス状態を監視する機能を有効にします。 + サーバーから Citrix Insight Services に定期的にデータをアップロードすることにより、Citrix Hypervisor プールのヘルス状態の監視を有効にします。 Citrix Hypervisor プールのヘルス状態の監視を有効にします。 - 言語パック:日本語 - 日本語リソースファイル - 言語パック:簡体字中国語 - 簡体字中国語リソースファイル + 言語パック: 日本語 + 日本語のリソース ファイル + 言語パック: 簡体字中国語 + 簡体字中国語のリソース ファイル diff --git a/WixInstaller/zh-cn.wxl b/WixInstaller/zh-cn.wxl index 77669944c..5efa8e7d2 100644 --- a/WixInstaller/zh-cn.wxl +++ b/WixInstaller/zh-cn.wxl @@ -1,4 +1,37 @@ + + + 打开 XVA 文件 @@ -14,9 +47,9 @@ 此安装需要 Microsoft .NET Framework 4.6 或更高版本。请从 https://www.microsoft.com/net/download/framework 安装 声明.TXT 通过定期将数据从服务器上载到 Citrix Insight Services,实现对 Citrix Hypervisor 池的运行状况监视。 - 允许监视 Citrix Hypervisor 池的运行状况。 - 语言包:日语 + 启用对 Citrix Hypervisor 池的运行状况的监视。 + 语言包: 日语 日语资源文件 - 语言包:简体中文 + 语言包: 简体中文 简体中文资源文件 diff --git a/XenAdmin/Actions/GUIActions/Wlb/WlbOptimizePoolAction.cs b/XenAdmin/Actions/GUIActions/Wlb/WlbOptimizePoolAction.cs index c62f4a941..9798c3025 100644 --- a/XenAdmin/Actions/GUIActions/Wlb/WlbOptimizePoolAction.cs +++ b/XenAdmin/Actions/GUIActions/Wlb/WlbOptimizePoolAction.cs @@ -161,7 +161,7 @@ namespace XenAdmin.Actions.Wlb // Set new ntol, then retry action XenAPI.Pool.set_ha_host_failures_to_tolerate(session, this.Pool.opaque_ref, newNtol); // ntol set succeeded, start new action - Program.MainWindow.CloseActiveWizards(vm); + Program.Invoke(Program.MainWindow, () => XenDialogBase.CloseAll(vm)); new VMMigrateAction(vm,toHost).RunAsync(); }); action.RunAsync(); diff --git a/XenAdmin/Alerts/Types/XenCenterUpdateAlert.cs b/XenAdmin/Alerts/Types/XenCenterUpdateAlert.cs index aa82b1323..2345a02c8 100644 --- a/XenAdmin/Alerts/Types/XenCenterUpdateAlert.cs +++ b/XenAdmin/Alerts/Types/XenCenterUpdateAlert.cs @@ -31,7 +31,6 @@ using System; using System.Collections.Generic; -using System.Text; using XenAdmin.Core; @@ -47,59 +46,26 @@ namespace XenAdmin.Alerts _timestamp = NewVersion.TimeStamp; } - public override AlertPriority Priority { get { return AlertPriority.Priority5; } } + public override AlertPriority Priority => AlertPriority.Priority5; - public override string WebPageLabel - { - get { return NewVersion.Url; } - } + public override string WebPageLabel => NewVersion.Url; - public override string Name - { - get { return NewVersion.Name; } - } + public override string Name => NewVersion.Name; - public override string Title - { - get { return string.Format(Messages.ALERT_NEW_VERSION, NewVersion.Name); } - } + public override string Title => string.Format(Messages.ALERT_NEW_VERSION, NewVersion.Name); - public override string Description - { - get - { - return string.Format(Messages.ALERT_NEW_VERSION_DETAILS, NewVersion.Name); - } - } + public override string Description => string.Format(Messages.ALERT_NEW_VERSION_DETAILS, NewVersion.Name); public override Action FixLinkAction { get { return () => Program.OpenURL(NewVersion.Url); } } - public override string FixLinkText - { - get - { - return Messages.ALERT_NEW_VERSION_DOWNLOAD; - } - } + public override string FixLinkText => Messages.ALERT_NEW_VERSION_DOWNLOAD; - public override string AppliesTo - { - get - { - return Messages.XENCENTER; - } - } + public override string AppliesTo => Messages.XENCENTER; - public override string HelpID - { - get - { - return "XenCenterUpdateAlert"; - } - } + public override string HelpID => "XenCenterUpdateAlert"; static int DISMISSED_XC_VERSIONS_LIMIT = 5; @@ -124,10 +90,9 @@ namespace XenAdmin.Alerts public override bool Equals(Alert other) { - if (other is XenCenterUpdateAlert) - { - return NewVersion.VersionAndLang == ((XenCenterUpdateAlert)other).NewVersion.VersionAndLang; - } + if (other is XenCenterUpdateAlert xenCenterAlert) + return NewVersion.VersionAndLang == xenCenterAlert.NewVersion.VersionAndLang; + return base.Equals(other); } } diff --git a/XenAdmin/Alerts/Types/XenServerPatchAlert.cs b/XenAdmin/Alerts/Types/XenServerPatchAlert.cs index 6fc791d87..c6ba928ed 100644 --- a/XenAdmin/Alerts/Types/XenServerPatchAlert.cs +++ b/XenAdmin/Alerts/Types/XenServerPatchAlert.cs @@ -33,7 +33,6 @@ using System; using System.Collections.Generic; using System.Linq; using XenAdmin.Network; -using XenAdmin.Actions; using XenAdmin.Core; using XenAPI; using System.Text; @@ -43,8 +42,8 @@ namespace XenAdmin.Alerts { public class XenServerPatchAlert : XenServerUpdateAlert { - public XenServerPatch Patch; - public XenServerVersion NewServerVersion; + public readonly XenServerPatch Patch; + public readonly XenServerVersion NewServerVersion; /// /// Can we apply this alert. Calling this sets the CannotApplyReason where applicable @@ -100,13 +99,7 @@ namespace XenAdmin.Alerts _timestamp = Patch.TimeStamp; } - public override string WebPageLabel - { - get - { - return Patch.Url; - } - } + public override string WebPageLabel => Patch.Url; public override AlertPriority Priority { @@ -154,21 +147,9 @@ namespace XenAdmin.Alerts get { return () => Program.OpenURL(Patch.Url); } } - public override string FixLinkText - { - get - { - return Messages.ALERT_NEW_PATCH_DOWNLOAD; - } - } + public override string FixLinkText => Messages.ALERT_NEW_PATCH_DOWNLOAD; - public override string HelpID - { - get - { - return "XenServerPatchAlert"; - } - } + public override string HelpID => "XenServerPatchAlert"; public override string Title { @@ -199,19 +180,12 @@ namespace XenAdmin.Alerts public override bool Equals(Alert other) { - if (other is XenServerPatchAlert) - { - return string.Equals(Patch.Uuid, ((XenServerPatchAlert)other).Patch.Uuid, StringComparison.OrdinalIgnoreCase); - } + if (other is XenServerPatchAlert patchAlert) + return string.Equals(Patch.Uuid, patchAlert.Patch.Uuid, StringComparison.OrdinalIgnoreCase); + return base.Equals(other); } - public bool ShowAsNewVersion - { - get - { - return NewServerVersion != null && !NewServerVersion.PresentAsUpdate; - } - } + public bool ShowAsNewVersion => NewServerVersion != null && !NewServerVersion.PresentAsUpdate; } } diff --git a/XenAdmin/Alerts/Types/XenServerVersionAlert.cs b/XenAdmin/Alerts/Types/XenServerVersionAlert.cs index 355e6075d..5f56834a2 100644 --- a/XenAdmin/Alerts/Types/XenServerVersionAlert.cs +++ b/XenAdmin/Alerts/Types/XenServerVersionAlert.cs @@ -31,10 +31,8 @@ using System; using System.Collections.Generic; -using System.Text; using XenAdmin.Core; using XenAdmin.Network; -using XenAdmin.Actions; using XenAPI; @@ -42,7 +40,7 @@ namespace XenAdmin.Alerts { public class XenServerVersionAlert : XenServerUpdateAlert { - public XenServerVersion Version; + public readonly XenServerVersion Version; public XenServerVersionAlert(XenServerVersion version) { @@ -51,51 +49,24 @@ namespace XenAdmin.Alerts _timestamp = version.TimeStamp; } - public override string WebPageLabel - { - get { return Version.Url; } - } + public override string WebPageLabel => Version.Url; - public override string Name - { - get { return Version.Name; } - } + public override string Name => Version.Name; - public override string Title - { - get { return string.Format(Messages.DOWLOAD_LATEST_XS_TITLE, Version.Name); } - } + public override string Title => string.Format(Messages.DOWLOAD_LATEST_XS_TITLE, Version.Name); - public override string Description - { - get { return string.Format(Messages.DOWNLOAD_LATEST_XS_BODY, Version.Name); } - } + public override string Description => string.Format(Messages.DOWNLOAD_LATEST_XS_BODY, Version.Name); - public override string FixLinkText - { - get - { - return Messages.ALERT_NEW_VERSION_DOWNLOAD; - } - } + public override string FixLinkText => Messages.ALERT_NEW_VERSION_DOWNLOAD; - public override AlertPriority Priority - { - get { return AlertPriority.Priority5; } - } + public override AlertPriority Priority => AlertPriority.Priority5; public override Action FixLinkAction { get { return () => Program.OpenURL(Version.Url); } } - public override string HelpID - { - get - { - return "XenServerUpdateAlert"; - } - } + public override string HelpID => "XenServerUpdateAlert"; protected override bool IsDismissed(IXenConnection connection) { @@ -116,10 +87,9 @@ namespace XenAdmin.Alerts public override bool Equals(Alert other) { - if (other is XenServerVersionAlert) - { - return Version.Version.ToString() == ((XenServerVersionAlert)other).Version.Version.ToString(); - } + if (other is XenServerVersionAlert versionAlert) + return Version.Version.ToString() == versionAlert.Version.Version.ToString(); + return base.Equals(other); } } diff --git a/XenAdmin/Commands/AddVirtualDiskCommand.cs b/XenAdmin/Commands/AddVirtualDiskCommand.cs index 0223f48dc..1224bb269 100644 --- a/XenAdmin/Commands/AddVirtualDiskCommand.cs +++ b/XenAdmin/Commands/AddVirtualDiskCommand.cs @@ -76,7 +76,7 @@ namespace XenAdmin.Commands { if (vm.VBDs.Count < vm.MaxVBDsAllowed()) { - MainWindowCommandInterface.ShowPerXenModelObjectWizard(vm, new NewDiskDialog(vm.Connection, vm)); + new NewDiskDialog(vm.Connection, vm).ShowPerXenObject(vm, Program.MainWindow); } else { diff --git a/XenAdmin/Commands/AttachVirtualDiskCommand.cs b/XenAdmin/Commands/AttachVirtualDiskCommand.cs index d59f43334..873b2591e 100644 --- a/XenAdmin/Commands/AttachVirtualDiskCommand.cs +++ b/XenAdmin/Commands/AttachVirtualDiskCommand.cs @@ -80,7 +80,7 @@ namespace XenAdmin.Commands } else { - MainWindowCommandInterface.ShowPerXenModelObjectWizard(vm, new AttachDiskDialog(vm)); + new AttachDiskDialog(vm).ShowPerXenObject(vm, Program.MainWindow); } } diff --git a/XenAdmin/Commands/ConvertVMToTemplateCommand.cs b/XenAdmin/Commands/ConvertVMToTemplateCommand.cs index 4a65dbb67..9b81ebdda 100644 --- a/XenAdmin/Commands/ConvertVMToTemplateCommand.cs +++ b/XenAdmin/Commands/ConvertVMToTemplateCommand.cs @@ -82,7 +82,7 @@ namespace XenAdmin.Commands actions.Add(new SetVMOtherConfigAction(vm.Connection, vm, "instant", "true")); actions.Add(new VMToTemplateAction(vm)); - MainWindowCommandInterface.CloseActiveWizards(vm); + XenDialogBase.CloseAll(vm); RunMultipleActions(actions, string.Format(Messages.ACTION_VM_TEMPLATIZING_TITLE, vm.Name()), Messages.ACTION_VM_TEMPLATIZING, Messages.ACTION_VM_TEMPLATIZED, true); diff --git a/XenAdmin/Commands/CopyTemplateCommand.cs b/XenAdmin/Commands/CopyTemplateCommand.cs index 3729aef8c..389d8020c 100644 --- a/XenAdmin/Commands/CopyTemplateCommand.cs +++ b/XenAdmin/Commands/CopyTemplateCommand.cs @@ -69,7 +69,7 @@ namespace XenAdmin.Commands if (CrossPoolCopyTemplateCommand.CanExecute(template, null)) new CrossPoolCopyTemplateCommand(MainWindowCommandInterface, selection).Execute(); else - MainWindowCommandInterface.ShowPerXenModelObjectWizard(template, new CopyVMDialog(template)); + new CopyVMDialog(template).ShowPerXenObject(template, Program.MainWindow); } protected override bool CanExecuteCore(SelectedItemCollection selection) diff --git a/XenAdmin/Commands/CopyVMCommand.cs b/XenAdmin/Commands/CopyVMCommand.cs index ee9713260..c654dd7a1 100644 --- a/XenAdmin/Commands/CopyVMCommand.cs +++ b/XenAdmin/Commands/CopyVMCommand.cs @@ -69,7 +69,7 @@ namespace XenAdmin.Commands if (CrossPoolCopyVMCommand.CanExecute(vm, null)) new CrossPoolCopyVMCommand(MainWindowCommandInterface, selection).Execute(); else - MainWindowCommandInterface.ShowPerXenModelObjectWizard(vm, new CopyVMDialog(vm)); + new CopyVMDialog(vm).ShowPerXenObject(vm, Program.MainWindow); } protected override bool CanExecuteCore(SelectedItemCollection selection) diff --git a/XenAdmin/Commands/DetachSRCommand.cs b/XenAdmin/Commands/DetachSRCommand.cs index 2b2747041..0dc5d49f5 100644 --- a/XenAdmin/Commands/DetachSRCommand.cs +++ b/XenAdmin/Commands/DetachSRCommand.cs @@ -78,51 +78,22 @@ namespace XenAdmin.Commands private static bool CanExecute(SR sr) { - return sr != null && sr.IsDetachable() && !HelpersGUI.GetActionInProgress(sr); + return sr != null && !sr.IsDetached() && !sr.HasRunningVMs() && !HelpersGUI.GetActionInProgress(sr); } - public override string MenuText - { - get - { - return Messages.MAINWINDOW_DETACH_SR; - } - } + public override string MenuText => Messages.MAINWINDOW_DETACH_SR; - protected override bool ConfirmationRequired - { - get - { - return true; - } - } + protected override bool ConfirmationRequired => true; - protected override string ConfirmationDialogText - { - get - { - SelectedItemCollection selection = GetSelection(); + protected override string ConfirmationDialogText => + GetSelection().Count == 1 + ? Messages.MESSAGEBOX_DETACH_SR_CONTINUE + : Messages.MESSAGEBOX_DETACH_SRS_CONTINUE; - if (selection.Count == 1) - { - return Messages.MESSAGEBOX_DETACH_SR_CONTINUE; - } - return Messages.MESSAGEBOX_DETACH_SRS_CONTINUE; - } - } - - protected override string ConfirmationDialogTitle - { - get - { - if (GetSelection().Count == 1) - { - return Messages.MESSAGEBOX_DETACH_SR_CONTINUE_TITLE; - } - - return Messages.MESSAGEBOX_DETACH_SRS_CONTINUE_TITLE; - } - } + protected override string ConfirmationDialogTitle => + GetSelection().Count == 1 + ? Messages.MESSAGEBOX_DETACH_SR_CONTINUE_TITLE + : Messages.MESSAGEBOX_DETACH_SRS_CONTINUE_TITLE; protected override CommandErrorDialog GetErrorDialogCore(IDictionary cantExecuteReasons) { @@ -144,10 +115,6 @@ namespace XenAdmin.Commands { return Messages.SR_HAS_RUNNING_VMS; } - if (!sr.CanCreateWithXenCenter()) - { - return Messages.SR_CANNOT_BE_DETACHED_WITH_XC; - } if (HelpersGUI.GetActionInProgress(sr)) { return Messages.SR_ACTION_IN_PROGRESS; diff --git a/XenAdmin/Commands/HostMaintenanceModeCommand.cs b/XenAdmin/Commands/HostMaintenanceModeCommand.cs index 1ea3d4398..228b3655f 100644 --- a/XenAdmin/Commands/HostMaintenanceModeCommand.cs +++ b/XenAdmin/Commands/HostMaintenanceModeCommand.cs @@ -102,7 +102,7 @@ namespace XenAdmin.Commands return; } - MainWindowCommandInterface.ShowPerXenModelObjectWizard(host, new EvacuateHostDialog(host)); + new EvacuateHostDialog(host).ShowPerXenObject(host, Program.MainWindow); } private void ExitMaintenanceMode(Host host) diff --git a/XenAdmin/Commands/InstallToolsCommand.cs b/XenAdmin/Commands/InstallToolsCommand.cs index 3fe47438c..762e56eb2 100644 --- a/XenAdmin/Commands/InstallToolsCommand.cs +++ b/XenAdmin/Commands/InstallToolsCommand.cs @@ -256,7 +256,7 @@ namespace XenAdmin.Commands MainWindowCommandInterface.Invoke(delegate { - Program.MainWindow.SelectObject(action.VM); + Program.MainWindow.SelectObjectInTree(action.VM); Program.MainWindow.TheTabControl.SelectedTab = Program.MainWindow.TabPageConsole; }); } diff --git a/XenAdmin/Commands/MoveVMCommand.cs b/XenAdmin/Commands/MoveVMCommand.cs index d58213fde..8a9464eb8 100644 --- a/XenAdmin/Commands/MoveVMCommand.cs +++ b/XenAdmin/Commands/MoveVMCommand.cs @@ -69,7 +69,7 @@ namespace XenAdmin.Commands else { VM vm = (VM) selection[0].XenObject; - MainWindowCommandInterface.ShowPerXenModelObjectWizard(vm, new MoveVMDialog(vm)); + new MoveVMDialog(vm).ShowPerXenObject(vm, Program.MainWindow); } } diff --git a/XenAdmin/Commands/ReattachSRCommand.cs b/XenAdmin/Commands/ReattachSRCommand.cs index c813af65f..7e1400842 100644 --- a/XenAdmin/Commands/ReattachSRCommand.cs +++ b/XenAdmin/Commands/ReattachSRCommand.cs @@ -31,10 +31,9 @@ using System; using System.Collections.Generic; -using System.Text; using XenAdmin.Core; -using XenAPI; using XenAdmin.Wizards; +using XenAPI; namespace XenAdmin.Commands @@ -65,9 +64,7 @@ namespace XenAdmin.Commands private void Execute(SR sr) { if (CanReattachSR(sr)) - { MainWindowCommandInterface.ShowPerConnectionWizard(sr.Connection, new NewSRWizard(sr.Connection, sr)); - } } protected override void ExecuteCore(SelectedItemCollection selection) @@ -77,29 +74,18 @@ namespace XenAdmin.Commands protected override bool CanExecuteCore(SelectedItemCollection selection) { - if (selection.Count == 1) - { - return CanReattachSR(selection[0].XenObject as SR); - } - return false; + return selection.Count == 1 && CanReattachSR(selection[0].XenObject as SR); } private static bool CanReattachSR(SR sr) { return sr != null && !sr.HasPBDs() - && sr.CanCreateWithXenCenter() && !HelpersGUI.GetActionInProgress(sr) && !(sr.type == "cslg" && Helpers.FeatureForbidden(sr.Connection, Host.RestrictStorageChoices)) && (SM.GetByType(sr.Connection, sr.type) != null); } - public override string MenuText - { - get - { - return Messages.MAINWINDOW_REATTACH_SR; - } - } + public override string MenuText => Messages.MAINWINDOW_REATTACH_SR; } } diff --git a/XenAdmin/Commands/VMOperationCommand.cs b/XenAdmin/Commands/VMOperationCommand.cs index 63f726104..530fb8ff6 100644 --- a/XenAdmin/Commands/VMOperationCommand.cs +++ b/XenAdmin/Commands/VMOperationCommand.cs @@ -129,7 +129,7 @@ namespace XenAdmin.Commands endDescription = Messages.ACTION_VM_MIGRATED; foreach (VM vm in selection.AsXenObjects(CanExecute)) { - this.MainWindowCommandInterface.CloseActiveWizards(vm); + XenDialogBase.CloseAll(vm); Host host = GetHost(vm); actions.Add(new VMMigrateAction(vm, host)); } diff --git a/XenAdmin/Controls/DiskSpinner.cs b/XenAdmin/Controls/DiskSpinner.cs index 49d9449a1..1b328f9b9 100644 --- a/XenAdmin/Controls/DiskSpinner.cs +++ b/XenAdmin/Controls/DiskSpinner.cs @@ -119,7 +119,7 @@ namespace XenAdmin.Controls if (!decimal.TryParse(DiskSizeNumericUpDown.Text.Trim(), out decimal result) || result < 0) { - SetError(Messages.INVALID_NUMBER); + SetError(Messages.INVALID_DISK_SIZE); IsSizeValid = false; return; } @@ -142,7 +142,7 @@ namespace XenAdmin.Controls if (SelectedSize > DEFAULT_MAXIMUM) { - SetError(Messages.INVALID_NUMBER); + SetError(Messages.INVALID_DISK_SIZE); IsSizeValid = false; return; } diff --git a/XenAdmin/Controls/XenSearch/QueryPanel.cs b/XenAdmin/Controls/XenSearch/QueryPanel.cs index 4fa67e024..4432eb91e 100644 --- a/XenAdmin/Controls/XenSearch/QueryPanel.cs +++ b/XenAdmin/Controls/XenSearch/QueryPanel.cs @@ -659,7 +659,7 @@ namespace XenAdmin.Controls.XenSearch } : (EventHandler)delegate { - if (Program.MainWindow.SelectObject(ixmo) + if (Program.MainWindow.SelectObjectInTree(ixmo) && Program.MainWindow.TheTabControl.TabPages.Contains(Program.MainWindow.TabPageGeneral)) Program.MainWindow.SwitchToTab(MainWindow.Tab.General); }; diff --git a/XenAdmin/Core/HelpersGUI.cs b/XenAdmin/Core/HelpersGUI.cs index 79e397ec8..1fff8f345 100644 --- a/XenAdmin/Core/HelpersGUI.cs +++ b/XenAdmin/Core/HelpersGUI.cs @@ -158,45 +158,6 @@ namespace XenAdmin.Core f.Activate(); } - public static bool FocusFirstControl(Control.ControlCollection cc) - { - bool found = false; - - List controls = new List(); - foreach (Control control in cc) - controls.Add(control); - controls.Sort((c1, c2) => c1.TabIndex.CompareTo(c2.TabIndex)); - if (controls.Count > 0) - { - foreach (Control control in controls) - { - if (control.HasChildren) - { - found = FocusFirstControl(control.Controls); - } - - if (!found) - { - if (control is Label) - continue; - - if (control is TextBox && (control as TextBox).ReadOnly) - continue; - - if (control.CanSelect) - { - found = control.Focus(); - } - } - - if (found) - break; - } - } - - return found; - } - public static Dictionary CheckHostIQNsDiffer() { Dictionary hosts = new Dictionary(); diff --git a/XenAdmin/Core/History.cs b/XenAdmin/Core/History.cs index b52511cf8..9ba9afd45 100644 --- a/XenAdmin/Core/History.cs +++ b/XenAdmin/Core/History.cs @@ -177,7 +177,7 @@ namespace XenAdmin.Core public bool Go() { - if (Program.MainWindow.SelectObject(o)) + if (Program.MainWindow.SelectObjectInTree(o)) { Program.MainWindow.TheTabControl.SelectedTab = tab; return true; @@ -286,7 +286,7 @@ namespace XenAdmin.Core public bool Go() { - if (Program.MainWindow.SelectObject(o)) + if (Program.MainWindow.SelectObjectInTree(o)) { Program.MainWindow.TheTabControl.SelectedTab = Program.MainWindow.TabPageSearch; Program.MainWindow.SearchPage.Search = search; diff --git a/XenAdmin/Core/Updates.cs b/XenAdmin/Core/Updates.cs index 1ec8751cd..527ec97fd 100644 --- a/XenAdmin/Core/Updates.cs +++ b/XenAdmin/Core/Updates.cs @@ -66,17 +66,11 @@ namespace XenAdmin.Core public const string IgnorePatchKey = "XenCenter.IgnorePatches"; public const string LAST_SEEN_SERVER_VERSION_KEY = "XenCenter.LastSeenServerVersion"; - public static IEnumerable UpdateAlerts - { - get { return updateAlerts; } - } + public static IEnumerable UpdateAlerts => updateAlerts; - public static int UpdateAlertsCount - { - get { return updateAlerts.Count; } - } + public static int UpdateAlertsCount => updateAlerts.Count; - private static void AddUpate(Alert update) + private static void AddUpdate(Alert update) { try { @@ -116,7 +110,6 @@ namespace XenAdmin.Core /// Dismisses the updates in the given list i.e. they are added in the /// other_config list of each pool and removed from the Updates.UpdateAlerts list. /// - /// public static void DismissUpdates(List toBeDismissed) { if (toBeDismissed.Count == 0) @@ -127,7 +120,7 @@ namespace XenAdmin.Core if (!Alert.AllowedToDismiss(connection)) continue; - XenAPI.Pool pool = Helpers.GetPoolOfOne(connection); + Pool pool = Helpers.GetPoolOfOne(connection); if (pool == null) continue; @@ -135,43 +128,43 @@ namespace XenAdmin.Core foreach (Alert alert in toBeDismissed) { - - if (alert is XenServerPatchAlert) + if (alert is XenServerPatchAlert patchAlert) { - if (other_config.ContainsKey(IgnorePatchKey)) { List current = new List(other_config[IgnorePatchKey].Split(',')); - if (current.Contains(((XenServerPatchAlert)alert).Patch.Uuid, StringComparer.OrdinalIgnoreCase)) + if (current.Contains(patchAlert.Patch.Uuid, StringComparer.OrdinalIgnoreCase)) continue; - current.Add(((XenServerPatchAlert)alert).Patch.Uuid); + current.Add(patchAlert.Patch.Uuid); other_config[IgnorePatchKey] = string.Join(",", current.ToArray()); } else { - other_config.Add(IgnorePatchKey, ((XenServerPatchAlert)alert).Patch.Uuid); + other_config.Add(IgnorePatchKey, patchAlert.Patch.Uuid); } } - if (alert is XenServerVersionAlert) + + if (alert is XenServerVersionAlert versionAlert) { if (other_config.ContainsKey(LAST_SEEN_SERVER_VERSION_KEY)) { List current = new List(other_config[LAST_SEEN_SERVER_VERSION_KEY].Split(',')); - if (current.Contains(((XenServerVersionAlert)alert).Version.Version.ToString())) + if (current.Contains(versionAlert.Version.Version.ToString())) continue; - current.Add(((XenServerVersionAlert)alert).Version.Version.ToString()); + current.Add(versionAlert.Version.Version.ToString()); other_config[LAST_SEEN_SERVER_VERSION_KEY] = string.Join(",", current.ToArray()); } else { - other_config.Add(LAST_SEEN_SERVER_VERSION_KEY, ((XenServerVersionAlert)alert).Version.Version.ToString()); + other_config.Add(LAST_SEEN_SERVER_VERSION_KEY, versionAlert.Version.Version.ToString()); } } - Updates.RemoveUpdate(alert); + + RemoveUpdate(alert); } - XenAPI.Pool.set_other_config(connection.Session, pool.opaque_ref, other_config); + Pool.set_other_config(connection.Session, pool.opaque_ref, other_config); } } @@ -198,7 +191,6 @@ namespace XenAdmin.Core Properties.Settings.Default.AllowPatchesUpdates || force || forceRefresh) { var action = CreateDownloadUpdatesXmlAction( - CheckForUpdatesUrl, Properties.Settings.Default.AllowXenCenterUpdates || force, Properties.Settings.Default.AllowXenServerUpdates || force, Properties.Settings.Default.AllowPatchesUpdates || force); @@ -212,12 +204,14 @@ namespace XenAdmin.Core } } - public static DownloadUpdatesXmlAction CreateDownloadUpdatesXmlAction(string checkForUpdatesUrl, bool checkForXenCenter = false, bool checkForServerVersion = false, bool checkForPatches = false) + public static DownloadUpdatesXmlAction CreateDownloadUpdatesXmlAction(bool checkForXenCenter = false, + bool checkForServerVersion = false, bool checkForPatches = false) { string userAgent = string.Format("{0}/{1}.{2} ({3}-bit)", BrandManager.BRAND_CONSOLE, BrandManager.XENCENTER_VERSION, Program.Version.Revision.ToString(), IntPtr.Size * 8); string userAgentId = GetUniqueIdHash(); - return new DownloadUpdatesXmlAction(checkForXenCenter, checkForServerVersion, checkForPatches, userAgent, userAgentId, checkForUpdatesUrl); + return new DownloadUpdatesXmlAction(checkForXenCenter, checkForServerVersion, checkForPatches, + userAgent, userAgentId, CheckForUpdatesUrl); } internal static string GetUniqueIdHash() @@ -257,7 +251,7 @@ namespace XenAdmin.Core if (Helpers.CommonCriteriaCertificationRelease) return false; - var action = CreateDownloadUpdatesXmlAction(CheckForUpdatesUrl, true, true, true); + var action = CreateDownloadUpdatesXmlAction(true, true, true); action.Completed += actionCompleted; if (CheckForUpdatesStarted != null) @@ -380,8 +374,8 @@ namespace XenAdmin.Core if (alerts.Count == 0) { - log.Info(string.Format("Not alerting XenCenter update - latest = {0}, latestcr = {1}, detected = {2}", - latest != null ? latest.VersionAndLang : "", latestCr != null ? latestCr.VersionAndLang : "", Program.VersionAndLanguage)); + log.InfoFormat("Not alerting XenCenter update - latest = {0}, latestcr = {1}, detected = {2}", + latest != null ? latest.VersionAndLang : "", latestCr != null ? latestCr.VersionAndLang : "", Program.VersionAndLanguage); } return alerts; @@ -453,7 +447,7 @@ namespace XenAdmin.Core var noPatchHosts = hosts.Where(host => PatchCanBeInstalledOnHost(serverPatch, host)).ToList(); - if (noPatchHosts.Count() == hosts.Count) + if (noPatchHosts.Count == hosts.Count) alert.IncludeConnection(xenConnection); else alert.IncludeHosts(noPatchHosts); @@ -519,8 +513,6 @@ namespace XenAdmin.Core /// If parameter is not null, it returns the minimum XenCenter version if it is greater than the current XC version, /// or null, if the minimum XC version couldn't be found or the current XC version is enough. /// - /// - /// public static XenCenterVersion GetRequiredXenCenterVersion(XenServerVersion serverVersion) { if (XenCenterVersions.Count == 0) @@ -544,11 +536,10 @@ namespace XenAdmin.Core } /// - /// This method returns the minimal set of patches for a host if this class already has information about them. Otherwise it returns empty list. + /// This method returns the minimal set of patches for a host if this class already has information about them. + /// Otherwise it returns empty list. /// Calling this function will not initiate a download or update. /// - /// - /// public static List RecommendedPatchesForHost(Host host) { var recommendedPatches = new List(); @@ -632,7 +623,7 @@ namespace XenAdmin.Core var minimalPatches = new List {alert.Patch}; - // if it's a version updgrade the min sequence will be this patch (the upgrade) and the min patches for the new version + // if it's a version upgrade the min sequence will be this patch (the upgrade) and the min patches for the new version if (updateTheNewVersion && alert.NewServerVersion != null && alert.NewServerVersion.MinimalPatches != null) { minimalPatches.AddRange(alert.NewServerVersion.MinimalPatches); @@ -659,7 +650,7 @@ namespace XenAdmin.Core var allPatches = new List { alert.Patch }; - // if it's a version updgrade the update sequence will be this patch (the upgrade) and the patches for the new version + // if it's a version upgrade the update sequence will be this patch (the upgrade) and the patches for the new version if (updateTheNewVersion && alert.NewServerVersion != null) { var newVersionPatches = GetAllPatches(alert.NewServerVersion); @@ -707,7 +698,6 @@ namespace XenAdmin.Core /// Returns a XenServerVersion if all hosts of the pool have the same version /// Returns null if it is unknown or they don't match /// - /// private static XenServerVersion GetCommonServerVersionOfHostsInAConnection(IXenConnection connection, List xsVersions) { if (connection == null || xsVersions == null) @@ -829,7 +819,7 @@ namespace XenAdmin.Core var outOfDateHosts = hosts.Where(host => new Version(Helpers.HostProductVersion(host)) < version.Version && (patch == null || !PatchCanBeInstalledOnHost(patch, host))).ToList(); - if (outOfDateHosts.Count() == hosts.Count) + if (outOfDateHosts.Count == hosts.Count) alert.IncludeConnection(xc); else alert.IncludeHosts(outOfDateHosts); @@ -853,10 +843,10 @@ namespace XenAdmin.Core public static void CheckServerVersion() { var alerts = NewXenServerVersionAlerts(XenServerVersionsForAutoCheck); - if (alerts == null || alerts.Count == 0) + if (alerts == null) return; - alerts.ForEach(a => CheckUpdate(a)); + alerts.ForEach(CheckUpdate); } public static void CheckServerPatches() @@ -865,7 +855,7 @@ namespace XenAdmin.Core if (alerts == null) return; - alerts.ForEach(a => CheckUpdate(a)); + alerts.ForEach(CheckUpdate); } private static void CheckUpdate(XenServerUpdateAlert alert) @@ -874,10 +864,14 @@ namespace XenAdmin.Core if (existingAlert != null && alert.CanIgnore) RemoveUpdate(existingAlert); - else if (existingAlert != null) - ((XenServerUpdateAlert)existingAlert).CopyConnectionsAndHosts(alert); + else if (existingAlert is XenServerUpdateAlert updAlert) + { + RemoveUpdate(updAlert); + updAlert.CopyConnectionsAndHosts(alert); + AddUpdate(updAlert); + } else if (!alert.CanIgnore) - AddUpate(alert); + AddUpdate(alert); } public static void RestoreDismissedUpdates() @@ -908,7 +902,7 @@ namespace XenAdmin.Core private static XenServerPatchAlert FindPatchAlert(Predicate predicate) { - var existingAlert = FindUpdate(a => a is XenServerPatchAlert && predicate(((XenServerPatchAlert)a).Patch)); + var existingAlert = FindUpdate(a => a is XenServerPatchAlert patchAlert && predicate(patchAlert.Patch)); if (existingAlert != null) return existingAlert as XenServerPatchAlert; diff --git a/XenAdmin/Diagnostics/Checks/CfuAvailabilityCheck.cs b/XenAdmin/Diagnostics/Checks/CfuAvailabilityCheck.cs index 42484a0b0..502930e1e 100644 --- a/XenAdmin/Diagnostics/Checks/CfuAvailabilityCheck.cs +++ b/XenAdmin/Diagnostics/Checks/CfuAvailabilityCheck.cs @@ -42,7 +42,7 @@ namespace XenAdmin.Diagnostics.Checks protected override Problem RunCheck() { - var action = Updates.CreateDownloadUpdatesXmlAction(Updates.CheckForUpdatesUrl); + var action = Updates.CreateDownloadUpdatesXmlAction(); try { diff --git a/XenAdmin/Diagnostics/Checks/PatchPrecheckCheck.cs b/XenAdmin/Diagnostics/Checks/PatchPrecheckCheck.cs index 086613f49..22d713f36 100644 --- a/XenAdmin/Diagnostics/Checks/PatchPrecheckCheck.cs +++ b/XenAdmin/Diagnostics/Checks/PatchPrecheckCheck.cs @@ -39,6 +39,7 @@ using System.Text.RegularExpressions; using System.Xml; using System.Collections.Generic; using XenAdmin.Actions; +using XenAdmin.Diagnostics.Problems.PoolProblem; namespace XenAdmin.Diagnostics.Checks { @@ -98,8 +99,6 @@ namespace XenAdmin.Diagnostics.Checks Session session = Host.Connection.DuplicateSession(); - - try { if (Patch != null) @@ -139,10 +138,7 @@ namespace XenAdmin.Diagnostics.Checks } } - public override string Description - { - get { return Messages.SERVER_SIDE_CHECK_DESCRIPTION; } - } + public override string Description => Messages.SERVER_SIDE_CHECK_DESCRIPTION; /// /// Find problem from xml result @@ -184,7 +180,7 @@ namespace XenAdmin.Diagnostics.Checks else if (node.Name == "required") required = node.InnerXml; } - var problem = FindProblem(errorcode, found, required); + var problem = FindProblem(errorcode, "", found, required); return problem ?? new PrecheckFailed(this, Host, new Failure(errorcode)); } @@ -192,14 +188,25 @@ namespace XenAdmin.Diagnostics.Checks /// Find problem from xapi Failure /// /// Xapi failure, thrown by Pool_patch.precheck() call. - /// E.g.: failure.ErrorDescription.Count = 4 + /// E.g.: failure.ErrorDescription.Count = 4 /// ErrorDescription[0] = "PATCH_PRECHECK_FAILED_WRONG_SERVER_VERSION" /// ErrorDescription[1] = "OpaqueRef:612b5eee-03dc-bbf5-3385-6905fdc9b079" /// ErrorDescription[2] = "6.5.0" /// ErrorDescription[3] = "^6\\.2\\.0$" - /// E.g.: failure.ErrorDescription.Count = 2 + /// + /// E.g.: failure.ErrorDescription.Count = 2 /// ErrorDescription[0] = "OUT_OF_SPACE" /// ErrorDescription[1] = "/var/patch" + /// + /// E.g.: failure.ErrorDescription.Count = 3 with the last parameter being an xml string + /// ErrorDescription[0] = "UPDATE_PRECHECK_FAILED_UNKNOWN_ERROR" + /// ErrorDescription[1] = "test-update" + /// ErrorDescription[2] = "" + /// + /// E.g.: failure.ErrorDescription.Count = 3 with the last parameter being a plain string + /// ErrorDescription[0] = "UPDATE_PRECHECK_FAILED_UNKNOWN_ERROR" + /// ErrorDescription[1] = "CH82" + /// ErrorDescription[2] = "VSWITCH_CONTROLLER_CONNECTED\nYou must [...] this update\n" /// /// Problem or null, if no problem found private Problem FindProblem(Failure failure) @@ -208,21 +215,17 @@ namespace XenAdmin.Diagnostics.Checks return null; var errorcode = failure.ErrorDescription[0]; - var found = ""; - var required = ""; + var param1 = failure.ErrorDescription.Count > 1 ? failure.ErrorDescription[1] : ""; + var param2 = failure.ErrorDescription.Count > 2 ? failure.ErrorDescription[2] : ""; + var param3 = failure.ErrorDescription.Count > 3 ? failure.ErrorDescription[3] : ""; - if (failure.ErrorDescription.Count > 2) - found = failure.ErrorDescription[2]; - if (failure.ErrorDescription.Count > 3) - required = failure.ErrorDescription[3]; - - return FindProblem(errorcode, found, required); + return FindProblem(errorcode, param1, param2, param3); } - private Problem FindProblem(string errorcode, string found, string required) + private Problem FindProblem(string errorcode, string param1, string param2, string param3) { - long requiredSpace = 0; - long foundSpace = 0; + long requiredSpace; + long foundSpace; long reclaimableDiskSpace = 0; DiskSpaceRequirements diskSpaceReq; @@ -233,19 +236,19 @@ namespace XenAdmin.Diagnostics.Checks return new WrongServerVersion(this, Host); case "UPDATE_PRECHECK_FAILED_CONFLICT_PRESENT": - return new ConflictingUpdatePresent(this, found, Host); + return new ConflictingUpdatePresent(this, param2, Host); case "UPDATE_PRECHECK_FAILED_PREREQUISITE_MISSING": - return new PrerequisiteUpdateMissing(this, found, Host); + return new PrerequisiteUpdateMissing(this, param2, Host); case "PATCH_PRECHECK_FAILED_WRONG_SERVER_VERSION": - return new WrongServerVersion(this, required, Host); + return new WrongServerVersion(this, param3, Host); case "PATCH_PRECHECK_FAILED_OUT_OF_SPACE": System.Diagnostics.Trace.Assert(!Helpers.ElyOrGreater(Host.Connection)); // If Ely or greater, we shouldn't get this error - long.TryParse(found, out foundSpace); - long.TryParse(required, out requiredSpace); + long.TryParse(param2, out foundSpace); + long.TryParse(param3, out requiredSpace); // get reclaimable disk space (excluding current patch) try { @@ -264,8 +267,9 @@ namespace XenAdmin.Diagnostics.Checks case "UPDATE_PRECHECK_FAILED_OUT_OF_SPACE": System.Diagnostics.Trace.Assert(Helpers.ElyOrGreater(Host.Connection)); // If not Ely or greater, we shouldn't get this error - long.TryParse(found, out foundSpace); - long.TryParse(required, out requiredSpace); + + long.TryParse(param2, out foundSpace); + long.TryParse(param3, out requiredSpace); diskSpaceReq = new DiskSpaceRequirements(DiskSpaceRequirements.OperationTypes.install, Host, Update.Name(), requiredSpace, foundSpace, 0); @@ -294,12 +298,15 @@ namespace XenAdmin.Diagnostics.Checks case "LICENCE_RESTRICTION": return new LicenseRestrictionProblem(this, Host); case "UPDATE_PRECHECK_FAILED_UNKNOWN_ERROR": - // try to find the problem from the error parameters as xml string - // e.g. - // ErrorDescription[0] = "UPDATE_PRECHECK_FAILED_UNKNOWN_ERROR" - // ErrorDescription[1] = "test-update" - // ErrorDescription[2] = "" - return FindProblem(found); + if (param1 == "CH82" && param2.StartsWith("VSWITCH_CONTROLLER_CONNECTED")) + { + var pool = Helpers.GetPoolOfOne(Host.Connection); + if (pool.vSwitchController()) + return new VSwitchControllerProblem(this, pool); + return null; + } + else + return FindProblem(param2); } return null; } diff --git a/XenAdmin/Diagnostics/Checks/VSwitchControllerCheck.cs b/XenAdmin/Diagnostics/Checks/VSwitchControllerCheck.cs new file mode 100644 index 000000000..a0b1e62e9 --- /dev/null +++ b/XenAdmin/Diagnostics/Checks/VSwitchControllerCheck.cs @@ -0,0 +1,117 @@ +/* Copyright (c) Citrix Systems, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, + * with or without modification, are permitted provided + * that the following conditions are met: + * + * * Redistributions of source code must retain the above + * copyright notice, this list of conditions and the + * following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using XenAdmin.Core; +using XenAdmin.Diagnostics.Hotfixing; +using XenAdmin.Diagnostics.Problems; +using XenAdmin.Diagnostics.Problems.HostProblem; +using XenAdmin.Diagnostics.Problems.PoolProblem; +using XenAPI; + +namespace XenAdmin.Diagnostics.Checks +{ + class VSwitchControllerCheck : HostPostLivenessCheck + { + private readonly Dictionary _installMethodConfig; + private readonly Pool _pool; + private readonly XenServerVersion _newVersion; + private readonly bool _manualUpgrade; + + public VSwitchControllerCheck(Host host, XenServerVersion newVersion) + : base(host) + { + _newVersion = newVersion; + _pool = Helpers.GetPoolOfOne(Host?.Connection); + } + + public VSwitchControllerCheck(Host host, Dictionary installMethodConfig, bool manualUpgrade) + : base(host) + { + _installMethodConfig = installMethodConfig; + _manualUpgrade = manualUpgrade; + _pool = Helpers.GetPoolOfOne(Host?.Connection); + } + + public override string Description => Messages.CHECKING_VSWITCH_CONTROLLER; + + public override bool CanRun() + { + if (Helpers.StockholmOrGreater(Host)) + return false; + + if (_pool == null || !_pool.vSwitchController()) + return false; + + if (_newVersion != null && !Helpers.NaplesOrGreater(Host)) + return false; + + return true; + } + + protected override Problem RunHostCheck() + { + //update case + if (_newVersion != null) + { + if (_newVersion.Version.CompareTo(new Version(BrandManager.ProductVersion82)) >= 0) + return new VSwitchControllerProblem(this, _pool); + return null; + } + + //upgrade case + + if (!_manualUpgrade) + { + var hotfix = HotfixFactory.Hotfix(Host); + if (hotfix != null && hotfix.ShouldBeAppliedTo(Host)) + return new HostDoesNotHaveHotfixWarning(this, Host); + } + + string upgradePlatformVersion = null; + + if (_installMethodConfig != null) + Host.TryGetUpgradeVersion(Host, _installMethodConfig, out upgradePlatformVersion, out _); + + // we don't know the upgrade version, so add generic warning + // (this is the case of the manual upgrade or when the rpu plugin doesn't have the function) + if (string.IsNullOrEmpty(upgradePlatformVersion)) + return new VSwitchControllerWarning(this, _pool); + + // we know they are upgrading to Stockholm or greater, so block them + if (Helpers.StockholmOrGreater(upgradePlatformVersion)) + return new VSwitchControllerProblem(this, _pool); + + return null; + } + } +} diff --git a/XenAdmin/Diagnostics/Problems/PoolProblem/VSwitchControllerProblem.cs b/XenAdmin/Diagnostics/Problems/PoolProblem/VSwitchControllerProblem.cs new file mode 100644 index 000000000..797ab528d --- /dev/null +++ b/XenAdmin/Diagnostics/Problems/PoolProblem/VSwitchControllerProblem.cs @@ -0,0 +1,86 @@ +/* Copyright (c) Citrix Systems, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, + * with or without modification, are permitted provided + * that the following conditions are met: + * + * * Redistributions of source code must retain the above + * copyright notice, this list of conditions and the + * following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +using XenAdmin.Core; +using XenAdmin.Diagnostics.Checks; +using XenAPI; + + +namespace XenAdmin.Diagnostics.Problems.PoolProblem +{ + class VSwitchControllerProblem : ProblemWithMoreInfo + { + private Pool _pool; + + public VSwitchControllerProblem(Check check, Pool pool) + : base(check) + { + _pool = pool; + } + + public override string Title => Check.Description; + + public override string LinkData => InvisibleMessages.DEPRECATION_URL; + public override string LinkText => Messages.LEARN_MORE; + + public override string Description => + string.Format(Messages.PROBLEM_VSWITCH_CONTROLLER_DESCRIPTION, _pool, + string.Format(Messages.XENSERVER_8_2, BrandManager.ProductVersion82)); + + public override string Message => + string.Format(Messages.PROBLEM_VSWITCH_CONTROLLER_INFO_ERROR, + string.Format(Messages.XENSERVER_8_2, BrandManager.ProductVersion82)); + } + + class VSwitchControllerWarning : WarningWithMoreInfo + { + private readonly Pool pool; + + public VSwitchControllerWarning(Check check, Pool pool) + : base(check) + { + this.pool = pool; + } + + public override string Title => Check.Description; + + public override string LinkData => InvisibleMessages.DEPRECATION_URL; + public override string LinkText => Messages.LEARN_MORE; + + public override string Description => + string.Format(Messages.PROBLEM_VSWITCH_CONTROLLER_DESCRIPTION, pool, + string.Format(Messages.XENSERVER_8_2, BrandManager.ProductVersion82)); + + public override string Message => + string.Format(Messages.PROBLEM_VSWITCH_CONTROLLER_INFO_WARNING, + string.Format(Messages.XENSERVER_8_2, BrandManager.ProductVersion82)); + } +} diff --git a/XenAdmin/Diagnostics/Problems/Problem.cs b/XenAdmin/Diagnostics/Problems/Problem.cs index be453a751..5cf76b5db 100644 --- a/XenAdmin/Diagnostics/Problems/Problem.cs +++ b/XenAdmin/Diagnostics/Problems/Problem.cs @@ -137,6 +137,46 @@ namespace XenAdmin.Diagnostics.Problems #endregion } + + public abstract class ProblemWithMoreInfo : Problem + { + protected ProblemWithMoreInfo(Check check) + : base(check) + { + } + + public override bool IsFixable => false; + + public override string HelpMessage => Messages.MORE_INFO; + + public abstract string Message { get; } + + public virtual string LinkData => null; + public virtual string LinkText => LinkData; + + protected override AsyncAction CreateAction(out bool cancelled) + { + Program.Invoke(Program.MainWindow, delegate () + { + using (var dlg = new ThreeButtonDialog( + new ThreeButtonDialog.Details(SystemIcons.Error, Message))) + { + if (!string.IsNullOrEmpty(LinkText) && !string.IsNullOrEmpty(LinkData)) + { + dlg.LinkText = LinkText; + dlg.LinkData = LinkData; + dlg.ShowLinkLabel = true; + } + dlg.ShowDialog(); + } + }); + + cancelled = true; + return null; + } + } + + public abstract class ProblemWithInformationUrl : Problem { protected ProblemWithInformationUrl(Check check) : base(check) diff --git a/XenAdmin/Diagnostics/Problems/Warning.cs b/XenAdmin/Diagnostics/Problems/Warning.cs index a1f92b232..f68443ce0 100644 --- a/XenAdmin/Diagnostics/Problems/Warning.cs +++ b/XenAdmin/Diagnostics/Problems/Warning.cs @@ -54,22 +54,25 @@ namespace XenAdmin.Diagnostics.Problems public abstract class WarningWithMoreInfo : Warning { - protected WarningWithMoreInfo(Check check) - : base(check) + protected WarningWithMoreInfo(Check check) : base(check) { } public override string HelpMessage => Messages.MORE_INFO; - public abstract string Message { get; } - protected override Actions.AsyncAction CreateAction(out bool cancelled) { - Program.Invoke(Program.MainWindow, delegate () + Program.Invoke(Program.MainWindow, () => { using (var dlg = new ThreeButtonDialog( new ThreeButtonDialog.Details(SystemIcons.Warning, Message))) { + if (!string.IsNullOrEmpty(LinkText) && !string.IsNullOrEmpty(LinkData)) + { + dlg.LinkText = LinkText; + dlg.LinkData = LinkData; + dlg.ShowLinkLabel = true; + } dlg.ShowDialog(); } }); @@ -77,6 +80,11 @@ namespace XenAdmin.Diagnostics.Problems cancelled = true; return null; } + + public abstract string Message { get; } + + public virtual string LinkData => null; + public virtual string LinkText => LinkData; } diff --git a/XenAdmin/Dialogs/ConversionDialog.resx b/XenAdmin/Dialogs/ConversionDialog.resx index 999190370..59acad8bf 100644 --- a/XenAdmin/Dialogs/ConversionDialog.resx +++ b/XenAdmin/Dialogs/ConversionDialog.resx @@ -131,7 +131,7 @@ True - WMware Server + VMware Server 10 diff --git a/XenAdmin/Dialogs/LegalNoticesDialog.zh-CN.resx b/XenAdmin/Dialogs/LegalNoticesDialog.zh-CN.resx index b93e02493..6e8a393a5 100644 --- a/XenAdmin/Dialogs/LegalNoticesDialog.zh-CN.resx +++ b/XenAdmin/Dialogs/LegalNoticesDialog.zh-CN.resx @@ -300,7 +300,7 @@ Xen, the Xen logo, XenMotion are trademarks and/or registered trademarks of [Cit 5 - [Citrix]、[Citrix XenServer]、{0}、Xen 和 Xen 徽标、[XenCenter]、XenMotion 是 [Citrix] Systems, Inc. 在美国及其他国家/地区的商标和/或注册商标。 + [Citrix]、[Citrix XenServer]、{0}、Xen、Xen 徽标、[XenCenter]、XenMotion 是 [Citrix] Systems, Inc. 在美国及其他国家/地区的商标和/或注册商标。 label1 diff --git a/XenAdmin/Dialogs/OptionsPages/UpdatesOptionsPage.cs b/XenAdmin/Dialogs/OptionsPages/UpdatesOptionsPage.cs index 3cd449cba..8804dac9d 100644 --- a/XenAdmin/Dialogs/OptionsPages/UpdatesOptionsPage.cs +++ b/XenAdmin/Dialogs/OptionsPages/UpdatesOptionsPage.cs @@ -29,12 +29,7 @@ * SUCH DAMAGE. */ -using System; -using System.Collections.Generic; -using System.ComponentModel; using System.Drawing; -using System.Data; -using System.Text; using System.Windows.Forms; using XenAdmin.Properties; using XenAdmin.Core; @@ -49,11 +44,10 @@ namespace XenAdmin.Dialogs.OptionsPages public UpdatesOptionsPage() { InitializeComponent(); - - build(); + Build(); } - private void build() + private void Build() { // XenCenter updates AllowXenCenterUpdatesCheckBox.Checked = Properties.Settings.Default.AllowXenCenterUpdates; @@ -66,64 +60,43 @@ namespace XenAdmin.Dialogs.OptionsPages public static void Log() { // XenCenter updates - log.Info("=== AllowXenCenterUpdates: " + Properties.Settings.Default.AllowXenCenterUpdates.ToString()); + log.Info("=== AllowXenCenterUpdates: " + Properties.Settings.Default.AllowXenCenterUpdates); // XenServer updates - log.Info("=== AllowPatchesUpdates: " + Properties.Settings.Default.AllowPatchesUpdates.ToString()); - log.Info("=== AllowXenServerUpdates: " + Properties.Settings.Default.AllowXenServerUpdates.ToString()); + log.Info("=== AllowPatchesUpdates: " + Properties.Settings.Default.AllowPatchesUpdates); + log.Info("=== AllowXenServerUpdates: " + Properties.Settings.Default.AllowXenServerUpdates); } #region IOptionsPage Members public void Save() { - bool refreshUpdatesTab = IsCheckForUpdatesRequired(); + bool checkXenCenterUpdates = AllowXenCenterUpdatesCheckBox.Checked != Properties.Settings.Default.AllowXenCenterUpdates; + bool checkPatchUpdates = AllowXenServerPatchesCheckBox.Checked != Properties.Settings.Default.AllowPatchesUpdates; + bool checkVersionUpdates = AllowXenServerUpdatesCheckBox.Checked != Properties.Settings.Default.AllowXenServerUpdates; - // XenCenter updates - if (AllowXenCenterUpdatesCheckBox.Checked != Properties.Settings.Default.AllowXenCenterUpdates) + if (checkXenCenterUpdates) Properties.Settings.Default.AllowXenCenterUpdates = AllowXenCenterUpdatesCheckBox.Checked; - // XenServer updates - if (AllowXenServerPatchesCheckBox.Checked != Properties.Settings.Default.AllowPatchesUpdates) + if (checkPatchUpdates) Properties.Settings.Default.AllowPatchesUpdates = AllowXenServerPatchesCheckBox.Checked; - if (AllowXenServerUpdatesCheckBox.Checked != Properties.Settings.Default.AllowXenServerUpdates) + + if (checkVersionUpdates) Properties.Settings.Default.AllowXenServerUpdates = AllowXenServerUpdatesCheckBox.Checked; - if(refreshUpdatesTab) - { + if(checkXenCenterUpdates || checkPatchUpdates || checkVersionUpdates) Updates.CheckForUpdates(false, true); - } - } - - /// - /// Returns true if at least one box has been changed in Updates Options. Otherwise returns false. - /// - /// - private bool IsCheckForUpdatesRequired() - { - return (AllowXenCenterUpdatesCheckBox.Checked != Properties.Settings.Default.AllowXenCenterUpdates) || - (AllowXenServerPatchesCheckBox.Checked != Properties.Settings.Default.AllowPatchesUpdates) || - (AllowXenServerUpdatesCheckBox.Checked != Properties.Settings.Default.AllowXenServerUpdates); } #endregion #region IVerticalTab Members - public override string Text - { - get { return Messages.UPDATES; } - } + public override string Text => Messages.UPDATES; - public string SubText - { - get { return Messages.UPDATES_DESC; } - } + public string SubText => Messages.UPDATES_DESC; - public Image Image - { - get { return Resources._000_Patch_h32bit_16; } - } + public Image Image => Resources._000_Patch_h32bit_16; #endregion } diff --git a/XenAdmin/Dialogs/ThreeButtonDialog.Designer.cs b/XenAdmin/Dialogs/ThreeButtonDialog.Designer.cs index 60fef0882..d6e69e06e 100644 --- a/XenAdmin/Dialogs/ThreeButtonDialog.Designer.cs +++ b/XenAdmin/Dialogs/ThreeButtonDialog.Designer.cs @@ -37,6 +37,7 @@ namespace XenAdmin.Dialogs this.button1 = new System.Windows.Forms.Button(); this.labelMessage = new System.Windows.Forms.LinkLabel(); this.checkBoxOption = new System.Windows.Forms.CheckBox(); + this.linkLabel1 = new System.Windows.Forms.LinkLabel(); this.tableLayoutPanel1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBoxIcon)).BeginInit(); this.flowLayoutPanel1.SuspendLayout(); @@ -46,9 +47,10 @@ namespace XenAdmin.Dialogs // resources.ApplyResources(this.tableLayoutPanel1, "tableLayoutPanel1"); this.tableLayoutPanel1.Controls.Add(this.pictureBoxIcon, 0, 0); - this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel1, 1, 2); + this.tableLayoutPanel1.Controls.Add(this.flowLayoutPanel1, 1, 3); this.tableLayoutPanel1.Controls.Add(this.labelMessage, 1, 0); - this.tableLayoutPanel1.Controls.Add(this.checkBoxOption, 1, 1); + this.tableLayoutPanel1.Controls.Add(this.checkBoxOption, 1, 2); + this.tableLayoutPanel1.Controls.Add(this.linkLabel1, 1, 1); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; // // pictureBoxIcon @@ -99,6 +101,13 @@ namespace XenAdmin.Dialogs this.checkBoxOption.Name = "checkBoxOption"; this.checkBoxOption.UseVisualStyleBackColor = true; // + // linkLabel1 + // + resources.ApplyResources(this.linkLabel1, "linkLabel1"); + this.linkLabel1.Name = "linkLabel1"; + this.linkLabel1.TabStop = true; + this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked); + // // ThreeButtonDialog // resources.ApplyResources(this, "$this"); @@ -128,5 +137,6 @@ namespace XenAdmin.Dialogs private System.Windows.Forms.Button button3; private System.Windows.Forms.LinkLabel labelMessage; private System.Windows.Forms.CheckBox checkBoxOption; + private System.Windows.Forms.LinkLabel linkLabel1; } } \ No newline at end of file diff --git a/XenAdmin/Dialogs/ThreeButtonDialog.cs b/XenAdmin/Dialogs/ThreeButtonDialog.cs index b84005c44..2ef4314ae 100644 --- a/XenAdmin/Dialogs/ThreeButtonDialog.cs +++ b/XenAdmin/Dialogs/ThreeButtonDialog.cs @@ -147,6 +147,20 @@ namespace XenAdmin.Dialogs } } + public bool ShowLinkLabel + { + get { return linkLabel1.Visible; } + set { linkLabel1.Visible = value; } + } + + public string LinkText + { + get { return linkLabel1.Text; } + set { linkLabel1.Text = value; } + } + + public string LinkData { get; set; } + public bool ShowCheckbox { get { return checkBoxOption.Visible; } @@ -410,6 +424,16 @@ namespace XenAdmin.Dialogs } catch { } // Best effort } + + private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + { + try + { + if (!string.IsNullOrEmpty(LinkData)) + System.Diagnostics.Process.Start(LinkData); + } + catch { } + } } public class NonModalThreeButtonDialog : ThreeButtonDialog diff --git a/XenAdmin/Dialogs/ThreeButtonDialog.resx b/XenAdmin/Dialogs/ThreeButtonDialog.resx index 5643cc3a0..5a054cb64 100644 --- a/XenAdmin/Dialogs/ThreeButtonDialog.resx +++ b/XenAdmin/Dialogs/ThreeButtonDialog.resx @@ -180,9 +180,6 @@ 165, 3 - - 3, 3, 0, 0 - 75, 30 @@ -213,9 +210,6 @@ 84, 3 - - 3, 3, 3, 0 - 75, 30 @@ -246,9 +240,6 @@ 3, 3 - - 3, 3, 3, 0 - 75, 30 @@ -277,13 +268,13 @@ Segoe UI, 9pt - 96, 74 + 93, 86 50, 0, 0, 0 - 240, 33 + 243, 36 2 @@ -313,10 +304,10 @@ 0, 0 - 43, 5 + 41, 0 - 5, 5, 5, 15 + 3, 0, 3, 15 409, 9999 @@ -349,7 +340,7 @@ Segoe UI, 9pt - 41, 52 + 41, 64 82, 19 @@ -375,6 +366,39 @@ 3 + + True + + + Segoe UI, 9pt + + + 41, 46 + + + 60, 15 + + + 5 + + + linkLabel1 + + + False + + + linkLabel1 + + + System.Windows.Forms.LinkLabel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanel1 + + + 4 + Fill @@ -388,10 +412,10 @@ 10, 10, 10, 10 - 3 + 4 - 336, 107 + 336, 122 0 @@ -409,7 +433,7 @@ 0 - <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="pictureBoxIcon" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="flowLayoutPanel1" Row="2" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="labelMessage" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="checkBoxOption" Row="1" RowSpan="1" Column="1" ColumnSpan="1" /></Controls><Columns Styles="AutoSize,0,Percent,100" /><Rows Styles="Percent,100,AutoSize,0,AutoSize,0" /></TableLayoutSettings> + <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="pictureBoxIcon" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="flowLayoutPanel1" Row="3" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="labelMessage" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="checkBoxOption" Row="2" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="linkLabel1" Row="1" RowSpan="1" Column="1" ColumnSpan="1" /></Controls><Columns Styles="AutoSize,0,Percent,100" /><Rows Styles="Percent,100,AutoSize,0,AutoSize,0,AutoSize,0" /></TableLayoutSettings> True @@ -424,7 +448,7 @@ GrowAndShrink - 356, 127 + 356, 142 Segoe UI, 9pt diff --git a/XenAdmin/Dialogs/VIFDialog.cs b/XenAdmin/Dialogs/VIFDialog.cs index d34d09ede..e17ce68dd 100644 --- a/XenAdmin/Dialogs/VIFDialog.cs +++ b/XenAdmin/Dialogs/VIFDialog.cs @@ -76,7 +76,7 @@ namespace XenAdmin.Dialogs { // Check if vSwitch Controller is configured for the pool (CA-46299) Pool pool = Helpers.GetPoolOfOne(connection); - var vSwitchController = pool != null && pool.vSwitchController(); + var vSwitchController = !Helpers.StockholmOrGreater(connection) && pool != null && pool.vSwitchController(); if (vSwitchController) { @@ -203,21 +203,9 @@ namespace XenAdmin.Dialogs comboBoxNetwork.SelectedIndex = 0; } - private XenAPI.Network SelectedNetwork - { - get - { - return ((NetworkComboBoxItem)comboBoxNetwork.SelectedItem).Network; - } - } + private XenAPI.Network SelectedNetwork => (comboBoxNetwork.SelectedItem as NetworkComboBoxItem)?.Network; - private string SelectedMac - { - get - { - return radioButtonAutogenerate.Checked ? "" : promptTextBoxMac.Text; - } - } + private string SelectedMac => radioButtonAutogenerate.Checked ? "" : promptTextBoxMac.Text; public VIF NewVif() { @@ -387,16 +375,7 @@ namespace XenAdmin.Dialogs #endregion - internal override string HelpName - { - get - { - if (ExistingVif != null) - return "EditVmNetworkSettingsDialog"; - else - return "VIFDialog"; - } - } + internal override string HelpName => ExistingVif == null ? "VIFDialog" : "EditVmNetworkSettingsDialog"; } public class NetworkComboBoxItem : IEquatable diff --git a/XenAdmin/Dialogs/WarningDialogs/VcpuWarningDialog.cs b/XenAdmin/Dialogs/WarningDialogs/VcpuWarningDialog.cs index b1c68947c..fb4b5c507 100644 --- a/XenAdmin/Dialogs/WarningDialogs/VcpuWarningDialog.cs +++ b/XenAdmin/Dialogs/WarningDialogs/VcpuWarningDialog.cs @@ -73,7 +73,7 @@ namespace XenAdmin.Dialogs vm.Locked = false; } } - else if (Program.MainWindow.SelectObject(vm)) + else if (Program.MainWindow.SelectObjectInTree(vm)) { Program.MainWindow.SwitchToTab(MainWindow.Tab.General); } diff --git a/XenAdmin/Dialogs/XenDialogBase.cs b/XenAdmin/Dialogs/XenDialogBase.cs index 0493b1cdb..ee16bd7a6 100644 --- a/XenAdmin/Dialogs/XenDialogBase.cs +++ b/XenAdmin/Dialogs/XenDialogBase.cs @@ -32,16 +32,22 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using System.Linq; using System.Windows.Forms; using XenAdmin.Network; using XenAdmin.Core; using XenAdmin.Help; +using XenAPI; namespace XenAdmin.Dialogs { public partial class XenDialogBase : Form, IFormWithHelp { - private static Dictionary> instances = new Dictionary>(); + private static readonly Dictionary> instances = new Dictionary>(); + private static readonly Dictionary instancePerXenObject = new Dictionary(); + + protected readonly IXenConnection connection; + private IXenObject ownerXenObject; private static void AddInstance(IXenConnection connection, XenDialogBase dialog) { @@ -79,7 +85,24 @@ namespace XenAdmin.Dialogs } } - protected readonly IXenConnection connection; + public static void CloseAll(params IXenObject[] xenObjects) + { + Program.AssertOnEventThread(); + + if (xenObjects == null) + return; + + foreach (var kvp in instancePerXenObject.ToDictionary(p => p.Key, p => p.Value)) + { + if (!xenObjects.Contains(kvp.Key)) + continue; + + if (kvp.Value is Form form && !form.IsDisposed) + form.Close(); + + instancePerXenObject.Remove(kvp.Key); + } + } /// /// The VS designer does not seem to understand optional parameters, @@ -103,16 +126,38 @@ namespace XenAdmin.Dialogs AddInstance(connection, this); } + /// + /// override if the reference in the help differs to the dialogs name + /// + internal virtual string HelpName => Name; + /// /// Allow the XenDialogBase.OnClosed to set Owner.Activate() - this will push the Owner /// to the top of the windows stack stealing focus. /// protected bool OwnerActivatedOnClosed { get; set; } = true; + public void ShowPerXenObject(IXenObject obj, Form ownerForm) + { + CloseAll(obj); + ownerXenObject = obj; + instancePerXenObject.Add(obj, this); + Show(ownerForm); + } + protected override void OnClosed(EventArgs e) { base.OnClosed(e); + if (ownerXenObject != null) + { + foreach (var kvp in instancePerXenObject.ToDictionary(p => p.Key, p => p.Value)) + { + if (kvp.Key.Equals(ownerXenObject)) + instancePerXenObject.Remove(kvp.Key); + } + } + lock (instances) { if (connection != null && instances.ContainsKey(connection)) @@ -125,18 +170,13 @@ namespace XenAdmin.Dialogs Owner.Activate(); } - private void XenDialogBase_Load(object sender, EventArgs e) - { - //this.Owner = Program.MainWindow; - this.CenterToParent(); - FormFontFixer.Fix(this); - } - public bool HasHelp() { return HelpManager.TryGetTopicId(HelpName, out _); } + #region Event handlers + private void XenDialogBase_HelpButtonClicked(object sender, CancelEventArgs e) { HelpManager.Launch(HelpName); @@ -149,11 +189,6 @@ namespace XenAdmin.Dialogs hlpevent.Handled = true; } - /// - /// override if the reference in the help differs to the dialogs name - /// - internal virtual string HelpName => Name; - private void XenDialogBase_Shown(object sender, EventArgs e) { if (Modal && Owner != null && Owner.WindowState == FormWindowState.Minimized) @@ -162,5 +197,13 @@ namespace XenAdmin.Dialogs CenterToParent(); } } + + private void XenDialogBase_Load(object sender, EventArgs e) + { + CenterToParent(); + FormFontFixer.Fix(this); + } + + #endregion } } diff --git a/XenAdmin/IMainWindow.cs b/XenAdmin/IMainWindow.cs index e476c428e..8e58644a7 100644 --- a/XenAdmin/IMainWindow.cs +++ b/XenAdmin/IMainWindow.cs @@ -51,12 +51,10 @@ namespace XenAdmin void TrySelectNewObjectInTree(Predicate tagMatch, bool selectNode, bool expandNode, bool ensureNodeVisible); void TrySelectNewObjectInTree(IXenConnection c, bool selectNode, bool expandNode, bool ensureNodeVisible); void RequestRefreshTreeView(); - void ShowPerXenModelObjectWizard(IXenObject obj, Form wizard); void ShowPerConnectionWizard(IXenConnection connection, Form wizard, Form parentForm = null); Form ShowForm(Type type); Form ShowForm(Type type, object[] args); void CloseActiveWizards(IXenConnection connection); - void CloseActiveWizards(IXenObject xenObject); Collection GetXenConnectionsCopy(); void SaveServerList(); bool DoSearch(string filename); diff --git a/XenAdmin/MainWindow.cs b/XenAdmin/MainWindow.cs index 0f60bda29..0ea3a96dd 100755 --- a/XenAdmin/MainWindow.cs +++ b/XenAdmin/MainWindow.cs @@ -118,7 +118,6 @@ namespace XenAdmin private bool mainWindowResized = false; private readonly Dictionary> activePoolWizards = new Dictionary>(); - private readonly Dictionary activeXenModelObjectWizards = new Dictionary(); /// /// The arguments passed in on the command line. @@ -1015,7 +1014,7 @@ namespace XenAdmin { if (host.IsLive() && host.MaintenanceMode() && host.enabled) { - Program.MainWindow.CloseActiveWizards(host); + Program.Invoke(this, () => XenDialogBase.CloseAll(host)); var action = new DisableHostAction(host); action.Completed += action_Completed; @@ -1071,7 +1070,7 @@ namespace XenAdmin { VM vm = (VM)e.Element; ConsolePanel.closeVNCForSource(vm); - CloseActiveWizards(vm); + XenDialogBase.CloseAll(vm); } selectedTabs.Remove(o); @@ -1132,6 +1131,21 @@ namespace XenAdmin if(Helpers.GetPool(host.Connection) == null) host.Connection.FriendlyName = Helpers.GetName(host); break; + + case "patches": + if (!Helpers.ElyOrGreater(host)) + { + Updates.CheckServerPatches(); + Updates.CheckServerVersion(); + } + break; + case "updates": + if (Helpers.ElyOrGreater(host)) + { + Updates.CheckServerPatches(); + Updates.CheckServerVersion(); + } + break; } } @@ -2219,24 +2233,15 @@ namespace XenAdmin #region IMainWindowCommandInterface Members /// - /// Closes all per-Connection and per-VM wizards for the given connection. + /// Closes all per-Connection and per-XenObject forms for the given connection. /// /// public void CloseActiveWizards(IXenConnection connection) { Program.Invoke(Program.MainWindow, delegate { - var vms = connection.Cache.VMs; - foreach (var kvp in activeXenModelObjectWizards) - { - if (kvp.Key is VM vm && vms.Contains(vm)) - { - if (kvp.Value is Form wizard && !wizard.IsDisposed) - wizard.Close(); - - activeXenModelObjectWizards.Remove(vm); - } - } + //so far we show per-xenObject forms only for VMs and Hosts + XenDialogBase.CloseAll(connection.Cache.VMs.Cast().Union(connection.Cache.Hosts).ToArray()); if (activePoolWizards.TryGetValue(connection, out IList
wizards)) { @@ -2251,36 +2256,6 @@ namespace XenAdmin }); } - /// - /// Closes all per-XenObject wizards. - /// - /// - public void CloseActiveWizards(IXenObject obj) - { - Program.Invoke(Program.MainWindow, delegate - { - if (activeXenModelObjectWizards.TryGetValue(obj, out Form wizard)) - { - if (!wizard.IsDisposed) - wizard.Close(); - - activeXenModelObjectWizards.Remove(obj); - } - }); - } - - /// - /// Show the given wizard, and impose a one-wizard-per-XenObject limit. - /// - /// The relevant VM - /// The new wizard to show - public void ShowPerXenModelObjectWizard(IXenObject obj, Form wizard) - { - CloseActiveWizards(obj); - activeXenModelObjectWizards.Add(obj, wizard); - wizard.Show(this); - } - /// /// Show the given wizard, and impose a one-wizard-per-connection limit. /// @@ -2366,9 +2341,14 @@ namespace XenAdmin Program.Invoke(this, method); } + /// + /// Selects the specified object in the treeview. + /// + /// The object to be selected. + /// A value indicating whether selection was successful. public bool SelectObjectInTree(IXenObject xenObject) { - return SelectObject(xenObject); + return navigationPane.SelectObject(xenObject); } public Collection GetXenConnectionsCopy() @@ -2396,7 +2376,6 @@ namespace XenAdmin EditSelectedNodeInTreeView(); } - public void TrySelectNewObjectInTree(Predicate tagMatch, bool selectNode, bool expandNode, bool ensureNodeVisible) { TrySelectNewNode(tagMatch, selectNode, expandNode, ensureNodeVisible); @@ -2556,16 +2535,6 @@ namespace XenAdmin }); } - /// - /// Selects the specified object in the treeview. - /// - /// The object to be selected. - /// A value indicating whether selection was successful. - public bool SelectObject(IXenObject o) - { - return navigationPane.SelectObject(o); - } - private void eventsPage_GoToXenObjectRequested(IXenObject obj) { navigationPane.SwitchToInfrastructureMode(); diff --git a/XenAdmin/Network/XenConnectionUI.cs b/XenAdmin/Network/XenConnectionUI.cs index 09e70fbdb..b22c12892 100644 --- a/XenAdmin/Network/XenConnectionUI.cs +++ b/XenAdmin/Network/XenConnectionUI.cs @@ -58,19 +58,19 @@ namespace XenAdmin.Network public static void BeginConnect(IXenConnection connection, bool interactive, Form owner, bool initiateMasterSearch) { Program.AssertOnEventThread(); - RegisterEventHandlers(connection); + if (interactive) { // CA-214953 - Focus on this connection's dialog, if one exists, otherwise create one if (connectionDialogs.TryGetValue(connection, out ConnectingToServerDialog dlg)) { - UnregisterEventHandlers(connection); if (dlg.WindowState == FormWindowState.Minimized) dlg.WindowState = FormWindowState.Normal; dlg.Focus(); return; } + RegisterEventHandlers(connection); dlg = new ConnectingToServerDialog(connection); connectionDialogs.Add(connection, dlg); @@ -78,7 +78,10 @@ namespace XenAdmin.Network connectionDialogs.Remove(connection); } else + { + RegisterEventHandlers(connection); ((XenConnection)connection).BeginConnect(initiateMasterSearch, PromptForNewPassword); + } } private static bool PromptForNewPassword(IXenConnection connection, string oldPassword) diff --git a/XenAdmin/SettingsPanels/ClusteringEditPage.resx b/XenAdmin/SettingsPanels/ClusteringEditPage.resx index 23c86929f..ad4acd458 100644 --- a/XenAdmin/SettingsPanels/ClusteringEditPage.resx +++ b/XenAdmin/SettingsPanels/ClusteringEditPage.resx @@ -145,7 +145,7 @@ 0 - Clustering allows you to create and use thinly provisioned (GFS2) storage repositories. Select whether you want to enable clustering on this pool. Clustering can be enabled on any management or storage network that has an IP address configured on all hosts in the pool. It is recommended to use a bonded network that is not used for storage. + Clustering allows you to create and use thinly provisioned (GFS2) storage repositories. Select whether you want to enable clustering on this pool. For the cluster network use a dedicated bonded network that has an IP address configured on all hosts in the pool. Ensure that the bonded NICs are on the same L2 segment. labelTitle diff --git a/XenAdmin/TabPages/ManageUpdatesPage.Designer.cs b/XenAdmin/TabPages/ManageUpdatesPage.Designer.cs index 32460b1fe..af8e776b1 100644 --- a/XenAdmin/TabPages/ManageUpdatesPage.Designer.cs +++ b/XenAdmin/TabPages/ManageUpdatesPage.Designer.cs @@ -165,19 +165,17 @@ // // byUpdateToolStripMenuItem // - this.byUpdateToolStripMenuItem.CheckOnClick = true; this.byUpdateToolStripMenuItem.Image = global::XenAdmin.Properties.Resources.notif_updates_16; resources.ApplyResources(this.byUpdateToolStripMenuItem, "byUpdateToolStripMenuItem"); this.byUpdateToolStripMenuItem.Name = "byUpdateToolStripMenuItem"; - this.byUpdateToolStripMenuItem.CheckedChanged += new System.EventHandler(this.byUpdateToolStripMenuItem_CheckedChanged); + this.byUpdateToolStripMenuItem.Click += new System.EventHandler(this.byUpdateToolStripMenuItem_Click); // // byHostToolStripMenuItem // - this.byHostToolStripMenuItem.CheckOnClick = true; this.byHostToolStripMenuItem.Image = global::XenAdmin.Properties.Resources._000_TreeConnected_h32bit_16; resources.ApplyResources(this.byHostToolStripMenuItem, "byHostToolStripMenuItem"); this.byHostToolStripMenuItem.Name = "byHostToolStripMenuItem"; - this.byHostToolStripMenuItem.CheckedChanged += new System.EventHandler(this.byHostToolStripMenuItem_CheckedChanged); + this.byHostToolStripMenuItem.Click += new System.EventHandler(this.byHostToolStripMenuItem_Click); // // toolStripSeparator2 // diff --git a/XenAdmin/TabPages/ManageUpdatesPage.cs b/XenAdmin/TabPages/ManageUpdatesPage.cs index 741fafa62..6ac3f6f4a 100644 --- a/XenAdmin/TabPages/ManageUpdatesPage.cs +++ b/XenAdmin/TabPages/ManageUpdatesPage.cs @@ -66,7 +66,9 @@ namespace XenAdmin.TabPages private List collapsedPoolRowsList = new List(); private int checksQueue; private bool CheckForUpdatesInProgress; - private readonly CollectionChangeEventHandler m_updateCollectionChangedWithInvoke; + + private volatile bool _buildInProgress; + private volatile bool _buildRequired; public ManageUpdatesPage() { @@ -74,7 +76,6 @@ namespace XenAdmin.TabPages InitializeProgressControls(); tableLayoutPanel1.Visible = false; UpdateButtonEnablement(); - m_updateCollectionChangedWithInvoke = Program.ProgramInvokeHandler(UpdatesCollectionChanged); toolStripSplitButtonDismiss.DefaultItem = dismissAllToolStripMenuItem; toolStripSplitButtonDismiss.Text = dismissAllToolStripMenuItem.Text; @@ -84,6 +85,7 @@ namespace XenAdmin.TabPages checksQueue++; byHostToolStripMenuItem.Checked = Properties.Settings.Default.ShowUpdatesByServer; byUpdateToolStripMenuItem.Checked = !Properties.Settings.Default.ShowUpdatesByServer; + ToggleView(); } finally { @@ -101,7 +103,7 @@ namespace XenAdmin.TabPages protected override void RegisterEventHandlers() { - Updates.RegisterCollectionChanged(m_updateCollectionChangedWithInvoke); + Updates.RegisterCollectionChanged(UpdatesCollectionChanged); Updates.RestoreDismissedUpdatesStarted += Updates_RestoreDismissedUpdatesStarted; Updates.CheckForUpdatesStarted += CheckForUpdates_CheckForUpdatesStarted; Updates.CheckForUpdatesCompleted += CheckForUpdates_CheckForUpdatesCompleted; @@ -109,7 +111,7 @@ namespace XenAdmin.TabPages protected override void DeregisterEventHandlers() { - Updates.DeregisterCollectionChanged(m_updateCollectionChangedWithInvoke); + Updates.DeregisterCollectionChanged(UpdatesCollectionChanged); Updates.RestoreDismissedUpdatesStarted -= Updates_RestoreDismissedUpdatesStarted; Updates.CheckForUpdatesStarted -= CheckForUpdates_CheckForUpdatesStarted; Updates.CheckForUpdatesCompleted -= CheckForUpdates_CheckForUpdatesCompleted; @@ -121,25 +123,16 @@ namespace XenAdmin.TabPages private void UpdatesCollectionChanged(object sender, CollectionChangeEventArgs e) { - Program.AssertOnEventThread(); - switch (e.Action) { case CollectionChangeAction.Add: Rebuild(); // rebuild entire alert list to ensure filtering and sorting break; case CollectionChangeAction.Remove: - Alert a = e.Element as Alert; - if (a != null) - { - RemoveUpdateRow(a); - } - else - { - var range = e.Element as List; - if (range != null) - Rebuild(); - } + if (e.Element is Alert a) + Program.Invoke(Program.MainWindow, () => RemoveUpdateRow(a)); + else if (e.Element is List) + Rebuild(); break; } } @@ -252,18 +245,40 @@ namespace XenAdmin.TabPages private void Rebuild() { - Program.AssertOnEventThread(); - - if (!Visible || checksQueue > 0) + if (_buildInProgress) + { + _buildRequired = true; return; + } - SetFilterLabel(); - ToggleTopWarningVisibility(); + Program.Invoke(Program.MainWindow, () => + { + if (!Visible || checksQueue > 0) + return; - if (byUpdateToolStripMenuItem.Checked) - RebuildUpdateView(); - else - RebuildHostView(); + try + { + _buildInProgress = true; + + SetFilterLabel(); + ToggleTopWarningVisibility(); + + if (byUpdateToolStripMenuItem.Checked) + RebuildUpdateView(); + else + RebuildHostView(); + } + finally + { + _buildInProgress = false; + + if (_buildRequired) + { + _buildRequired = false; + Rebuild(); + } + } + }); } private class UpdatePageByHostDataGridView : CollapsingPoolHostDataGridView @@ -360,16 +375,13 @@ namespace XenAdmin.TabPages // fill data into row private void UpdateDetails() { - Pool pool = Tag as Pool; - - if (pool != null) + if (Tag is Pool pool) { Host master = pool.Connection.Resolve(pool.master); SetCollapseIcon(); _poolIconCell.Value = Images.GetImage16For(pool); - DataGridViewTextAndImageCell nc = _nameCell as DataGridViewTextAndImageCell; - if (nc != null) + if (_nameCell is DataGridViewTextAndImageCell nc) nc.Image = null; _nameCell.Value = pool.Name(); @@ -390,51 +402,42 @@ namespace XenAdmin.TabPages _statusCell.Value = String.Empty; } } - - else + else if (Tag is Host host) { - Host host = Tag as Host; - if (host != null) + var hostRequired = RequiredUpdatesForHost(host); + var hostInstalled = InstalledUpdatesForHost(host); + var outOfDate = hostRequired.Length > 0; + + DataGridViewTextAndImageCell nc = _nameCell as DataGridViewTextAndImageCell; + + if (_hasPool && nc != null) // host in pool { - var hostRequired = RequiredUpdatesForHost(host); - var hostInstalled = InstalledUpdatesForHost(host); - var outOfDate = hostRequired.Length > 0; - - DataGridViewTextAndImageCell nc = _nameCell as DataGridViewTextAndImageCell; - - if (_hasPool && nc != null) // host in pool + nc.Image = Images.GetImage16For(host); + _statusCell.Value = String.Empty; + } + else if (!_hasPool && nc != null) // standalone host + { + _poolIconCell.Value = Images.GetImage16For(host); + nc.Image = null; + if (IsFullyPopulated) + { + _patchingStatusCell.Value = outOfDate + ? Properties.Resources._000_error_h32bit_16 + : Properties.Resources._000_Tick_h32bit_16; + _statusCell.Value = outOfDate ? Messages.NOT_UPDATED : Messages.UPDATED; + } + else { - nc.Image = Images.GetImage16For(host); _statusCell.Value = String.Empty; } - else if (!_hasPool && nc != null) // standalone host - { - _poolIconCell.Value = Images.GetImage16For(host); - nc.Image = null; - if (IsFullyPopulated) - { - _patchingStatusCell.Value = outOfDate - ? Properties.Resources._000_error_h32bit_16 - : Properties.Resources._000_Tick_h32bit_16; - _statusCell.Value = outOfDate ? Messages.NOT_UPDATED : Messages.UPDATED; - } - else - { - _statusCell.Value = String.Empty; - } - } - - _nameCell.Value = host.Name(); - _versionCell.Value = host.ProductVersionTextShort(); - _installedUpdateCell.Value = hostInstalled; - if (IsFullyPopulated) - _requiredUpdateCell.Value = hostRequired; - else - _requiredUpdateCell.Value = String.Empty; } + + _nameCell.Value = host.Name(); + _versionCell.Value = host.ProductVersionTextShort(); + _installedUpdateCell.Value = hostInstalled; + _requiredUpdateCell.Value = IsFullyPopulated ? hostRequired : string.Empty; } } - } private static string RequiredUpdatesForHost(Host host) @@ -663,7 +666,6 @@ namespace XenAdmin.TabPages /// /// Runs all the current filters on the alert to determine if it should be shown in the list or not. /// - /// private bool FilterAlert(Alert alert) { var hosts = new List(); @@ -809,7 +811,7 @@ namespace XenAdmin.TabPages if (!string.IsNullOrEmpty(alert.WebPageLabel)) { - var fix = new ToolStripMenuItem(alert.FixLinkText); + var fix = new ToolStripMenuItem(alert.FixLinkText) {ToolTipText = alert.WebPageLabel}; fix.Click += ToolStripMenuItemGoToWebPage_Click; items.Add(fix); } @@ -855,7 +857,6 @@ namespace XenAdmin.TabPages /// After the Delete action is completed the page is refreshed and the restore dismissed /// button is enabled again. /// - /// private void DeleteAllAlertsAction_Completed(ActionBase sender) { Program.Invoke(Program.MainWindow, () => @@ -881,8 +882,6 @@ namespace XenAdmin.TabPages /// If the answer of the user to the dialog is YES, then make a list with all the updates and call /// DismissUpdates on that list. /// - /// - /// private void dismissAllToolStripMenuItem_Click(object sender, EventArgs e) { DialogResult result = DialogResult.Yes; @@ -929,8 +928,6 @@ namespace XenAdmin.TabPages /// If the answer of the user to the dialog is YES, then make a list of all the selected rows /// and call DismissUpdates on that list. /// - /// - /// private void dismissSelectedToolStripMenuItem_Click(object sender, EventArgs e) { if (!Properties.Settings.Default.DoNotConfirmDismissUpdates) @@ -1428,19 +1425,21 @@ namespace XenAdmin.TabPages labelProgress.MaximumSize = new Size(tableLayoutPanel3.Width - 60, tableLayoutPanel3.Size.Height); } - private void byUpdateToolStripMenuItem_CheckedChanged(object sender, EventArgs e) + private void byUpdateToolStripMenuItem_Click(object sender, EventArgs e) { - if (byUpdateToolStripMenuItem.Checked) + if (!byUpdateToolStripMenuItem.Checked) { + byUpdateToolStripMenuItem.Checked = true; byHostToolStripMenuItem.Checked = false; ToggleView(); } } - private void byHostToolStripMenuItem_CheckedChanged(object sender, EventArgs e) + private void byHostToolStripMenuItem_Click(object sender, EventArgs e) { - if (byHostToolStripMenuItem.Checked) + if (!byHostToolStripMenuItem.Checked) { + byHostToolStripMenuItem.Checked = true; byUpdateToolStripMenuItem.Checked = false; ToggleView(); } diff --git a/XenAdmin/Wizards/GenericPages/DelayLoadingOptionComboBoxItem.cs b/XenAdmin/Wizards/GenericPages/DelayLoadingOptionComboBoxItem.cs index e1c812190..7050328b8 100644 --- a/XenAdmin/Wizards/GenericPages/DelayLoadingOptionComboBoxItem.cs +++ b/XenAdmin/Wizards/GenericPages/DelayLoadingOptionComboBoxItem.cs @@ -136,7 +136,7 @@ namespace XenAdmin.Wizards.GenericPages } } while (retries-- > 0); - FailureReason = Messages.DELAY_LOADED_COMBO_BOX_ITEM_FAILURE_UNKOWN; + FailureReason = Messages.DELAY_LOADED_COMBO_BOX_ITEM_FAILURE_UNKNOWN; } /// diff --git a/XenAdmin/Wizards/HAWizard_Pages/AssignPriorities.cs b/XenAdmin/Wizards/HAWizard_Pages/AssignPriorities.cs index 70d168032..7881c6c8c 100755 --- a/XenAdmin/Wizards/HAWizard_Pages/AssignPriorities.cs +++ b/XenAdmin/Wizards/HAWizard_Pages/AssignPriorities.cs @@ -780,7 +780,7 @@ namespace XenAdmin.Wizards.HAWizard_Pages break; default: // We shouldn't really be here unless we have not iterated through all the return errors from vm.assert_agile - msg = Messages.NOT_AGILE_UNKOWN; + msg = Messages.NOT_AGILE_UNKNOWN; break; } diff --git a/XenAdmin/Wizards/NewNetworkWizard.cs b/XenAdmin/Wizards/NewNetworkWizard.cs index bcc56c26d..1aac00f0f 100644 --- a/XenAdmin/Wizards/NewNetworkWizard.cs +++ b/XenAdmin/Wizards/NewNetworkWizard.cs @@ -230,11 +230,8 @@ namespace XenAdmin.Wizards nic = pageNetworkDetails.SelectedHostNic; } - - long vlan = pageNetworkDetails.VLAN; - NetworkAction action = pageNetworkType.SelectedNetworkType == NetworkTypes.External - ? new NetworkAction(xenConnection, network, nic, vlan) + ? new NetworkAction(xenConnection, network, nic, pageNetworkDetails.VLAN) : new NetworkAction(xenConnection, network, true); action.RunAsync(); } @@ -251,14 +248,18 @@ namespace XenAdmin.Wizards var autoPlug = pageNetworkType.SelectedNetworkType == NetworkTypes.CHIN ? pageChinDetails.isAutomaticAddNicToVM : pageNetworkType.SelectedNetworkType == NetworkTypes.SRIOV - ? pageSriovDetails.isAutomaticAddNicToVM - : pageNetworkDetails.isAutomaticAddNicToVM; + ? pageSriovDetails.AddNicToVmsAutomatically + : pageNetworkDetails.AddNicToVmsAutomatically; result.SetAutoPlug(autoPlug); if (pageNetworkType.SelectedNetworkType == NetworkTypes.CHIN) result.MTU = pageChinDetails.MTU; - else if (pageNetworkDetails.MTU.HasValue) //Custom MTU may not be allowed if we are making a virtual network or something - result.MTU = pageNetworkDetails.MTU.Value; + else + { + int mtu = pageNetworkDetails.MTU; + if (mtu != -1) //Custom MTU may not be allowed if we are making a virtual network or something + result.MTU = mtu; + } return result; } diff --git a/XenAdmin/Wizards/NewNetworkWizard.resx b/XenAdmin/Wizards/NewNetworkWizard.resx index 392fc969f..97477c445 100644 --- a/XenAdmin/Wizards/NewNetworkWizard.resx +++ b/XenAdmin/Wizards/NewNetworkWizard.resx @@ -161,7 +161,7 @@ Tahoma, 8pt - 775, 535 + 790, 560 NewNetworkWizard diff --git a/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWBondDetails.cs b/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWBondDetails.cs index 626118d47..b48f2e0bd 100644 --- a/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWBondDetails.cs +++ b/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWBondDetails.cs @@ -32,7 +32,6 @@ using System; using System.Collections.Generic; using XenAdmin.Controls; -using XenAdmin.Core; using XenAPI; @@ -56,11 +55,6 @@ namespace XenAdmin.Wizards.NewNetworkWizard_Pages return Details.Valid; } - protected override void PageLoadedCore(PageLoadedDirection direction) - { - HelpersGUI.FocusFirstControl(Controls); - } - protected override void PageLeaveCore(PageLoadedDirection direction, ref bool cancel) { if (direction == PageLoadedDirection.Forward) diff --git a/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWBondDetails.resx b/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWBondDetails.resx index 4b847ddff..38ee26598 100644 --- a/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWBondDetails.resx +++ b/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWBondDetails.resx @@ -112,26 +112,26 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + 1 True - + Fill NoControl - + 0, 0 @@ -154,7 +154,7 @@ label1 - System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 tableLayoutPanel1 @@ -175,7 +175,7 @@ 433, 385 - 0 + 1 Details @@ -205,13 +205,13 @@ 433, 426 - 1 + 0 tableLayoutPanel1 - System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 $this @@ -222,7 +222,7 @@ <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="label1" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="Details" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /></Controls><Columns Styles="Percent,100" /><Rows Styles="AutoSize,0,Percent,100" /></TableLayoutSettings> - + True diff --git a/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWChinDetails.Designer.cs b/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWChinDetails.Designer.cs index 4b68f554d..8518e8a9e 100644 --- a/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWChinDetails.Designer.cs +++ b/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWChinDetails.Designer.cs @@ -89,7 +89,6 @@ this.tableLayoutPanel1.SetColumnSpan(this.tableLayoutPanelMTUWarning, 2); this.tableLayoutPanelMTUWarning.Controls.Add(this.pictureBox1, 0, 0); this.tableLayoutPanelMTUWarning.Controls.Add(this.labelMTUWarning, 1, 0); - this.tableLayoutPanelMTUWarning.MinimumSize = new System.Drawing.Size(0, 40); this.tableLayoutPanelMTUWarning.Name = "tableLayoutPanelMTUWarning"; // // pictureBox1 diff --git a/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWChinDetails.cs b/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWChinDetails.cs index 550d95aa3..08d2fa1f2 100644 --- a/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWChinDetails.cs +++ b/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWChinDetails.cs @@ -31,13 +31,7 @@ using System; using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Data; -using System.Text; -using System.Windows.Forms; using XenAdmin.Controls; -using XenAdmin.Core; using XenAdmin.Network; using XenAPI; @@ -55,9 +49,9 @@ namespace XenAdmin.Wizards.NewNetworkWizard_Pages numericUpDownMTU.Visible = labelMTU.Visible = tableLayoutPanelMTUWarning.Visible = false; } - public override string Text { get { return Messages.NETW_DETAILS_TEXT; } } - - public override string PageTitle { get { return Messages.NETW_CHIN_DETAILS_TITLE; } } + public override string Text => Messages.NETW_DETAILS_TEXT; + + public override string PageTitle => Messages.NETW_CHIN_DETAILS_TITLE; public override bool EnableNext() { @@ -66,7 +60,7 @@ namespace XenAdmin.Wizards.NewNetworkWizard_Pages protected override void PageLoadedCore(PageLoadedDirection direction) { - HelpersGUI.FocusFirstControl(Controls); + comboInterfaces.Focus(); } public override void PopulatePage() @@ -77,20 +71,11 @@ namespace XenAdmin.Wizards.NewNetworkWizard_Pages public Host Host { private get; set; } public Pool Pool { private get; set; } - public XenAPI.Network SelectedInterface - { - get { return (XenAPI.Network)comboInterfaces.SelectedItem; } - } + public XenAPI.Network SelectedInterface => (XenAPI.Network)comboInterfaces.SelectedItem; - public bool isAutomaticAddNicToVM - { - get { return cbxAutomatic.Checked; } - } + public bool isAutomaticAddNicToVM => cbxAutomatic.Checked; - public long MTU - { - get { return (long)numericUpDownMTU.Value; } - } + public long MTU => (long)numericUpDownMTU.Value; private void PopulateInterfaces(Pool pool, Host host, IXenConnection connection) { @@ -116,7 +101,7 @@ namespace XenAdmin.Wizards.NewNetworkWizard_Pages } } } - comboInterfaces.SelectedIndexChanged += new EventHandler(comboInterfaces_SelectedIndexChanged); + comboInterfaces.SelectedIndexChanged += comboInterfaces_SelectedIndexChanged; if (comboInterfaces.Items.Count > 0) comboInterfaces.SelectedIndex = 0; diff --git a/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWChinDetails.resx b/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWChinDetails.resx index cd417bf70..0790569d7 100644 --- a/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWChinDetails.resx +++ b/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWChinDetails.resx @@ -112,40 +112,37 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + True - - - TopLeft - 2 True - + NoControl + - 0, 0 + 3, 0 - 0, 0, 0, 30 + 3, 0, 3, 30 - 491, 26 + 461, 26 - 101 + 0 Select a management interface for the new network to use and configure any additional settings before proceeding. @@ -158,7 +155,7 @@ lblNicHelp - System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 tableLayoutPanel1 @@ -170,22 +167,19 @@ Top, Left, Right - 119, 56 - - - 0, 0, 0, 0 + 125, 59 - 374, 21 + 365, 21 - 1 + 2 comboInterfaces - System.Windows.Forms.ComboBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 tableLayoutPanel1 @@ -193,23 +187,20 @@ 1 + + Left + True - - Fill - - 0, 56 - - - 0, 0, 3, 0 + 3, 63 - 116, 21 + 116, 13 - 0 + 1 &Management interface: @@ -221,7 +212,7 @@ label2 - System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 tableLayoutPanel1 @@ -236,17 +227,11 @@ 2 - 0, 0 - - - 0, 0, 3, 0 + 3, 3 16, 16 - - AutoSize - 1 @@ -254,7 +239,7 @@ pictureBox1 - System.Windows.Forms.PictureBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 tableLayoutPanelMTUWarning @@ -266,19 +251,16 @@ True - Fill + Top NoControl - 19, 0 - - - 0, 0, 0, 0 + 25, 0 - 474, 45 + 465, 26 0 @@ -290,7 +272,7 @@ labelMTUWarning - System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 tableLayoutPanelMTUWarning @@ -307,14 +289,17 @@ 0, 0, 0, 0 + + 0, 40 + 1 - 493, 45 + 493, 40 - 102 + 5 False @@ -323,7 +308,7 @@ tableLayoutPanelMTUWarning - System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 tableLayoutPanel1 @@ -334,23 +319,20 @@ <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="pictureBox1" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="labelMTUWarning" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /></Controls><Columns Styles="AutoSize,50,Percent,50" /><Rows Styles="Percent,50" /></TableLayoutSettings> + + Left + True - - Fill - - 0, 84 - - - 0, 7, 3, 5 + 3, 89 - 116, 20 + 34, 13 - 2 + 3 MTU: @@ -362,7 +344,7 @@ labelMTU - System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 tableLayoutPanel1 @@ -371,22 +353,19 @@ 5 - 119, 84 - - - 0, 7, 0, 5 + 125, 86 96, 20 - 3 + 4 numericUpDownMTU - System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.NumericUpDown, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 tableLayoutPanel1 @@ -407,13 +386,13 @@ 493, 276 - 5 + 0 tableLayoutPanel1 - System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 $this @@ -422,22 +401,22 @@ 0 - <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="lblNicHelp" Row="0" RowSpan="1" Column="0" ColumnSpan="2" /><Control Name="comboInterfaces" Row="1" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="label2" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="cbxAutomatic" Row="4" RowSpan="1" Column="0" ColumnSpan="2" /><Control Name="tableLayoutPanelMTUWarning" Row="3" RowSpan="1" Column="0" ColumnSpan="2" /><Control Name="labelMTU" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="numericUpDownMTU" Row="2" RowSpan="1" Column="1" ColumnSpan="1" /></Controls><Columns Styles="AutoSize,0,Percent,100" /><Rows Styles="AutoSize,0,AutoSize,0,AutoSize,0,Absolute,45,Percent,100,Absolute,20" /></TableLayoutSettings> + <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="lblNicHelp" Row="0" RowSpan="1" Column="0" ColumnSpan="2" /><Control Name="comboInterfaces" Row="1" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="label2" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="cbxAutomatic" Row="4" RowSpan="1" Column="0" ColumnSpan="2" /><Control Name="tableLayoutPanelMTUWarning" Row="3" RowSpan="1" Column="0" ColumnSpan="2" /><Control Name="labelMTU" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="numericUpDownMTU" Row="2" RowSpan="1" Column="1" ColumnSpan="1" /></Controls><Columns Styles="AutoSize,0,Percent,100" /><Rows Styles="AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,Percent,100" /></TableLayoutSettings> NoControl - 3, 161 + 3, 159 - 3, 7, 3, 3 + 3, 10, 3, 3 286, 17 - 4 + 6 &Automatically add this network to new virtual machines. @@ -449,7 +428,7 @@ cbxAutomatic - System.Windows.Forms.CheckBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 tableLayoutPanel1 @@ -457,7 +436,7 @@ 3 - + True diff --git a/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWDetails.Designer.cs b/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWDetails.Designer.cs index 6cc3cfb9e..6130ddc7f 100644 --- a/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWDetails.Designer.cs +++ b/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWDetails.Designer.cs @@ -29,112 +29,66 @@ namespace XenAdmin.Wizards.NewNetworkWizard_Pages private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(NetWDetails)); - this.panel1 = new System.Windows.Forms.Panel(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); - this.infoMtuPanel = new System.Windows.Forms.Panel(); - this.infoMtuMessage = new System.Windows.Forms.Label(); - this.pictureBox2 = new System.Windows.Forms.PictureBox(); + this.labelExternal = new System.Windows.Forms.Label(); + this.labelInternal = new System.Windows.Forms.Label(); this.labelNIC = new System.Windows.Forms.Label(); - this.labelVLAN = new System.Windows.Forms.Label(); - this.lblNicHelp = new System.Windows.Forms.Label(); - this.numericUpDownVLAN = new System.Windows.Forms.NumericUpDown(); this.comboBoxNICList = new System.Windows.Forms.ComboBox(); + this.labelVLAN = new System.Windows.Forms.Label(); + this.numericUpDownVLAN = new System.Windows.Forms.NumericUpDown(); + this.infoVlanPanel = new System.Windows.Forms.TableLayoutPanel(); + this.pictureBoxVlan = new System.Windows.Forms.PictureBox(); + this.labelVlanMessage = new System.Windows.Forms.Label(); this.labelMTU = new System.Windows.Forms.Label(); this.numericUpDownMTU = new System.Windows.Forms.NumericUpDown(); - this.panelVLANInfo = new System.Windows.Forms.Panel(); - this.labelVlanError = new System.Windows.Forms.Label(); - this.labelVLAN0Info = new System.Windows.Forms.Label(); - this.checkBoxAutomatic = new System.Windows.Forms.CheckBox(); + this.infoMtuPanel = new System.Windows.Forms.TableLayoutPanel(); + this.pictureBoxMtu = new System.Windows.Forms.PictureBox(); + this.labelMtuMessage = new System.Windows.Forms.Label(); this.checkBoxSriov = new System.Windows.Forms.CheckBox(); - this.panel1.SuspendLayout(); + this.checkBoxAutomatic = new System.Windows.Forms.CheckBox(); this.tableLayoutPanel1.SuspendLayout(); - this.infoMtuPanel.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownVLAN)).BeginInit(); + this.infoVlanPanel.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBoxVlan)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownMTU)).BeginInit(); - this.panelVLANInfo.SuspendLayout(); + this.infoMtuPanel.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBoxMtu)).BeginInit(); this.SuspendLayout(); // - // panel1 - // - resources.ApplyResources(this.panel1, "panel1"); - this.panel1.BackColor = System.Drawing.SystemColors.Control; - this.panel1.Controls.Add(this.tableLayoutPanel1); - this.panel1.Name = "panel1"; - // // tableLayoutPanel1 // resources.ApplyResources(this.tableLayoutPanel1, "tableLayoutPanel1"); - this.tableLayoutPanel1.Controls.Add(this.infoMtuPanel, 2, 3); - this.tableLayoutPanel1.Controls.Add(this.labelNIC, 0, 1); - this.tableLayoutPanel1.Controls.Add(this.labelVLAN, 0, 2); - this.tableLayoutPanel1.Controls.Add(this.lblNicHelp, 0, 0); - this.tableLayoutPanel1.Controls.Add(this.numericUpDownVLAN, 1, 2); - this.tableLayoutPanel1.Controls.Add(this.comboBoxNICList, 1, 1); - this.tableLayoutPanel1.Controls.Add(this.labelMTU, 0, 3); - this.tableLayoutPanel1.Controls.Add(this.numericUpDownMTU, 1, 3); - this.tableLayoutPanel1.Controls.Add(this.panelVLANInfo, 2, 2); - this.tableLayoutPanel1.Controls.Add(this.checkBoxAutomatic, 0, 5); - this.tableLayoutPanel1.Controls.Add(this.checkBoxSriov, 0, 4); + this.tableLayoutPanel1.Controls.Add(this.labelExternal, 0, 0); + this.tableLayoutPanel1.Controls.Add(this.labelInternal, 0, 1); + this.tableLayoutPanel1.Controls.Add(this.labelNIC, 0, 2); + this.tableLayoutPanel1.Controls.Add(this.comboBoxNICList, 1, 2); + this.tableLayoutPanel1.Controls.Add(this.labelVLAN, 0, 3); + this.tableLayoutPanel1.Controls.Add(this.numericUpDownVLAN, 1, 3); + this.tableLayoutPanel1.Controls.Add(this.infoVlanPanel, 2, 3); + this.tableLayoutPanel1.Controls.Add(this.labelMTU, 0, 4); + this.tableLayoutPanel1.Controls.Add(this.numericUpDownMTU, 1, 4); + this.tableLayoutPanel1.Controls.Add(this.infoMtuPanel, 2, 4); + this.tableLayoutPanel1.Controls.Add(this.checkBoxSriov, 0, 5); + this.tableLayoutPanel1.Controls.Add(this.checkBoxAutomatic, 0, 6); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; // - // infoMtuPanel + // labelExternal // - resources.ApplyResources(this.infoMtuPanel, "infoMtuPanel"); - this.tableLayoutPanel1.SetColumnSpan(this.infoMtuPanel, 2); - this.infoMtuPanel.Controls.Add(this.infoMtuMessage); - this.infoMtuPanel.Controls.Add(this.pictureBox2); - this.infoMtuPanel.Name = "infoMtuPanel"; + resources.ApplyResources(this.labelExternal, "labelExternal"); + this.tableLayoutPanel1.SetColumnSpan(this.labelExternal, 4); + this.labelExternal.Name = "labelExternal"; // - // infoMtuMessage + // labelInternal // - resources.ApplyResources(this.infoMtuMessage, "infoMtuMessage"); - this.infoMtuMessage.Name = "infoMtuMessage"; - // - // pictureBox2 - // - resources.ApplyResources(this.pictureBox2, "pictureBox2"); - this.pictureBox2.Image = global::XenAdmin.Properties.Resources._000_Info3_h32bit_16; - this.pictureBox2.Name = "pictureBox2"; - this.pictureBox2.TabStop = false; + resources.ApplyResources(this.labelInternal, "labelInternal"); + this.tableLayoutPanel1.SetColumnSpan(this.labelInternal, 4); + this.labelInternal.Name = "labelInternal"; // // labelNIC // resources.ApplyResources(this.labelNIC, "labelNIC"); this.labelNIC.Name = "labelNIC"; // - // labelVLAN - // - resources.ApplyResources(this.labelVLAN, "labelVLAN"); - this.labelVLAN.Name = "labelVLAN"; - // - // lblNicHelp - // - resources.ApplyResources(this.lblNicHelp, "lblNicHelp"); - this.tableLayoutPanel1.SetColumnSpan(this.lblNicHelp, 4); - this.lblNicHelp.Name = "lblNicHelp"; - // - // numericUpDownVLAN - // - resources.ApplyResources(this.numericUpDownVLAN, "numericUpDownVLAN"); - this.numericUpDownVLAN.Maximum = new decimal(new int[] { - 4094, - 0, - 0, - 0}); - this.numericUpDownVLAN.Minimum = new decimal(new int[] { - 1, - 0, - 0, - 0}); - this.numericUpDownVLAN.Name = "numericUpDownVLAN"; - this.numericUpDownVLAN.Value = new decimal(new int[] { - 1, - 0, - 0, - 0}); - this.numericUpDownVLAN.ValueChanged += new System.EventHandler(this.nudVLAN_ValueChanged); - // // comboBoxNICList // this.tableLayoutPanel1.SetColumnSpan(this.comboBoxNICList, 2); @@ -146,6 +100,37 @@ namespace XenAdmin.Wizards.NewNetworkWizard_Pages this.comboBoxNICList.Sorted = true; this.comboBoxNICList.SelectedIndexChanged += new System.EventHandler(this.cmbHostNicList_SelectedIndexChanged); // + // labelVLAN + // + resources.ApplyResources(this.labelVLAN, "labelVLAN"); + this.labelVLAN.Name = "labelVLAN"; + // + // numericUpDownVLAN + // + resources.ApplyResources(this.numericUpDownVLAN, "numericUpDownVLAN"); + this.numericUpDownVLAN.Name = "numericUpDownVLAN"; + this.numericUpDownVLAN.ValueChanged += new System.EventHandler(this.numericUpDownVLAN_ValueChanged); + this.numericUpDownVLAN.Leave += new System.EventHandler(this.numericUpDownVLAN_Leave); + // + // infoVlanPanel + // + resources.ApplyResources(this.infoVlanPanel, "infoVlanPanel"); + this.tableLayoutPanel1.SetColumnSpan(this.infoVlanPanel, 2); + this.infoVlanPanel.Controls.Add(this.pictureBoxVlan, 0, 0); + this.infoVlanPanel.Controls.Add(this.labelVlanMessage, 1, 0); + this.infoVlanPanel.Name = "infoVlanPanel"; + // + // pictureBoxVlan + // + resources.ApplyResources(this.pictureBoxVlan, "pictureBoxVlan"); + this.pictureBoxVlan.Name = "pictureBoxVlan"; + this.pictureBoxVlan.TabStop = false; + // + // labelVlanMessage + // + resources.ApplyResources(this.labelVlanMessage, "labelVlanMessage"); + this.labelVlanMessage.Name = "labelVlanMessage"; + // // labelMTU // resources.ApplyResources(this.labelMTU, "labelMTU"); @@ -155,33 +140,27 @@ namespace XenAdmin.Wizards.NewNetworkWizard_Pages // resources.ApplyResources(this.numericUpDownMTU, "numericUpDownMTU"); this.numericUpDownMTU.Name = "numericUpDownMTU"; + this.numericUpDownMTU.ValueChanged += new System.EventHandler(this.numericUpDownMTU_ValueChanged); + this.numericUpDownMTU.Leave += new System.EventHandler(this.numericUpDownMTU_Leave); // - // panelVLANInfo + // infoMtuPanel // - resources.ApplyResources(this.panelVLANInfo, "panelVLANInfo"); - this.tableLayoutPanel1.SetColumnSpan(this.panelVLANInfo, 2); - this.panelVLANInfo.Controls.Add(this.labelVlanError); - this.panelVLANInfo.Controls.Add(this.labelVLAN0Info); - this.panelVLANInfo.Name = "panelVLANInfo"; + resources.ApplyResources(this.infoMtuPanel, "infoMtuPanel"); + this.tableLayoutPanel1.SetColumnSpan(this.infoMtuPanel, 2); + this.infoMtuPanel.Controls.Add(this.pictureBoxMtu, 0, 0); + this.infoMtuPanel.Controls.Add(this.labelMtuMessage, 1, 0); + this.infoMtuPanel.Name = "infoMtuPanel"; // - // labelVlanError + // pictureBoxMtu // - resources.ApplyResources(this.labelVlanError, "labelVlanError"); - this.labelVlanError.ForeColor = System.Drawing.Color.Red; - this.labelVlanError.Name = "labelVlanError"; + resources.ApplyResources(this.pictureBoxMtu, "pictureBoxMtu"); + this.pictureBoxMtu.Name = "pictureBoxMtu"; + this.pictureBoxMtu.TabStop = false; // - // labelVLAN0Info + // labelMtuMessage // - resources.ApplyResources(this.labelVLAN0Info, "labelVLAN0Info"); - this.labelVLAN0Info.ForeColor = System.Drawing.SystemColors.ControlText; - this.labelVLAN0Info.Name = "labelVLAN0Info"; - // - // checkBoxAutomatic - // - resources.ApplyResources(this.checkBoxAutomatic, "checkBoxAutomatic"); - this.tableLayoutPanel1.SetColumnSpan(this.checkBoxAutomatic, 4); - this.checkBoxAutomatic.Name = "checkBoxAutomatic"; - this.checkBoxAutomatic.UseVisualStyleBackColor = true; + resources.ApplyResources(this.labelMtuMessage, "labelMtuMessage"); + this.labelMtuMessage.Name = "labelMtuMessage"; // // checkBoxSriov // @@ -191,45 +170,51 @@ namespace XenAdmin.Wizards.NewNetworkWizard_Pages this.checkBoxSriov.UseVisualStyleBackColor = true; this.checkBoxSriov.CheckedChanged += new System.EventHandler(this.checkBoxSriov_CheckedChanged); // + // checkBoxAutomatic + // + resources.ApplyResources(this.checkBoxAutomatic, "checkBoxAutomatic"); + this.tableLayoutPanel1.SetColumnSpan(this.checkBoxAutomatic, 4); + this.checkBoxAutomatic.Name = "checkBoxAutomatic"; + this.checkBoxAutomatic.UseVisualStyleBackColor = true; + // // NetWDetails // resources.ApplyResources(this, "$this"); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; this.BackColor = System.Drawing.SystemColors.Control; - this.Controls.Add(this.panel1); + this.Controls.Add(this.tableLayoutPanel1); this.Name = "NetWDetails"; - this.panel1.ResumeLayout(false); this.tableLayoutPanel1.ResumeLayout(false); this.tableLayoutPanel1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownVLAN)).EndInit(); + this.infoVlanPanel.ResumeLayout(false); + this.infoVlanPanel.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBoxVlan)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDownMTU)).EndInit(); this.infoMtuPanel.ResumeLayout(false); this.infoMtuPanel.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.numericUpDownVLAN)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.numericUpDownMTU)).EndInit(); - this.panelVLANInfo.ResumeLayout(false); - this.panelVLANInfo.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBoxMtu)).EndInit(); this.ResumeLayout(false); } #endregion - - private System.Windows.Forms.Panel panel1; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; private System.Windows.Forms.Label labelNIC; private System.Windows.Forms.ComboBox comboBoxNICList; - private System.Windows.Forms.NumericUpDown numericUpDownVLAN; private System.Windows.Forms.Label labelVLAN; - private System.Windows.Forms.Label lblNicHelp; + private System.Windows.Forms.Label labelInternal; private System.Windows.Forms.CheckBox checkBoxAutomatic; - private System.Windows.Forms.Label labelVlanError; private System.Windows.Forms.Label labelMTU; - private System.Windows.Forms.NumericUpDown numericUpDownMTU; - private System.Windows.Forms.Panel panelVLANInfo; - private System.Windows.Forms.Label labelVLAN0Info; - private System.Windows.Forms.Panel infoMtuPanel; - private System.Windows.Forms.Label infoMtuMessage; - private System.Windows.Forms.PictureBox pictureBox2; + private System.Windows.Forms.Label labelMtuMessage; + private System.Windows.Forms.PictureBox pictureBoxMtu; private System.Windows.Forms.CheckBox checkBoxSriov; + private System.Windows.Forms.Label labelExternal; + private System.Windows.Forms.TableLayoutPanel infoMtuPanel; + private System.Windows.Forms.TableLayoutPanel infoVlanPanel; + private System.Windows.Forms.PictureBox pictureBoxVlan; + private System.Windows.Forms.Label labelVlanMessage; + private System.Windows.Forms.NumericUpDown numericUpDownVLAN; + private System.Windows.Forms.NumericUpDown numericUpDownMTU; } } diff --git a/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWDetails.cs b/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWDetails.cs index 6c653b4f9..522b41625 100644 --- a/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWDetails.cs +++ b/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWDetails.cs @@ -40,56 +40,84 @@ namespace XenAdmin.Wizards.NewNetworkWizard_Pages { public partial class NetWDetails : XenTabPage { - List vlans; + private List vlans; + private bool _vlanError; + private bool _mtuError; + private bool _populatingNics; public NetWDetails() { InitializeComponent(); - numericUpDownVLAN.LostFocus += checkVLAN; + //non-browsable events numericUpDownVLAN.TextChanged += numericUpDownVLAN_TextChanged; + numericUpDownMTU.TextChanged += numericUpDownMTU_TextChanged; + numericUpDownMTU.Maximum = XenAPI.Network.MTU_MAX; numericUpDownMTU.Minimum = XenAPI.Network.MTU_MIN; numericUpDownMTU.Value = XenAPI.Network.MTU_DEFAULT; + numericUpDownVLAN.Maximum = 4094; } - public override string Text { get { return Messages.NETW_DETAILS_TEXT; } } + public override string Text => Messages.NETW_DETAILS_TEXT; - public override string PageTitle { get - { - return SelectedNetworkType == NetworkTypes.External - ? Messages.NETW_EXTERNAL_DETAILS_TITLE - : Messages.NETW_INTERNAL_DETAILS_TITLE; - } } + public override string PageTitle => + SelectedNetworkType == NetworkTypes.External + ? Messages.NETW_EXTERNAL_DETAILS_TITLE + : Messages.NETW_INTERNAL_DETAILS_TITLE; public override bool EnableNext() { - return (SelectedHostNic != null || !comboBoxNICList.Visible) && !labelVlanError.Visible; - } + if (_vlanError || _mtuError) + return false; - protected override void PageLoadedCore(PageLoadedDirection direction) - { - HelpersGUI.FocusFirstControl(Controls); + return SelectedHostNic != null || !comboBoxNICList.Visible; } public override void PopulatePage() { - PopulateHostNicList(Host, Connection); - UpdateEnablement(SelectedNetworkType == NetworkTypes.External, Host); - //set minimum value for VLAN - numericUpDownVLAN.Minimum = Helpers.VLAN0Allowed(Connection) ? 0 : 1; - } + var external = SelectedNetworkType == NetworkTypes.External; - private int CurrentVLANValue - { - get { return Convert.ToInt32(Math.Round(numericUpDownVLAN.Value, MidpointRounding.AwayFromZero)); } - } + labelExternal.Visible = external; + labelInternal.Visible = !external; + labelNIC.Visible = external; + comboBoxNICList.Visible = external; - private void checkVLAN(object sender, EventArgs e) - { - if (numericUpDownVLAN.Text == "") + if (comboBoxNICList.Visible) { - numericUpDownVLAN.Text = CurrentVLANValue.ToString(); + try + { + _populatingNics = true; + comboBoxNICList.Items.Clear(); + + foreach (PIF ThePIF in Connection.Cache.PIFs) + { + if (ThePIF.host.opaque_ref == Host.opaque_ref && ThePIF.IsPhysical() && + (Properties.Settings.Default.ShowHiddenVMs || ThePIF.Show(Properties.Settings.Default.ShowHiddenVMs)) && + !ThePIF.IsBondSlave()) + { + comboBoxNICList.Items.Add(ThePIF); + } + } + } + finally + { + _populatingNics = false; + } + + if (comboBoxNICList.Items.Count > 0) + comboBoxNICList.SelectedIndex = 0; + + comboBoxNICList.Focus(); } + + labelVLAN.Visible = external; + numericUpDownVLAN.Visible = external; + numericUpDownVLAN.Minimum = Helpers.VLAN0Allowed(Connection) ? 0 : 1; + numericUpDownMTU.Visible = labelMTU.Visible = infoMtuPanel.Visible = external; + + checkBoxSriov.Visible = SelectedHostNic != null && SelectedHostNic.IsSriovPhysicalPIF(); + + OnPageUpdated(); } #region Accessors @@ -98,191 +126,186 @@ namespace XenAdmin.Wizards.NewNetworkWizard_Pages public Host Host { private get; set; } - public PIF SelectedHostNic - { - get { return (PIF)comboBoxNICList.SelectedItem; } - } + public PIF SelectedHostNic => comboBoxNICList.SelectedItem as PIF; - public long VLAN - { - get { return CurrentVLANValue; } - } + public int VLAN => Convert.ToInt32(Math.Round(numericUpDownVLAN.Value, MidpointRounding.AwayFromZero)); - public bool isAutomaticAddNicToVM - { - get { return checkBoxAutomatic.Checked; } - } + public bool AddNicToVmsAutomatically => checkBoxAutomatic.Checked; - public bool CreateVlanOnSriovNetwork - { - get { return checkBoxSriov.Visible && checkBoxSriov.Checked; } - } + public bool CreateVlanOnSriovNetwork => checkBoxSriov.Visible && checkBoxSriov.Checked; /// - /// Null if the custom MTU option is disabled + /// Returns -1 if the custom MTU option is disabled /// - public long? MTU - { - get - { - if (numericUpDownMTU.Enabled) - return (long)numericUpDownMTU.Value; - else - return null; - } - } + public int MTU => numericUpDownMTU.Visible && numericUpDownMTU.Enabled + ? Convert.ToInt32(Math.Round(numericUpDownMTU.Value, MidpointRounding.AwayFromZero)) + : -1; #endregion - private void UpdateEnablement(bool external, Host host) + private List GetVLANList(PIF nic) { - lblNicHelp.Text = external ? Messages.WIZARD_DESC_NETWORK_SETTINGS_EXTERNAL : Messages.WIZARD_DESC_NETWORK_SETTINGS_INTERNAL; - comboBoxNICList.Visible = external; - labelVLAN.Visible = external; - numericUpDownVLAN.Visible = external; - numericUpDownMTU.Visible = labelMTU.Visible = infoMtuPanel.Visible = external; - labelNIC.Visible = external; - if (comboBoxNICList.Items.Count > 0) - comboBoxNICList.SelectedIndex = external ? comboBoxNICList.Items.Count - 1 : -1; - checkBoxSriov.Visible = SelectedHostNic != null && SelectedHostNic.IsSriovPhysicalPIF(); + List vlans = new List(); + foreach (PIF pif in nic.Connection.Cache.PIFs) + { + if (pif.device == nic.device) + { + var pifIsSriov = pif.NetworkSriov() != null; + if ((CreateVlanOnSriovNetwork && pifIsSriov) || (!CreateVlanOnSriovNetwork && !pifIsSriov)) + vlans.Add((int)pif.VLAN); + } + } + + return vlans; + } + + private void ValidateVLANValue() + { + //CA-192746: do not call numericUpDown.Value or properties/methods that call it + //in the validation method, because it auto-corrects what the user has typed + + _vlanError = false; + string msg = null; + + if (!int.TryParse(numericUpDownVLAN.Text.Trim(), out int currentValue)) + { + _vlanError = true; + msg = Messages.INVALID_NUMBER; + } + else if (currentValue < numericUpDownVLAN.Minimum || numericUpDownVLAN.Maximum < currentValue) + { + _vlanError = true; + msg = string.Format(Messages.NETW_DETAILS_VLAN_RANGE, numericUpDownVLAN.Minimum, numericUpDownVLAN.Maximum); + } + else if (vlans != null && vlans.Contains(currentValue)) + { + _vlanError = true; + msg = Messages.NETW_DETAILS_VLAN_NUMBER_IN_USE; + } + else if (currentValue == 0) + { + msg = Messages.NETW_VLAN_ZERO; + } + + if (_vlanError) + { + pictureBoxVlan.Image = Images.StaticImages._000_error_h32bit_16; + labelVlanMessage.Text = msg; + infoVlanPanel.Visible = true; + } + else if (!string.IsNullOrEmpty(msg)) + { + pictureBoxVlan.Image = Images.StaticImages._000_Info3_h32bit_16; + labelVlanMessage.Text = msg; + infoVlanPanel.Visible = true; + } + else + infoVlanPanel.Visible = false; OnPageUpdated(); } - private void PopulateHostNicList(Host host, IXenConnection conn) + private void ValidateMtuValue() { - comboBoxNICList.Items.Clear(); + //CA-192746: do not call numericUpDown.Value or properties/methods that call it + //in the validation method, because it auto-corrects what the user has typed - foreach (PIF ThePIF in conn.Cache.PIFs) + _mtuError = false; + + if (!int.TryParse(numericUpDownMTU.Text.Trim(), out int currentValue)) { - if (ThePIF.host.opaque_ref == host.opaque_ref && ThePIF.IsPhysical() && (Properties.Settings.Default.ShowHiddenVMs || ThePIF.Show(Properties.Settings.Default.ShowHiddenVMs)) && !ThePIF.IsBondSlave()) - { - comboBoxNICList.Items.Add(ThePIF); - } + _mtuError = true; + pictureBoxMtu.Image = Images.StaticImages._000_error_h32bit_16; + labelMtuMessage.Text = Messages.INVALID_NUMBER; } - if (comboBoxNICList.Items.Count > 0) - comboBoxNICList.SelectedIndex = 0; - - cmbHostNicList_SelectedIndexChanged(null, null); - } - - private List GetVLANList(PIF nic) - { - List vlans = new List(); - foreach (PIF pif in nic.Connection.Cache.PIFs) - { - if (pif.device == nic.device) - { - var pifIsSriov = pif.NetworkSriov() != null; - if ((CreateVlanOnSriovNetwork && pifIsSriov) || (!CreateVlanOnSriovNetwork && !pifIsSriov)) - vlans.Add((int)pif.VLAN); - } - } - - return vlans; - } - - private int GetFirstAvailableVLAN(List vlans) - { - //CA-19111: VLAN values should only go up to the numericUpDownVLAN.Maximum (4094) - for (int i = 1; i <= numericUpDownVLAN.Maximum; i++) + else { - if (!vlans.Contains(i)) - return i; + if (currentValue < numericUpDownMTU.Minimum || numericUpDownMTU.Maximum < currentValue) + _mtuError = true; + + pictureBoxMtu.Image = Images.StaticImages._000_Info3_h32bit_16; + labelMtuMessage.Text = numericUpDownMTU.Minimum == numericUpDownMTU.Maximum + ? string.Format(Messages.ALLOWED_MTU_VALUE, numericUpDownMTU.Minimum) + : string.Format(Messages.ALLOWED_MTU_RANGE, numericUpDownMTU.Minimum, numericUpDownMTU.Maximum); } - return -1; + infoMtuPanel.Visible = true; + OnPageUpdated(); } + #region Event Handlers + private void cmbHostNicList_SelectedIndexChanged(object sender, EventArgs e) { - OnPageUpdated(); - - if (SelectedHostNic == null) + if (_populatingNics || SelectedHostNic == null) return; checkBoxSriov.Visible = SelectedHostNic.IsSriovPhysicalPIF(); numericUpDownMTU.Maximum = Math.Min(SelectedHostNic.MTU, XenAPI.Network.MTU_MAX); - numericUpDownMTU.Enabled = numericUpDownMTU.Minimum != numericUpDownMTU.Maximum; - - infoMtuMessage.Text = numericUpDownMTU.Minimum == numericUpDownMTU.Maximum - ? string.Format(Messages.ALLOWED_MTU_VALUE, numericUpDownMTU.Minimum) - : string.Format(Messages.ALLOWED_MTU_RANGE, numericUpDownMTU.Minimum, numericUpDownMTU.Maximum); + ValidateMtuValue(); vlans = GetVLANList(SelectedHostNic); //CA-72484: check whether the currently selected VLAN is available and keep it - int curVlan = CurrentVLANValue; - if (!vlans.Contains(curVlan)) + if (!vlans.Contains(VLAN)) { - SetError(null); + ValidateVLANValue(); return; } - int avail_vlan = GetFirstAvailableVLAN(vlans); + //CA-19111: VLAN values should only go up to the numericUpDownVLAN.Maximum (4094) + for (int i = 1; i <= numericUpDownVLAN.Maximum; i++) + { + if (!vlans.Contains(i)) + { + numericUpDownVLAN.Value = i; + break; + } + } - if (avail_vlan == -1) - return; - - numericUpDownVLAN.Value = avail_vlan; + OnPageUpdated(); } - private void nudVLAN_ValueChanged(object sender, EventArgs e) + private void numericUpDownVLAN_Leave(object sender, EventArgs e) + { + if (numericUpDownVLAN.Text == "") + numericUpDownVLAN.Text = VLAN.ToString(); + } + + private void numericUpDownVLAN_TextChanged(object sender, EventArgs e) { ValidateVLANValue(); } - void numericUpDownVLAN_TextChanged(object sender, EventArgs e) + private void numericUpDownVLAN_ValueChanged(object sender, EventArgs e) { ValidateVLANValue(); } - private void SetError(string error) + private void numericUpDownMTU_Leave(object sender, EventArgs e) { - bool visible = !string.IsNullOrEmpty(error); - bool updatePage = labelVlanError.Visible != visible; - labelVlanError.Visible = visible; - if (visible) - labelVlanError.Text = error; - labelVLAN0Info.Visible = !visible && numericUpDownVLAN.Value == 0; - if (updatePage) - OnPageUpdated(); + if (numericUpDownMTU.Text == "") + numericUpDownMTU.Text = MTU.ToString(); } - private bool VLANValidNumber() + private void numericUpDownMTU_TextChanged(object sender, EventArgs e) { - int result; - return int.TryParse(numericUpDownVLAN.Text.Trim(), out result); + ValidateMtuValue(); } - private bool VLANNumberUnique() + private void numericUpDownMTU_ValueChanged(object sender, EventArgs e) { - if (vlans == null) - return true; - return !vlans.Contains(CurrentVLANValue); - } - - private void ValidateVLANValue() - { - if (!VLANValidNumber()) - { - SetError(Messages.INVALID_NUMBER); - return; - } - if (!VLANNumberUnique()) - { - SetError(Messages.NETW_DETAILS_VLAN_NUMBER_IN_USE); - return; - } - SetError(null); + ValidateMtuValue(); } private void checkBoxSriov_CheckedChanged(object sender, EventArgs e) { - vlans = GetVLANList(SelectedHostNic); + vlans = GetVLANList(SelectedHostNic); ValidateVLANValue(); } + + #endregion } } diff --git a/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWDetails.resx b/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWDetails.resx index 84a0b4649..27b5af945 100644 --- a/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWDetails.resx +++ b/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWDetails.resx @@ -117,141 +117,102 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Top, Bottom, Left, Right - 4 - - Left - - + True - - True - - - Fill - - - NoControl + + + Top - - 16, 0 + + 3, 0 - - 0, 0, 0, 0 + + 3, 0, 3, 25 - - 3, 2, 0, 0 + + 523, 26 - - 294, 15 - - + 0 - - MTU cannot be changed (the only valid value is already set) + + Your new network will be mapped to an existing physical network interface and assigned a VLAN number to use on that interface. You can select the physical interface you would like to use below. - - infoMtuMessage + + labelExternal - + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - infoMtuPanel - - - 0 - - - Left - - - NoControl - - - 0, 0 - - - 16, 15 - - - AutoSize - - - 0 - - - pictureBox2 - - - System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - infoMtuPanel - - - 1 - - - 164, 136 - - - 6, 0, 0, 2 - - - 310, 15 - - - 17 - - - infoMtuPanel - - - System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - + tableLayoutPanel1 - + 0 + + True + + + NoControl + + + 3, 51 + + + 3, 0, 3, 25 + + + 367, 13 + + + 1 + + + Select whether you would like to automatically add this network to new VMs. + + + MiddleLeft + + + labelInternal + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanel1 + + + 1 + + + Left + True - - Fill - NoControl - 0, 72 - - - 0, 0, 3, 0 + 3, 96 - 35, 27 + 28, 13 - 0 + 2 NI&C: - - MiddleLeft - labelNIC @@ -262,28 +223,46 @@ tableLayoutPanel1 - 1 + 2 + + + 47, 92 + + + 241, 21 + + + 3 + + + comboBoxNICList + + + System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanel1 + + + 3 + + + Left True - - Fill - NoControl - 0, 110 - - - 0, 11, 0, 7 + 3, 123 - 38, 18 + 38, 13 - 2 + 4 &VLAN: @@ -298,61 +277,16 @@ tableLayoutPanel1 - 2 - - - True - - - Fill - - - NoControl - - - 0, 0 - - - 0, 0, 0, 7 - - - 493, 65 - - - 0 - - - Your new external network will be mapped to an existing physical network interface and assigned a VLAN number for that interface. - - -Select the physical interface you would like to use: - - - MiddleLeft - - - lblNicHelp - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tableLayoutPanel1 - - - 3 + 4 - 41, 108 - - - 3, 9, 0, 7 + 47, 119 - 117, 20 + 114, 20 - 3 + 5 numericUpDownVLAN @@ -364,49 +298,115 @@ Select the physical interface you would like to use: tableLayoutPanel1 - 4 + 5 - - 41, 75 + + True - - 241, 21 + + GrowAndShrink - + + 2 + + + 3, 3 + + + 16, 16 + + + 0 + + + pictureBoxVlan + + + System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + infoVlanPanel + + + 0 + + + Left, Right + + + True + + + NoControl + + + 25, 4 + + + 331, 13 + + + 0 + + + labelVlanMessage + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + infoVlanPanel + + 1 - - comboBoxNICList + + Fill - - System.Windows.Forms.ComboBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 167, 119 - + + 1 + + + 359, 22 + + + 6 + + + infoVlanPanel + + + System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + tableLayoutPanel1 - - 5 + + 6 + + + <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="pictureBoxVlan" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="labelVlanMessage" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /></Controls><Columns Styles="AutoSize,0,Percent,100,Absolute,20" /><Rows Styles="Percent,100" /></TableLayoutSettings> + + + Left True - - Fill - NoControl - 0, 137 - - - 0, 2, 3, 0 + 3, 151 - 35, 18 + 34, 13 - 4 + 7 &MTU: @@ -421,19 +421,16 @@ Select the physical interface you would like to use: tableLayoutPanel1 - 6 + 7 - 41, 135 - - - 3, 0, 0, 0 + 47, 147 - 117, 20 + 114, 20 - 5 + 8 numericUpDownMTU @@ -445,127 +442,136 @@ Select the physical interface you would like to use: tableLayoutPanel1 - 7 + 8 - + + Left, Right + + True - - True + + GrowAndShrink - - Left + + 2 - - Microsoft Sans Serif, 8.25pt - - + NoControl - - 0, 0 + + 3, 3 - - 0, 0, 0, 0 + + 16, 16 - - 174, 13 + + AutoSize - - 6 - - - This VLAN number is already in use - - - MiddleLeft - - - False - - - labelVlanError - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - panelVLANInfo - - + 0 - + + pictureBoxMtu + + + System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + infoMtuPanel + + + 0 + + + Left, Right + + True - - Fill - - - Microsoft Sans Serif, 8.25pt - - + NoControl - - 0, 0 + + 25, 4 - - 0, 0, 0, 0 + + 331, 13 - - 252, 13 + + 0 - - 7 + + labelMtuMessage - - VLAN 0 will receive all traffic not on any other VLAN - - - MiddleLeft - - - False - - - labelVLAN0Info - - + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - panelVLANInfo + + infoMtuPanel - + 1 - - Fill + + 167, 147 - - 161, 112 + + 1 - - 3, 13, 0, 0 + + 359, 22 - - 332, 23 + + 9 - - 16 + + infoMtuPanel - - panelVLANInfo + + System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - + tableLayoutPanel1 - - 8 + + 9 + + + <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="pictureBoxMtu" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="labelMtuMessage" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /></Controls><Columns Styles="AutoSize,0,Percent,100" /><Rows Styles="AutoSize,0" /></TableLayoutSettings> + + + True + + + NoControl + + + 3, 192 + + + 3, 20, 3, 3 + + + 219, 17 + + + 10 + + + Create the VLAN on the &SR-IOV network + + + checkBoxSriov + + + System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanel1 + + + 10 True @@ -577,16 +583,16 @@ Select the physical interface you would like to use: NoControl - 4, 209 + 3, 232 - 4, 24, 0, 0 + 3, 20, 3, 3 283, 17 - 7 + 11 &Automatically add this network to new virtual machines @@ -604,40 +610,7 @@ Select the physical interface you would like to use: tableLayoutPanel1 - 9 - - - True - - - NoControl - - - 4, 165 - - - 4, 10, 3, 3 - - - 219, 17 - - - 6 - - - Create the VLAN on the &SR-IOV network - - - checkBoxSriov - - - System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tableLayoutPanel1 - - - 10 + 11 Fill @@ -646,10 +619,10 @@ Select the physical interface you would like to use: 0, 0 - 6 + 7 - 493, 276 + 529, 319 0 @@ -661,37 +634,13 @@ Select the physical interface you would like to use: System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - panel1 + $this 0 - <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="infoMtuPanel" Row="3" RowSpan="1" Column="2" ColumnSpan="2" /><Control Name="labelNIC" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="labelVLAN" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="lblNicHelp" Row="0" RowSpan="1" Column="0" ColumnSpan="4" /><Control Name="numericUpDownVLAN" Row="2" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="comboBoxNICList" Row="1" RowSpan="1" Column="1" ColumnSpan="2" /><Control Name="labelMTU" Row="3" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="numericUpDownMTU" Row="3" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="panelVLANInfo" Row="2" RowSpan="1" Column="2" ColumnSpan="2" /><Control Name="checkBoxAutomatic" Row="5" RowSpan="1" Column="0" ColumnSpan="4" /><Control Name="checkBoxSriov" Row="4" RowSpan="1" Column="0" ColumnSpan="4" /></Controls><Columns Styles="AutoSize,0,Absolute,120,Absolute,127,Percent,100" /><Rows Styles="AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,Percent,100,Absolute,20" /></TableLayoutSettings> - - - 0, 0 - - - 0, 0, 0, 0 - - - 493, 276 - - - 0 - - - panel1 - - - System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 0 + <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="labelExternal" Row="0" RowSpan="1" Column="0" ColumnSpan="4" /><Control Name="labelInternal" Row="1" RowSpan="1" Column="0" ColumnSpan="4" /><Control Name="labelNIC" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="comboBoxNICList" Row="2" RowSpan="1" Column="1" ColumnSpan="2" /><Control Name="labelVLAN" Row="3" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="numericUpDownVLAN" Row="3" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="infoVlanPanel" Row="3" RowSpan="1" Column="2" ColumnSpan="2" /><Control Name="labelMTU" Row="4" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="numericUpDownMTU" Row="4" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="infoMtuPanel" Row="4" RowSpan="1" Column="2" ColumnSpan="2" /><Control Name="checkBoxSriov" Row="5" RowSpan="1" Column="0" ColumnSpan="4" /><Control Name="checkBoxAutomatic" Row="6" RowSpan="1" Column="0" ColumnSpan="4" /></Controls><Columns Styles="AutoSize,0,Absolute,120,Absolute,127,Percent,100" /><Rows Styles="AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,Percent,100,Absolute,20" /></TableLayoutSettings> True @@ -703,7 +652,7 @@ Select the physical interface you would like to use: 0, 0, 0, 0 - 493, 276 + 529, 319 Interface diff --git a/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWName.Designer.cs b/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWName.Designer.cs index a2fe1eaaf..7939b7d81 100644 --- a/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWName.Designer.cs +++ b/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWName.Designer.cs @@ -29,71 +29,59 @@ namespace XenAdmin.Wizards.NewNetworkWizard_Pages private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(NetWName)); - this.panel1 = new System.Windows.Forms.Panel(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); - this.txtName = new System.Windows.Forms.TextBox(); - this.txtDescription = new System.Windows.Forms.TextBox(); - this.lblDescription = new System.Windows.Forms.Label(); - this.lblName = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); - this.panel1.SuspendLayout(); + this.lblName = new System.Windows.Forms.Label(); + this.txtName = new System.Windows.Forms.TextBox(); + this.lblDescription = new System.Windows.Forms.Label(); + this.txtDescription = new System.Windows.Forms.TextBox(); this.tableLayoutPanel1.SuspendLayout(); this.SuspendLayout(); // - // panel1 - // - resources.ApplyResources(this.panel1, "panel1"); - this.panel1.BackColor = System.Drawing.SystemColors.Control; - this.panel1.Controls.Add(this.tableLayoutPanel1); - this.panel1.Name = "panel1"; - // // tableLayoutPanel1 // resources.ApplyResources(this.tableLayoutPanel1, "tableLayoutPanel1"); - this.tableLayoutPanel1.Controls.Add(this.txtName, 1, 1); - this.tableLayoutPanel1.Controls.Add(this.txtDescription, 1, 3); - this.tableLayoutPanel1.Controls.Add(this.lblDescription, 0, 3); - this.tableLayoutPanel1.Controls.Add(this.lblName, 0, 1); this.tableLayoutPanel1.Controls.Add(this.label1, 0, 0); + this.tableLayoutPanel1.Controls.Add(this.lblName, 0, 1); + this.tableLayoutPanel1.Controls.Add(this.txtName, 1, 1); + this.tableLayoutPanel1.Controls.Add(this.lblDescription, 0, 3); + this.tableLayoutPanel1.Controls.Add(this.txtDescription, 1, 3); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; // - // txtName + // label1 // - this.tableLayoutPanel1.SetColumnSpan(this.txtName, 2); - resources.ApplyResources(this.txtName, "txtName"); - this.txtName.Name = "txtName"; - this.txtName.TextChanged += new System.EventHandler(this.txtName_TextChanged); - // - // txtDescription - // - this.tableLayoutPanel1.SetColumnSpan(this.txtDescription, 2); - resources.ApplyResources(this.txtDescription, "txtDescription"); - this.txtDescription.Name = "txtDescription"; - // - // lblDescription - // - resources.ApplyResources(this.lblDescription, "lblDescription"); - this.lblDescription.Name = "lblDescription"; + resources.ApplyResources(this.label1, "label1"); + this.tableLayoutPanel1.SetColumnSpan(this.label1, 3); + this.label1.Name = "label1"; // // lblName // resources.ApplyResources(this.lblName, "lblName"); this.lblName.Name = "lblName"; // - // label1 + // txtName // - resources.ApplyResources(this.label1, "label1"); - this.tableLayoutPanel1.SetColumnSpan(this.label1, 4); - this.label1.Name = "label1"; + resources.ApplyResources(this.txtName, "txtName"); + this.txtName.Name = "txtName"; + this.txtName.TextChanged += new System.EventHandler(this.txtName_TextChanged); + // + // lblDescription + // + resources.ApplyResources(this.lblDescription, "lblDescription"); + this.lblDescription.Name = "lblDescription"; + // + // txtDescription + // + resources.ApplyResources(this.txtDescription, "txtDescription"); + this.txtDescription.Name = "txtDescription"; // // NetWName // resources.ApplyResources(this, "$this"); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; this.BackColor = System.Drawing.SystemColors.Control; - this.Controls.Add(this.panel1); + this.Controls.Add(this.tableLayoutPanel1); this.Name = "NetWName"; - this.panel1.ResumeLayout(false); this.tableLayoutPanel1.ResumeLayout(false); this.tableLayoutPanel1.PerformLayout(); this.ResumeLayout(false); @@ -101,8 +89,6 @@ namespace XenAdmin.Wizards.NewNetworkWizard_Pages } #endregion - - private System.Windows.Forms.Panel panel1; private System.Windows.Forms.Label lblName; private System.Windows.Forms.TextBox txtName; private System.Windows.Forms.Label lblDescription; diff --git a/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWName.cs b/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWName.cs index 2e1c8c3d1..403ab0474 100644 --- a/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWName.cs +++ b/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWName.cs @@ -31,11 +31,6 @@ using System; using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Data; -using System.Text; -using System.Windows.Forms; using XenAdmin.Controls; using XenAdmin.Core; using XenAdmin.Network; @@ -50,9 +45,9 @@ namespace XenAdmin.Wizards.NewNetworkWizard_Pages InitializeComponent(); } - public override string Text { get { return Messages.NETW_NAME_TEXT; } } + public override string Text => Messages.NETW_NAME_TEXT; - public override string PageTitle { get { return Messages.NETW_NAME_TITLE; } } + public override string PageTitle => Messages.NETW_NAME_TITLE; public override bool EnableNext() { @@ -61,7 +56,7 @@ namespace XenAdmin.Wizards.NewNetworkWizard_Pages protected override void PageLoadedCore(PageLoadedDirection direction) { - HelpersGUI.FocusFirstControl(Controls); + txtName.Focus(); } protected override void PageLeaveCore(PageLoadedDirection direction, ref bool cancel) @@ -77,21 +72,9 @@ namespace XenAdmin.Wizards.NewNetworkWizard_Pages public NetworkTypes SelectedNetworkType { private get; set; } - public string NetworkName - { - get - { - return this.txtName.Text; - } - } + public string NetworkName => txtName.Text; - public string NetworkDescription - { - get - { - return this.txtDescription.Text; - } - } + public string NetworkDescription => txtDescription.Text; private string GetNetworkName(NetworkTypes network_type) { diff --git a/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWName.resx b/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWName.resx index 96acbabfb..213c8185f 100644 --- a/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWName.resx +++ b/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWName.resx @@ -112,127 +112,61 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Top, Bottom, Left, Right - - + - 4 - - - Fill - - - - 66, 43 - - - 0, 0, 0, 0 - - - 294, 20 - - 3 - - New Network (1) - - - txtName - - - System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tableLayoutPanel1 - - - 0 - - - Fill - - - 66, 68 - - - 0, 0, 0, 0 - - - 294, 20 - - - 5 - - - txtDescription - - - System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tableLayoutPanel1 - - - 1 - - + True - + + Fill - - 0, 68 + + + 3, 0 - - 0, 0, 3, 0 + + 3, 0, 3, 30 - - 63, 20 + + 394, 13 - - 4 + + 1 - - &Description: + + Provide a name and optional description for the new network. - - MiddleLeft + + label1 - - lblDescription + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - + tableLayoutPanel1 - - 2 + + 0 + + + Left True - - Fill - - 0, 43 - - - 0, 0, 0, 0 + 3, 49 - 66, 20 + 38, 13 2 @@ -247,48 +181,96 @@ lblName - System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 tableLayoutPanel1 - 3 + 1 - - True - - + Fill - - 0, 0 + + 72, 46 - - 0, 0, 0, 0 + + 285, 20 - - 0, 0, 0, 30 + + 3 - - 400, 43 + + New Network (1) - - 6 + + txtName - - Provide a name and optional description for the new network. + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - label1 - - - System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - + tableLayoutPanel1 - + + 2 + + + Left + + + True + + + 3, 80 + + + 63, 13 + + + 4 + + + &Description: + + + MiddleLeft + + + lblDescription + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanel1 + + + 3 + + + Fill + + + 72, 77 + + + 285, 20 + + + 5 + + + txtDescription + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanel1 + + 4 @@ -307,48 +289,24 @@ 400, 300 - 3 + 0 tableLayoutPanel1 - System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - panel1 + $this 0 - <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="txtName" Row="1" RowSpan="1" Column="1" ColumnSpan="2" /><Control Name="txtDescription" Row="3" RowSpan="1" Column="1" ColumnSpan="2" /><Control Name="lblDescription" Row="3" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="lblName" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="label1" Row="0" RowSpan="1" Column="0" ColumnSpan="4" /></Controls><Columns Styles="AutoSize,0,Percent,100,Absolute,40,Absolute,40" /><Rows Styles="AutoSize,0,AutoSize,0,Absolute,5,AutoSize,0,Percent,100" /></TableLayoutSettings> + <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="label1" Row="0" RowSpan="1" Column="0" ColumnSpan="3" /><Control Name="lblName" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="txtName" Row="1" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="lblDescription" Row="3" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="txtDescription" Row="3" RowSpan="1" Column="1" ColumnSpan="1" /></Controls><Columns Styles="AutoSize,0,Percent,100,Absolute,40,Absolute,20" /><Rows Styles="AutoSize,0,AutoSize,0,Absolute,5,AutoSize,0,Percent,100" /></TableLayoutSettings> - - 0, 0 - - - 0, 0, 0, 0 - - - 400, 300 - - - 0 - - - panel1 - - - System.Windows.Forms.Panel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - $this - - - 0 - - + True diff --git a/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWSriovDetails.cs b/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWSriovDetails.cs index 2cf44252a..538f43afc 100644 --- a/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWSriovDetails.cs +++ b/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWSriovDetails.cs @@ -100,15 +100,9 @@ namespace XenAdmin.Wizards.NewNetworkWizard_Pages OnPageUpdated(); } - public PIF SelectedHostNic - { - get { return (PIF)comboBoxNicList.SelectedItem; } - } + public PIF SelectedHostNic => (PIF)comboBoxNicList.SelectedItem; - public bool isAutomaticAddNicToVM - { - get { return cbxAutomatic.Checked; } - } + public bool AddNicToVmsAutomatically => cbxAutomatic.Checked; private void comboBoxNicList_SelectedIndexChanged(object sender, EventArgs e) { diff --git a/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWSriovDetails.resx b/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWSriovDetails.resx index dbd9f554e..ce5540463 100644 --- a/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWSriovDetails.resx +++ b/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWSriovDetails.resx @@ -139,7 +139,7 @@ 286, 17 - 5 + 3 &Automatically add this network to new virtual machines. diff --git a/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWTypeSelect.Designer.cs b/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWTypeSelect.Designer.cs index 1a699ab5c..8b456695f 100644 --- a/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWTypeSelect.Designer.cs +++ b/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWTypeSelect.Designer.cs @@ -31,7 +31,6 @@ namespace XenAdmin.Wizards.NewNetworkWizard_Pages this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(NetWTypeSelect)); this.toolTip = new System.Windows.Forms.ToolTip(this.components); - this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); this.lblNetTypeSel = new System.Windows.Forms.Label(); this.rbtnExternalNetwork = new System.Windows.Forms.RadioButton(); this.labelExternalNetwork = new System.Windows.Forms.Label(); @@ -43,50 +42,35 @@ namespace XenAdmin.Wizards.NewNetworkWizard_Pages this.labelCHIN = new System.Windows.Forms.Label(); this.rbtnSriov = new System.Windows.Forms.RadioButton(); this.labelSriov = new System.Windows.Forms.Label(); - this.warningsTable = new System.Windows.Forms.TableLayoutPanel(); - this.iconWarningChinOption = new System.Windows.Forms.PictureBox(); + this.warningTableChin = new System.Windows.Forms.TableLayoutPanel(); this.labelWarningChinOption = new System.Windows.Forms.Label(); + this.iconWarningChinOption = new System.Windows.Forms.PictureBox(); this.warningTableSriov = new System.Windows.Forms.TableLayoutPanel(); - this.iconWarningSriovOption = new System.Windows.Forms.PictureBox(); this.labelWarningSriovOption = new System.Windows.Forms.Label(); - this.flowLayoutPanel1.SuspendLayout(); - this.warningsTable.SuspendLayout(); + this.iconWarningSriovOption = new System.Windows.Forms.PictureBox(); + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.warningTableChin.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.iconWarningChinOption)).BeginInit(); this.warningTableSriov.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.iconWarningSriovOption)).BeginInit(); + this.tableLayoutPanel1.SuspendLayout(); this.SuspendLayout(); // // toolTip // this.toolTip.ShowAlways = true; // - // flowLayoutPanel1 - // - resources.ApplyResources(this.flowLayoutPanel1, "flowLayoutPanel1"); - this.flowLayoutPanel1.Controls.Add(this.lblNetTypeSel); - this.flowLayoutPanel1.Controls.Add(this.rbtnExternalNetwork); - this.flowLayoutPanel1.Controls.Add(this.labelExternalNetwork); - this.flowLayoutPanel1.Controls.Add(this.rbtnInternalNetwork); - this.flowLayoutPanel1.Controls.Add(this.label1); - this.flowLayoutPanel1.Controls.Add(this.rbtnBondedNetwork); - this.flowLayoutPanel1.Controls.Add(this.label3); - this.flowLayoutPanel1.Controls.Add(this.rbtnCHIN); - this.flowLayoutPanel1.Controls.Add(this.labelCHIN); - this.flowLayoutPanel1.Controls.Add(this.rbtnSriov); - this.flowLayoutPanel1.Controls.Add(this.labelSriov); - this.flowLayoutPanel1.Controls.Add(this.warningsTable); - this.flowLayoutPanel1.Controls.Add(this.warningTableSriov); - this.flowLayoutPanel1.Name = "flowLayoutPanel1"; - // // lblNetTypeSel // resources.ApplyResources(this.lblNetTypeSel, "lblNetTypeSel"); + this.tableLayoutPanel1.SetColumnSpan(this.lblNetTypeSel, 2); this.lblNetTypeSel.Name = "lblNetTypeSel"; // // rbtnExternalNetwork // resources.ApplyResources(this.rbtnExternalNetwork, "rbtnExternalNetwork"); this.rbtnExternalNetwork.Checked = true; + this.tableLayoutPanel1.SetColumnSpan(this.rbtnExternalNetwork, 2); this.rbtnExternalNetwork.Name = "rbtnExternalNetwork"; this.rbtnExternalNetwork.TabStop = true; this.rbtnExternalNetwork.UseVisualStyleBackColor = true; @@ -99,6 +83,7 @@ namespace XenAdmin.Wizards.NewNetworkWizard_Pages // rbtnInternalNetwork // resources.ApplyResources(this.rbtnInternalNetwork, "rbtnInternalNetwork"); + this.tableLayoutPanel1.SetColumnSpan(this.rbtnInternalNetwork, 2); this.rbtnInternalNetwork.Name = "rbtnInternalNetwork"; this.rbtnInternalNetwork.UseVisualStyleBackColor = true; // @@ -110,6 +95,7 @@ namespace XenAdmin.Wizards.NewNetworkWizard_Pages // rbtnBondedNetwork // resources.ApplyResources(this.rbtnBondedNetwork, "rbtnBondedNetwork"); + this.tableLayoutPanel1.SetColumnSpan(this.rbtnBondedNetwork, 2); this.rbtnBondedNetwork.Name = "rbtnBondedNetwork"; this.rbtnBondedNetwork.UseVisualStyleBackColor = true; // @@ -121,6 +107,7 @@ namespace XenAdmin.Wizards.NewNetworkWizard_Pages // rbtnCHIN // resources.ApplyResources(this.rbtnCHIN, "rbtnCHIN"); + this.tableLayoutPanel1.SetColumnSpan(this.rbtnCHIN, 2); this.rbtnCHIN.Name = "rbtnCHIN"; this.rbtnCHIN.UseVisualStyleBackColor = true; // @@ -132,6 +119,7 @@ namespace XenAdmin.Wizards.NewNetworkWizard_Pages // rbtnSriov // resources.ApplyResources(this.rbtnSriov, "rbtnSriov"); + this.tableLayoutPanel1.SetColumnSpan(this.rbtnSriov, 2); this.rbtnSriov.Name = "rbtnSriov"; this.rbtnSriov.UseVisualStyleBackColor = true; // @@ -140,12 +128,17 @@ namespace XenAdmin.Wizards.NewNetworkWizard_Pages resources.ApplyResources(this.labelSriov, "labelSriov"); this.labelSriov.Name = "labelSriov"; // - // warningsTable + // warningTableChin // - resources.ApplyResources(this.warningsTable, "warningsTable"); - this.warningsTable.Controls.Add(this.iconWarningChinOption, 0, 1); - this.warningsTable.Controls.Add(this.labelWarningChinOption, 1, 1); - this.warningsTable.Name = "warningsTable"; + resources.ApplyResources(this.warningTableChin, "warningTableChin"); + this.warningTableChin.Controls.Add(this.labelWarningChinOption, 1, 0); + this.warningTableChin.Controls.Add(this.iconWarningChinOption, 0, 0); + this.warningTableChin.Name = "warningTableChin"; + // + // labelWarningChinOption + // + resources.ApplyResources(this.labelWarningChinOption, "labelWarningChinOption"); + this.labelWarningChinOption.Name = "labelWarningChinOption"; // // iconWarningChinOption // @@ -154,18 +147,18 @@ namespace XenAdmin.Wizards.NewNetworkWizard_Pages this.iconWarningChinOption.Name = "iconWarningChinOption"; this.iconWarningChinOption.TabStop = false; // - // labelWarningChinOption - // - resources.ApplyResources(this.labelWarningChinOption, "labelWarningChinOption"); - this.labelWarningChinOption.Name = "labelWarningChinOption"; - // // warningTableSriov // resources.ApplyResources(this.warningTableSriov, "warningTableSriov"); - this.warningTableSriov.Controls.Add(this.iconWarningSriovOption, 0, 1); - this.warningTableSriov.Controls.Add(this.labelWarningSriovOption, 1, 1); + this.warningTableSriov.Controls.Add(this.labelWarningSriovOption, 1, 0); + this.warningTableSriov.Controls.Add(this.iconWarningSriovOption, 0, 0); this.warningTableSriov.Name = "warningTableSriov"; // + // labelWarningSriovOption + // + resources.ApplyResources(this.labelWarningSriovOption, "labelWarningSriovOption"); + this.labelWarningSriovOption.Name = "labelWarningSriovOption"; + // // iconWarningSriovOption // resources.ApplyResources(this.iconWarningSriovOption, "iconWarningSriovOption"); @@ -173,27 +166,39 @@ namespace XenAdmin.Wizards.NewNetworkWizard_Pages this.iconWarningSriovOption.Name = "iconWarningSriovOption"; this.iconWarningSriovOption.TabStop = false; // - // labelWarningSriovOption + // tableLayoutPanel1 // - resources.ApplyResources(this.labelWarningSriovOption, "labelWarningSriovOption"); - this.labelWarningSriovOption.Name = "labelWarningSriovOption"; + resources.ApplyResources(this.tableLayoutPanel1, "tableLayoutPanel1"); + this.tableLayoutPanel1.Controls.Add(this.lblNetTypeSel, 0, 0); + this.tableLayoutPanel1.Controls.Add(this.rbtnExternalNetwork, 0, 1); + this.tableLayoutPanel1.Controls.Add(this.labelExternalNetwork, 1, 2); + this.tableLayoutPanel1.Controls.Add(this.rbtnInternalNetwork, 0, 3); + this.tableLayoutPanel1.Controls.Add(this.label1, 1, 4); + this.tableLayoutPanel1.Controls.Add(this.rbtnBondedNetwork, 0, 5); + this.tableLayoutPanel1.Controls.Add(this.label3, 1, 6); + this.tableLayoutPanel1.Controls.Add(this.rbtnCHIN, 0, 7); + this.tableLayoutPanel1.Controls.Add(this.labelCHIN, 1, 8); + this.tableLayoutPanel1.Controls.Add(this.warningTableChin, 1, 9); + this.tableLayoutPanel1.Controls.Add(this.rbtnSriov, 0, 10); + this.tableLayoutPanel1.Controls.Add(this.labelSriov, 1, 11); + this.tableLayoutPanel1.Controls.Add(this.warningTableSriov, 1, 12); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; // // NetWTypeSelect // resources.ApplyResources(this, "$this"); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; - this.Controls.Add(this.flowLayoutPanel1); + this.Controls.Add(this.tableLayoutPanel1); this.Name = "NetWTypeSelect"; - this.flowLayoutPanel1.ResumeLayout(false); - this.flowLayoutPanel1.PerformLayout(); - this.warningsTable.ResumeLayout(false); - this.warningsTable.PerformLayout(); + this.warningTableChin.ResumeLayout(false); + this.warningTableChin.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.iconWarningChinOption)).EndInit(); this.warningTableSriov.ResumeLayout(false); this.warningTableSriov.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.iconWarningSriovOption)).EndInit(); + this.tableLayoutPanel1.ResumeLayout(false); + this.tableLayoutPanel1.PerformLayout(); this.ResumeLayout(false); - this.PerformLayout(); } @@ -208,15 +213,15 @@ namespace XenAdmin.Wizards.NewNetworkWizard_Pages private System.Windows.Forms.Label label3; private System.Windows.Forms.Label labelCHIN; private System.Windows.Forms.RadioButton rbtnCHIN; - private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; private System.Windows.Forms.ToolTip toolTip; - private System.Windows.Forms.TableLayoutPanel warningsTable; - private System.Windows.Forms.PictureBox iconWarningChinOption; - private System.Windows.Forms.Label labelWarningChinOption; + private System.Windows.Forms.TableLayoutPanel warningTableChin; private System.Windows.Forms.RadioButton rbtnSriov; private System.Windows.Forms.Label labelSriov; private System.Windows.Forms.TableLayoutPanel warningTableSriov; private System.Windows.Forms.PictureBox iconWarningSriovOption; private System.Windows.Forms.Label labelWarningSriovOption; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; + private System.Windows.Forms.Label labelWarningChinOption; + private System.Windows.Forms.PictureBox iconWarningChinOption; } } diff --git a/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWTypeSelect.cs b/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWTypeSelect.cs index 1ba20d2ab..8b5dc1be9 100644 --- a/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWTypeSelect.cs +++ b/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWTypeSelect.cs @@ -32,12 +32,10 @@ using System; using System.Linq; using XenAdmin.Core; -using XenAdmin.Network; using XenAPI; using XenAdmin.Controls; - namespace XenAdmin.Wizards.NewNetworkWizard_Pages { public partial class NetWTypeSelect : XenTabPage @@ -45,91 +43,84 @@ namespace XenAdmin.Wizards.NewNetworkWizard_Pages public NetWTypeSelect() { InitializeComponent(); - this.rbtnExternalNetwork.Checked = true; + rbtnExternalNetwork.Checked = true; } - public override string Text { get { return Messages.NETW_TYPE_SELECT_TEXT; } } + public override string Text => Messages.NETW_TYPE_SELECT_TEXT; + + public override string PageTitle => Messages.NETW_TYPE_SELECT_TITLE; + + public NetworkTypes SelectedNetworkType => + rbtnBondedNetwork.Checked + ? NetworkTypes.Bonded + : rbtnExternalNetwork.Checked + ? NetworkTypes.External + : rbtnCHIN.Checked + ? NetworkTypes.CHIN + : rbtnSriov.Checked + ? NetworkTypes.SRIOV + : NetworkTypes.Internal; - public override string PageTitle { get { return Messages.NETW_TYPE_SELECT_TITLE; } } public override void PopulatePage() { - Update(Connection); - } - - public NetworkTypes SelectedNetworkType - { - get - { - return rbtnBondedNetwork.Checked - ? NetworkTypes.Bonded - : rbtnExternalNetwork.Checked - ? NetworkTypes.External - : rbtnCHIN.Checked - ? NetworkTypes.CHIN - : rbtnSriov.Checked - ? NetworkTypes.SRIOV - : NetworkTypes.Internal; - } - } - - private void Update(IXenConnection connection) - { - Host master = Helpers.GetMaster(connection); - if (master == null) + Pool pool = Helpers.GetPoolOfOne(Connection); + if (pool == null) return; - Pool pool = Helpers.GetPoolOfOne(connection); - labelCHIN.Visible = rbtnCHIN.Visible = !HiddenFeatures.CrossServerPrivateNetworkHidden; - if (!pool.vSwitchController()) + if (HiddenFeatures.CrossServerPrivateNetworkHidden || Helpers.StockholmOrGreater(Connection)) { - rbtnCHIN.Checked = false; + rbtnCHIN.Visible = labelCHIN.Visible = false; + warningTableChin.Visible = false; + } + else if (!pool.vSwitchController()) + { + rbtnCHIN.Visible = labelCHIN.Visible = true; rbtnCHIN.Enabled = labelCHIN.Enabled = false; - labelWarningChinOption.Text = - Helpers.FeatureForbidden(connection, Host.RestrictVSwitchController) ? - String.Format(Messages.FEATURE_DISABLED, Messages.CHIN) : - Messages.CHINS_NEED_VSWITCHCONTROLLER; + labelWarningChinOption.Text = Helpers.FeatureForbidden(Connection, Host.RestrictVSwitchController) + ? string.Format(Messages.FEATURE_DISABLED, Messages.CHIN) + : Messages.CHINS_NEED_VSWITCHCONTROLLER; - iconWarningChinOption.Visible = labelWarningChinOption.Visible = !HiddenFeatures.CrossServerPrivateNetworkHidden; - - rbtnExternalNetwork.Checked = true; + warningTableChin.Visible = true; } else { + rbtnCHIN.Visible = labelCHIN.Visible = true; rbtnCHIN.Enabled = labelCHIN.Enabled = true; - iconWarningChinOption.Visible = labelWarningChinOption.Visible = false; + warningTableChin.Visible = false; } bool hasNicCanEnableSriov = pool.Connection.Cache.PIFs.Any(pif => pif.IsPhysical() && pif.SriovCapable() && !pif.IsSriovPhysicalPIF()); - bool sriovFeatureForbidden = Helpers.FeatureForbidden(connection, Host.RestrictSriovNetwork); + bool sriovFeatureForbidden = Helpers.FeatureForbidden(Connection, Host.RestrictSriovNetwork); if (!Helpers.KolkataOrGreater(pool.Connection)) { - iconWarningSriovOption.Visible = labelWarningSriovOption.Visible = false; rbtnSriov.Visible = labelSriov.Visible = false; + warningTableSriov.Visible = false; } else if (Helpers.FeatureForbidden(pool.Connection, Host.SriovNetworkDisabled) || - sriovFeatureForbidden || !pool.HasSriovNic() || !hasNicCanEnableSriov) + sriovFeatureForbidden || !pool.HasSriovNic() || !hasNicCanEnableSriov) { - rbtnSriov.Checked = false; + rbtnSriov.Visible = labelSriov.Visible = true; rbtnSriov.Enabled = labelSriov.Enabled = false; labelWarningSriovOption.Text = Helpers.FeatureForbidden(pool.Connection, Host.SriovNetworkDisabled) - ? String.Format(Messages.FEATURE_EXPERIMENTAL, Messages.NETWORK_SRIOV) + ? string.Format(Messages.FEATURE_EXPERIMENTAL, Messages.NETWORK_SRIOV) : sriovFeatureForbidden - ? String.Format(Messages.FEATURE_DISABLED, Messages.NETWORK_SRIOV) + ? string.Format(Messages.FEATURE_DISABLED, Messages.NETWORK_SRIOV) : pool.HasSriovNic() ? Messages.NICS_ARE_SRIOV_ENABLED : Messages.SRIOV_NEED_NICSUPPORT; - iconWarningSriovOption.Visible = labelWarningSriovOption.Visible = true; + warningTableSriov.Visible = true; } else { - rbtnSriov.Enabled = labelCHIN.Enabled = true; - iconWarningSriovOption.Visible = labelWarningSriovOption.Visible = false; + rbtnSriov.Visible = labelSriov.Visible = true; + rbtnSriov.Enabled = labelSriov.Enabled = true; + warningTableSriov.Visible = false; } } } diff --git a/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWTypeSelect.resx b/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWTypeSelect.resx index 76f5270f2..dbca0af47 100644 --- a/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWTypeSelect.resx +++ b/XenAdmin/Wizards/NewNetworkWizard_Pages/NetWTypeSelect.resx @@ -121,61 +121,28 @@ 17, 17 - - True - True - - - NoControl - - - - 3, 3 - - - 3, 3, 3, 3 - - - 279, 13 - - - 0 - - - Select the type of new network you would like to create: - - - MiddleLeft - - - lblNetTypeSel - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - flowLayoutPanel1 - - - 0 + + 2 True + Tahoma, 8.25pt, style=Bold + NoControl - 20, 29 + 3, 23 - 20, 10, 3, 3 + 3, 10, 3, 3 122, 17 @@ -193,28 +160,25 @@ System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - flowLayoutPanel1 + tableLayoutPanel1 1 - - Top, Left, Right - True + + Fill + NoControl - 46, 49 - - - 46, 0, 3, 3 + 18, 43 - 359, 13 + 409, 13 2 @@ -229,7 +193,7 @@ System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - flowLayoutPanel1 + tableLayoutPanel1 2 @@ -244,10 +208,10 @@ NoControl - 20, 71 + 3, 66 - 20, 6, 3, 3 + 3, 10, 3, 3 196, 17 @@ -265,7 +229,7 @@ System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - flowLayoutPanel1 + tableLayoutPanel1 3 @@ -273,17 +237,17 @@ True + + Fill + NoControl - 46, 91 - - - 46, 0, 3, 3 + 18, 86 - 359, 26 + 409, 26 4 @@ -299,7 +263,7 @@ This can be used as a private connection between VMs on the same host. System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - flowLayoutPanel1 + tableLayoutPanel1 4 @@ -314,10 +278,10 @@ This can be used as a private connection between VMs on the same host. NoControl - 20, 126 + 3, 122 - 20, 6, 3, 3 + 3, 10, 3, 3 117, 17 @@ -335,7 +299,7 @@ This can be used as a private connection between VMs on the same host. System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - flowLayoutPanel1 + tableLayoutPanel1 5 @@ -343,17 +307,17 @@ This can be used as a private connection between VMs on the same host. True + + Fill + NoControl - 46, 146 - - - 46, 0, 3, 3 + 18, 142 - 320, 26 + 409, 26 6 @@ -369,7 +333,7 @@ This will create a single higher performing channel. System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - flowLayoutPanel1 + tableLayoutPanel1 6 @@ -384,10 +348,10 @@ This will create a single higher performing channel. NoControl - 20, 181 + 3, 178 - 20, 6, 3, 3 + 3, 10, 3, 3 193, 17 @@ -405,28 +369,25 @@ This will create a single higher performing channel. System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - flowLayoutPanel1 + tableLayoutPanel1 7 - - Top, Left, Right - True + + Fill + NoControl - 46, 201 - - - 46, 0, 3, 3 + 18, 198 - 359, 39 + 409, 39 8 @@ -443,92 +404,50 @@ This type of network requires the vSwitch Controller to be running. System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - flowLayoutPanel1 + tableLayoutPanel1 8 - + True - - Tahoma, 8.25pt, style=Bold - - - NoControl - - - 20, 249 - - - 20, 6, 3, 3 - - - 115, 17 - - - 9 - - - S&R-IOV Network - - - rbtnSriov - - - System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - flowLayoutPanel1 - - - 9 - - - Top, Left, Right - - - True - - - NoControl - - - 46, 269 - - - 46, 0, 3, 3 - - - 359, 13 - - - 10 - - - Enable SR-IOV on a NIC and create an SR-IOV network on that NIC. - - - labelSriov - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - flowLayoutPanel1 - - - 10 - - - True - - + 2 - + Left + + True + + + NoControl + + + 25, 4 + + + 45, 13 + + + 0 + + + warning + + + labelWarningChinOption + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + warningTableChin + + + 0 + @@ -557,86 +476,146 @@ This type of network requires the vSwitch Controller to be running. System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - warningsTable + warningTableChin - 0 - - - Left - - - True - - - NoControl - - - 25, 4 - - - 3, 3, 3, 3 - - - 45, 13 - - - 0 - - - warning - - - labelWarningChinOption - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - warningsTable - - 1 - - 3, 291 + + Fill - - 3, 6, 3, 1 + + 18, 240 - - 2 + + 1 - - 73, 22 + + 409, 22 - - 11 + + 9 - - warningsTable + + warningTableChin - + System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - flowLayoutPanel1 + + tableLayoutPanel1 - + + 9 + + + <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="labelWarningChinOption" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="iconWarningChinOption" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /></Controls><Columns Styles="AutoSize,0,Percent,100" /><Rows Styles="AutoSize,0" /></TableLayoutSettings> + + + True + + + Tahoma, 8.25pt, style=Bold + + + NoControl + + + 3, 275 + + + 3, 10, 3, 3 + + + 115, 17 + + + 10 + + + S&R-IOV Network + + + rbtnSriov + + + System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanel1 + + + 10 + + + True + + + Fill + + + NoControl + + + 18, 295 + + + 409, 13 + + 11 - - <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="iconWarningChinOption" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="labelWarningChinOption" Row="1" RowSpan="1" Column="1" ColumnSpan="1" /></Controls><Columns Styles="AutoSize,0,Percent,100" /><Rows Styles="AutoSize,0,AutoSize,0,Absolute,20" /></TableLayoutSettings> + + Enable SR-IOV on a NIC and create an SR-IOV network on that NIC. - - True + + labelSriov + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanel1 + + + 11 2 - + Left + + True + + + NoControl + + + 25, 4 + + + 45, 13 + + + 0 + + + warning + + + labelWarningSriovOption + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + warningTableSriov + + + 0 + @@ -668,55 +647,19 @@ This type of network requires the vSwitch Controller to be running. warningTableSriov - 0 - - - Left - - - True - - - NoControl - - - 25, 4 - - - 3, 3, 3, 3 - - - 45, 13 - - - 0 - - - warning - - - labelWarningSriovOption - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - warningTableSriov - - 1 - - 3, 314 + + Top - - 3, 0, 3, 12 + + 18, 311 - 2 + 1 - 73, 22 + 409, 22 12 @@ -728,36 +671,72 @@ This type of network requires the vSwitch Controller to be running. System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - flowLayoutPanel1 + tableLayoutPanel1 12 - <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="iconWarningSriovOption" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="labelWarningSriovOption" Row="1" RowSpan="1" Column="1" ColumnSpan="1" /></Controls><Columns Styles="AutoSize,0,Percent,100" /><Rows Styles="AutoSize,0,AutoSize,0" /></TableLayoutSettings> + <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="labelWarningSriovOption" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="iconWarningSriovOption" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /></Controls><Columns Styles="AutoSize,0,Percent,100" /><Rows Styles="AutoSize,0,Absolute,20" /></TableLayoutSettings> - - TopDown + + Fill - + 0, 0 - - 504, 395 + + 13 - - 9 + + 430, 360 - - flowLayoutPanel1 + + 0 - - System.Windows.Forms.FlowLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + tableLayoutPanel1 - + + System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + $this - + + 0 + + + <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="lblNetTypeSel" Row="0" RowSpan="1" Column="0" ColumnSpan="2" /><Control Name="rbtnExternalNetwork" Row="1" RowSpan="1" Column="0" ColumnSpan="2" /><Control Name="labelExternalNetwork" Row="2" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="rbtnInternalNetwork" Row="3" RowSpan="1" Column="0" ColumnSpan="2" /><Control Name="label1" Row="4" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="rbtnBondedNetwork" Row="5" RowSpan="1" Column="0" ColumnSpan="2" /><Control Name="label3" Row="6" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="rbtnCHIN" Row="7" RowSpan="1" Column="0" ColumnSpan="2" /><Control Name="labelCHIN" Row="8" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="warningTableChin" Row="9" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="rbtnSriov" Row="10" RowSpan="1" Column="0" ColumnSpan="2" /><Control Name="labelSriov" Row="11" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="warningTableSriov" Row="12" RowSpan="1" Column="1" ColumnSpan="1" /></Controls><Columns Styles="Absolute,15,Percent,100" /><Rows Styles="AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0" /></TableLayoutSettings> + + + NoControl + + + 3, 0 + + + 279, 13 + + + 0 + + + Select the type of new network you would like to create: + + + MiddleLeft + + + lblNetTypeSel + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanel1 + + 0 @@ -769,11 +748,8 @@ This type of network requires the vSwitch Controller to be running. Tahoma, 8.25pt - - 0, 32, 0, 0 - - 430, 358 + 430, 360 Select Type diff --git a/XenAdmin/Wizards/NewSRWizard_Pages/Frontends/LVMoHBA.cs b/XenAdmin/Wizards/NewSRWizard_Pages/Frontends/LVMoHBA.cs index 9fc725bd9..dcb33fcbd 100644 --- a/XenAdmin/Wizards/NewSRWizard_Pages/Frontends/LVMoHBA.cs +++ b/XenAdmin/Wizards/NewSRWizard_Pages/Frontends/LVMoHBA.cs @@ -216,7 +216,7 @@ namespace XenAdmin.Wizards.NewSRWizard_Pages.Frontends private bool RunProbe(Host master, FibreChannelDescriptor srDescriptor, out List srs) { - srs = null; + srs = new List(); var action = new SrProbeAction(Connection, master, srDescriptor.SrType, srDescriptor.DeviceConfig); using (var dlg = new ActionProgressDialog(action, ProgressBarStyle.Marquee)) @@ -234,6 +234,12 @@ namespace XenAdmin.Wizards.NewSRWizard_Pages.Frontends return false; } } + + //CA-335356 special treatment of case where gfs2 cannot see the same devices as lvmohba + if (srDescriptor.SrType == SR.SRTypes.gfs2 && action.Exception is Failure f && f.ErrorDescription.Count > 1 && + f.ErrorDescription[0].StartsWith("SR_BACKEND_FAILURE") && f.ErrorDescription[1] == "DeviceNotFoundException") + return true; + return false; } diff --git a/XenAdmin/Wizards/NewSRWizard_Pages/Frontends/LVMoISCSI.cs b/XenAdmin/Wizards/NewSRWizard_Pages/Frontends/LVMoISCSI.cs index cef0ce681..3b089297b 100644 --- a/XenAdmin/Wizards/NewSRWizard_Pages/Frontends/LVMoISCSI.cs +++ b/XenAdmin/Wizards/NewSRWizard_Pages/Frontends/LVMoISCSI.cs @@ -122,7 +122,7 @@ namespace XenAdmin.Wizards.NewSRWizard_Pages.Frontends HelpersGUI.PerformIQNCheck(); if (direction == PageLoadedDirection.Forward) - HelpersGUI.FocusFirstControl(Controls); + textBoxIscsiHost.Focus(); } protected override void PageLeaveCore(PageLoadedDirection direction, ref bool cancel) diff --git a/XenAdmin/Wizards/NewSRWizard_Pages/Frontends/NFS_ISO.cs b/XenAdmin/Wizards/NewSRWizard_Pages/Frontends/NFS_ISO.cs index 0f5be15f6..748cd9b56 100644 --- a/XenAdmin/Wizards/NewSRWizard_Pages/Frontends/NFS_ISO.cs +++ b/XenAdmin/Wizards/NewSRWizard_Pages/Frontends/NFS_ISO.cs @@ -109,7 +109,7 @@ namespace XenAdmin.Wizards.NewSRWizard_Pages.Frontends protected override void PageLoadedCore(PageLoadedDirection direction) { if (direction == PageLoadedDirection.Forward) - HelpersGUI.FocusFirstControl(Controls); + NfsServerPathComboBox.Focus(); } #endregion diff --git a/XenAdmin/Wizards/NewSRWizard_Pages/NewSrWizardNamePage.cs b/XenAdmin/Wizards/NewSRWizard_Pages/NewSrWizardNamePage.cs index 09c7e96ac..bf5d7cf57 100644 --- a/XenAdmin/Wizards/NewSRWizard_Pages/NewSrWizardNamePage.cs +++ b/XenAdmin/Wizards/NewSRWizard_Pages/NewSrWizardNamePage.cs @@ -74,7 +74,7 @@ namespace XenAdmin.Wizards.NewSRWizard_Pages protected override void PageLoadedCore(PageLoadedDirection direction) { if (direction == PageLoadedDirection.Forward) - HelpersGUI.FocusFirstControl(Controls); + textBoxName.Focus(); } public override void PopulatePage() diff --git a/XenAdmin/Wizards/PatchingWizard/PatchingWizard_PrecheckPage.cs b/XenAdmin/Wizards/PatchingWizard/PatchingWizard_PrecheckPage.cs index ffd59c519..686fb7d8c 100644 --- a/XenAdmin/Wizards/PatchingWizard/PatchingWizard_PrecheckPage.cs +++ b/XenAdmin/Wizards/PatchingWizard/PatchingWizard_PrecheckPage.cs @@ -356,6 +356,45 @@ namespace XenAdmin.Wizards.PatchingWizard groups.Add(new CheckGroup(Messages.CHECKING_HOST_LIVENESS_STATUS, livenessChecks)); + if (WizardMode == WizardMode.NewVersion) + { + //vSwitch controller check - for each pool + var vSwitchChecks = (from Pool pool in SelectedPools + let check = new VSwitchControllerCheck(pool.Connection.Resolve(pool.master), UpdateAlert?.NewServerVersion) + where check.CanRun() + select check as Check).ToList(); + + if (vSwitchChecks.Count > 0) + groups.Add(new CheckGroup(Messages.CHECKING_VSWITCH_CONTROLLER_GROUP, vSwitchChecks)); + + //protocol check - for each pool + var sslChecks = (from Pool pool in SelectedPools + let check = new PoolLegacySslCheck(pool.Connection.Resolve(pool.master), UpdateAlert?.NewServerVersion) + where check.CanRun() + select check as Check).ToList(); + + if (sslChecks.Count > 0) + groups.Add(new CheckGroup(Messages.CHECKING_SECURITY_PROTOCOL_GROUP, sslChecks)); + + //power on mode check - for each host + var iloChecks = (from Host host in SelectedServers + let check = new PowerOniLoCheck(host, UpdateAlert?.NewServerVersion) + where check.CanRun() + select check as Check).ToList(); + + if (iloChecks.Count > 0) + groups.Add(new CheckGroup(Messages.CHECKING_POWER_ON_MODE_GROUP, iloChecks)); + + //PVGuestsCheck checks + var pvChecks = (from Pool pool in SelectedPools + let check = new PVGuestsCheck(pool.Connection.Resolve(pool.master), false) + where check.CanRun() + select check as Check).ToList(); + + if (pvChecks.Count > 0) + groups.Add(new CheckGroup(Messages.CHECKING_PV_GUESTS, pvChecks)); + } + //HA checks var haChecks = new List(); @@ -490,37 +529,6 @@ namespace XenAdmin.Wizards.PatchingWizard } - if (highestNewVersion != null || UpdateAlert?.NewServerVersion != null) - { - //PVGuestsCheck checks - var pvChecks = (from Pool pool in SelectedPools - let check = new PVGuestsCheck(pool.Connection.Resolve(pool.master), false) - where check.CanRun() - select check as Check).ToList(); - - if (pvChecks.Count > 0) - groups.Add(new CheckGroup(Messages.CHECKING_PV_GUESTS, pvChecks)); - - //protocol check - for each pool - var sslChecks = (from Pool pool in SelectedPools - let check = new PoolLegacySslCheck(pool.Connection.Resolve(pool.master), - highestNewVersion ?? UpdateAlert?.NewServerVersion) - where check.CanRun() - select check as Check).ToList(); - - if (sslChecks.Count > 0) - groups.Add(new CheckGroup(Messages.CHECKING_SECURITY_PROTOCOL_GROUP, sslChecks)); - - //power on mode check - for each host - var iloChecks = (from Host host in SelectedServers - let check = new PowerOniLoCheck(host, highestNewVersion ?? UpdateAlert?.NewServerVersion) - where check.CanRun() - select check as Check).ToList(); - - if (iloChecks.Count > 0) - groups.Add(new CheckGroup(Messages.CHECKING_POWER_ON_MODE_GROUP, iloChecks)); - } - return groups; } diff --git a/XenAdmin/Wizards/PatchingWizard/PatchingWizard_SelectPatchPage.Designer.cs b/XenAdmin/Wizards/PatchingWizard/PatchingWizard_SelectPatchPage.Designer.cs index 14d755abf..00969fbb4 100644 --- a/XenAdmin/Wizards/PatchingWizard/PatchingWizard_SelectPatchPage.Designer.cs +++ b/XenAdmin/Wizards/PatchingWizard/PatchingWizard_SelectPatchPage.Designer.cs @@ -60,6 +60,7 @@ namespace XenAdmin.Wizards.PatchingWizard this.ColumnDescription = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.ColumnDate = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.webPageColumn = new System.Windows.Forms.DataGridViewLinkColumn(); + this._backgroundWorker = new System.ComponentModel.BackgroundWorker(); this.tableLayoutPanel1.SuspendLayout(); this.tableLayoutPanel2.SuspendLayout(); this.panel1.SuspendLayout(); @@ -287,6 +288,12 @@ namespace XenAdmin.Wizards.PatchingWizard this.webPageColumn.ReadOnly = true; this.webPageColumn.Resizable = System.Windows.Forms.DataGridViewTriState.True; // + // _backgroundWorker + // + this._backgroundWorker.WorkerSupportsCancellation = true; + this._backgroundWorker.DoWork += new System.ComponentModel.DoWorkEventHandler(this._backgroundWorker_DoWork); + this._backgroundWorker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this._backgroundWorker_RunWorkerCompleted); + // // PatchingWizard_SelectPatchPage // resources.ApplyResources(this, "$this"); @@ -331,5 +338,6 @@ namespace XenAdmin.Wizards.PatchingWizard private System.Windows.Forms.DataGridViewTextBoxColumn ColumnDescription; private System.Windows.Forms.DataGridViewTextBoxColumn ColumnDate; private System.Windows.Forms.DataGridViewLinkColumn webPageColumn; + private System.ComponentModel.BackgroundWorker _backgroundWorker; } } diff --git a/XenAdmin/Wizards/PatchingWizard/PatchingWizard_SelectPatchPage.cs b/XenAdmin/Wizards/PatchingWizard/PatchingWizard_SelectPatchPage.cs index 30f2be422..993e8c5a4 100644 --- a/XenAdmin/Wizards/PatchingWizard/PatchingWizard_SelectPatchPage.cs +++ b/XenAdmin/Wizards/PatchingWizard/PatchingWizard_SelectPatchPage.cs @@ -69,22 +69,52 @@ namespace XenAdmin.Wizards.PatchingWizard downloadUpdateRadioButton.Checked = true; } + private void RegisterEvents() + { + Updates.CheckForUpdatesStarted += CheckForUpdates_CheckForUpdatesStarted; + Updates.CheckForUpdatesCompleted += CheckForUpdates_CheckForUpdatesCompleted; + Updates.RestoreDismissedUpdatesStarted += Updates_RestoreDismissedUpdatesStarted; + } + + private void UnRegisterEvents() + { + Updates.RestoreDismissedUpdatesStarted -= Updates_RestoreDismissedUpdatesStarted; + Updates.CheckForUpdatesStarted -= CheckForUpdates_CheckForUpdatesStarted; + Updates.CheckForUpdatesCompleted -= CheckForUpdates_CheckForUpdatesCompleted; + } + private void CheckForUpdates_CheckForUpdatesStarted() { - Program.Invoke(Program.MainWindow, StartCheckForUpdates); + Program.Invoke(Program.MainWindow, () => + { + StartCheckForUpdates(); //call this before setting CheckForUpdatesInProgress + CheckForUpdatesInProgress = true; + }); } private void Updates_RestoreDismissedUpdatesStarted() { - Program.Invoke(Program.MainWindow, StartCheckForUpdates); + Program.Invoke(Program.MainWindow, () => + { + StartCheckForUpdates(); //call this before setting CheckForUpdatesInProgress + CheckForUpdatesInProgress = true; + }); + } + + private void CheckForUpdates_CheckForUpdatesCompleted(bool succeeded, string errorMessage) + { + Program.Invoke(Program.MainWindow, ()=> + { + CheckForUpdatesInProgress = false; + FinishCheckForUpdates(); //call this after setting CheckForUpdatesInProgress + }); } private void StartCheckForUpdates() { - if (CheckForUpdatesInProgress) + if (CheckForUpdatesInProgress || _backgroundWorker.IsBusy) return; - CheckForUpdatesInProgress = true; dataGridViewPatches.Rows.Clear(); tableLayoutPanelSpinner.Visible = true; RestoreDismUpdatesButton.Enabled = false; @@ -92,17 +122,16 @@ namespace XenAdmin.Wizards.PatchingWizard OnPageUpdated(); } - private void CheckForUpdates_CheckForUpdatesCompleted(bool succeeded, string errorMessage) + private void FinishCheckForUpdates() { - Program.Invoke(Program.MainWindow, delegate - { - tableLayoutPanelSpinner.Visible = false; - PopulatePatchesBox(); - RefreshListButton.Enabled = true; - RestoreDismUpdatesButton.Enabled = true; - CheckForUpdatesInProgress = false; - OnPageUpdated(); - }); + if (CheckForUpdatesInProgress || _backgroundWorker.IsBusy) + return; + + tableLayoutPanelSpinner.Visible = false; + PopulatePatchesBox(); + RefreshListButton.Enabled = true; + RestoreDismUpdatesButton.Enabled = true; + OnPageUpdated(); } public void SelectDownloadAlert(XenServerPatchAlert alert) @@ -113,30 +142,20 @@ namespace XenAdmin.Wizards.PatchingWizard if (row.UpdateAlert.Equals(alert)) { row.Selected = true; + break; } } } - public override string Text - { - get { return Messages.PATCHINGWIZARD_SELECTPATCHPAGE_TEXT; } - } + public override string Text => Messages.PATCHINGWIZARD_SELECTPATCHPAGE_TEXT; - public override string PageTitle - { - get { return Messages.PATCHINGWIZARD_SELECTPATCHPAGE_TITLE; } - } + public override string PageTitle => Messages.PATCHINGWIZARD_SELECTPATCHPAGE_TITLE; - public override string HelpID - { - get { return "SelectUpdate"; } - } + public override string HelpID => "SelectUpdate"; protected override void PageLoadedCore(PageLoadedDirection direction) { - Updates.CheckForUpdatesStarted += CheckForUpdates_CheckForUpdatesStarted; - Updates.CheckForUpdatesCompleted += CheckForUpdates_CheckForUpdatesCompleted; - Updates.RestoreDismissedUpdatesStarted += Updates_RestoreDismissedUpdatesStarted; + RegisterEvents(); if (direction == PageLoadedDirection.Forward) { @@ -159,18 +178,15 @@ namespace XenAdmin.Wizards.PatchingWizard downloadUpdateRadioButton.Checked = true; } - Updates.CheckServerPatches(); - PopulatePatchesBox(); - OnPageUpdated(); + StartCheckForUpdates(); //call this before starting the _backgroundWorker + _backgroundWorker.RunWorkerAsync(); } firstLoad = false; } - private bool IsInAutomatedUpdatesMode - { - get { return AutomatedUpdatesRadioButton.Visible && AutomatedUpdatesRadioButton.Checked; } - } + private bool IsInAutomatedUpdatesMode => + AutomatedUpdatesRadioButton.Visible && AutomatedUpdatesRadioButton.Checked; public WizardMode WizardMode { @@ -188,6 +204,7 @@ namespace XenAdmin.Wizards.PatchingWizard return WizardMode.SingleUpdate; } } + public KeyValuePair PatchFromDisk { get; private set; } protected override void PageLeaveCore(PageLoadedDirection direction, ref bool cancel) @@ -252,8 +269,8 @@ namespace XenAdmin.Wizards.PatchingWizard } } - if (!unzippedFiles.Contains(unzippedUpdateFilePath)) - unzippedFiles.Add(unzippedUpdateFilePath); + if (!UnzippedUpdateFiles.Contains(unzippedUpdateFilePath)) + UnzippedUpdateFiles.Add(unzippedUpdateFilePath); SelectedPatchFilePath = unzippedUpdateFilePath; } @@ -274,11 +291,7 @@ namespace XenAdmin.Wizards.PatchingWizard } if (!cancel) //unsubscribe only if we are really leaving this page - { - Updates.RestoreDismissedUpdatesStarted -= Updates_RestoreDismissedUpdatesStarted; - Updates.CheckForUpdatesStarted -= CheckForUpdates_CheckForUpdatesStarted; - Updates.CheckForUpdatesCompleted -= CheckForUpdates_CheckForUpdatesCompleted; - } + UnRegisterEvents(); } private XenServerPatchAlert GetAlertFromFile(string fileName, out bool hasUpdateXml) @@ -356,15 +369,17 @@ namespace XenAdmin.Wizards.PatchingWizard dataGridViewPatches.SuspendLayout(); dataGridViewPatches.Rows.Clear(); + var rowList = new List(); + foreach (Alert alert in updates) { if (!(alert is XenServerPatchAlert patchAlert)) continue; PatchGridViewRow row = new PatchGridViewRow(patchAlert); - if (!dataGridViewPatches.Rows.Contains(row)) + if (!rowList.Contains(row)) { - dataGridViewPatches.Rows.Add(row); + rowList.Add(row); if (patchAlert.RequiredXenCenterVersion != null) { @@ -374,6 +389,8 @@ namespace XenAdmin.Wizards.PatchingWizard } } } + + dataGridViewPatches.Rows.AddRange(rowList.ToArray()); } finally { @@ -383,22 +400,19 @@ namespace XenAdmin.Wizards.PatchingWizard public override void PageCancelled(ref bool cancel) { - Updates.RestoreDismissedUpdatesStarted -= Updates_RestoreDismissedUpdatesStarted; - Updates.CheckForUpdatesStarted -= CheckForUpdates_CheckForUpdatesStarted; - Updates.CheckForUpdatesCompleted -= CheckForUpdates_CheckForUpdatesCompleted; + UnRegisterEvents(); + + if (_backgroundWorker.IsBusy) + _backgroundWorker.CancelAsync(); } public override bool EnableNext() { - if (CheckForUpdatesInProgress) - { + if (CheckForUpdatesInProgress || _backgroundWorker.IsBusy) return false; - } if (IsInAutomatedUpdatesMode) - { return true; - } if (downloadUpdateRadioButton.Checked) { @@ -422,28 +436,33 @@ namespace XenAdmin.Wizards.PatchingWizard public override bool EnablePrevious() { - return !CheckForUpdatesInProgress; + return !CheckForUpdatesInProgress && !_backgroundWorker.IsBusy; } /// /// List to store unzipped files to be removed later by PatchingWizard /// - private readonly List unzippedFiles = new List(); - - public List UnzippedUpdateFiles - { - get { return unzippedFiles; } - } + public List UnzippedUpdateFiles { get; } = new List(); public string FilePath { - get { return fileNameTextBox.Text; } - set { fileNameTextBox.Text = value; } + get => fileNameTextBox.Text; + set => fileNameTextBox.Text = value; } - public UpdateType SelectedUpdateType { get; set; } + public UpdateType SelectedUpdateType { get; private set; } - public string SelectedPatchFilePath { get; set; } + public string SelectedPatchFilePath { get; private set; } + + private void _backgroundWorker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e) + { + Updates.CheckServerPatches(); + } + + private void _backgroundWorker_RunWorkerCompleted(object sender, System.ComponentModel.RunWorkerCompletedEventArgs e) + { + FinishCheckForUpdates(); + } #region DataGridView @@ -486,16 +505,14 @@ namespace XenAdmin.Wizards.PatchingWizard private class PatchGridViewRow : DataGridViewExRow, IEquatable { - private readonly XenServerPatchAlert _alert; - - private DataGridViewTextBoxCell _nameCell = new DataGridViewTextBoxCell(); - private DataGridViewTextBoxCell _descriptionCell = new DataGridViewTextBoxCell(); - private DataGridViewTextBoxCell _dateCell = new DataGridViewTextBoxCell(); - private DataGridViewLinkCell _webPageCell = new DataGridViewLinkCell(); + private readonly DataGridViewTextBoxCell _nameCell = new DataGridViewTextBoxCell(); + private readonly DataGridViewTextBoxCell _descriptionCell = new DataGridViewTextBoxCell(); + private readonly DataGridViewTextBoxCell _dateCell = new DataGridViewTextBoxCell(); + private readonly DataGridViewLinkCell _webPageCell = new DataGridViewLinkCell(); public PatchGridViewRow(XenServerPatchAlert alert) { - _alert = alert; + UpdateAlert = alert; Cells.AddRange(_nameCell, _descriptionCell, _dateCell, _webPageCell); _nameCell.Value = String.Format(alert.Name); @@ -503,12 +520,10 @@ namespace XenAdmin.Wizards.PatchingWizard _dateCell.Value = HelpersGUI.DateTimeToString(alert.Timestamp.ToLocalTime(), Messages.DATEFORMAT_DMY, true); _webPageCell.Value = Messages.PATCHING_WIZARD_WEBPAGE_CELL; + _webPageCell.ToolTipText = alert.WebPageLabel; } - public XenServerPatchAlert UpdateAlert - { - get { return _alert; } - } + public XenServerPatchAlert UpdateAlert { get; } public bool Equals(PatchGridViewRow other) { @@ -524,8 +539,8 @@ namespace XenAdmin.Wizards.PatchingWizard public override bool Equals(object obj) { - if (obj is PatchGridViewRow) - return this.Equals((PatchGridViewRow) obj); + if (obj is PatchGridViewRow row) + return Equals(row); return false; } @@ -536,9 +551,8 @@ namespace XenAdmin.Wizards.PatchingWizard if (c is DataGridViewLinkCell) continue; - var cell = c as DataGridViewCell; - if (c != null) - ((DataGridViewCell) c).ToolTipText = toolTip; + if (c is DataGridViewCell cell) + cell.ToolTipText = toolTip; } } } @@ -627,7 +641,7 @@ namespace XenAdmin.Wizards.PatchingWizard } #endregion - } + } public enum UpdateType { Legacy, ISO } } diff --git a/XenAdmin/Wizards/PatchingWizard/PatchingWizard_SelectPatchPage.resx b/XenAdmin/Wizards/PatchingWizard/PatchingWizard_SelectPatchPage.resx index d4e913091..756cd93da 100644 --- a/XenAdmin/Wizards/PatchingWizard/PatchingWizard_SelectPatchPage.resx +++ b/XenAdmin/Wizards/PatchingWizard/PatchingWizard_SelectPatchPage.resx @@ -736,6 +736,9 @@ <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="labelWithoutAutomatedUpdates" Row="1" RowSpan="1" Column="0" ColumnSpan="3" /><Control Name="labelWithAutomatedUpdates" Row="0" RowSpan="1" Column="0" ColumnSpan="3" /><Control Name="AutomatedUpdatesRadioButton" Row="2" RowSpan="1" Column="0" ColumnSpan="3" /><Control Name="automatedUpdatesOptionLabel" Row="3" RowSpan="1" Column="1" ColumnSpan="2" /><Control Name="downloadUpdateRadioButton" Row="4" RowSpan="1" Column="0" ColumnSpan="3" /><Control Name="RefreshListButton" Row="6" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="RestoreDismUpdatesButton" Row="6" RowSpan="1" Column="2" ColumnSpan="1" /><Control Name="selectFromDiskRadioButton" Row="7" RowSpan="1" Column="0" ColumnSpan="3" /><Control Name="tableLayoutPanel2" Row="8" RowSpan="1" Column="1" ColumnSpan="2" /><Control Name="panel1" Row="5" RowSpan="1" Column="1" ColumnSpan="2" /></Controls><Columns Styles="Absolute,20,AutoSize,0,Percent,100,Absolute,20" /><Rows Styles="AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,Percent,100,AutoSize,0,AutoSize,0,AutoSize,0" /></TableLayoutSettings> + + 17, 17 + True @@ -769,6 +772,12 @@ System.Windows.Forms.DataGridViewLinkColumn, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + _backgroundWorker + + + System.ComponentModel.BackgroundWorker, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + PatchingWizard_SelectPatchPage diff --git a/XenAdmin/Wizards/RollingUpgradeWizard/RollingUpgradeWizardPrecheckPage.cs b/XenAdmin/Wizards/RollingUpgradeWizard/RollingUpgradeWizardPrecheckPage.cs index cffe956fd..908e64bf1 100644 --- a/XenAdmin/Wizards/RollingUpgradeWizard/RollingUpgradeWizardPrecheckPage.cs +++ b/XenAdmin/Wizards/RollingUpgradeWizard/RollingUpgradeWizardPrecheckPage.cs @@ -199,6 +199,15 @@ namespace XenAdmin.Wizards.RollingUpgradeWizard groups.Add(new CheckGroup(Messages.CHECKING_SAFE_TO_UPGRADE, safeToUpgradeChecks)); } + //vSwitch controller check - for each pool + var vSwitchChecks = (from Host server in SelectedMasters + let check = new VSwitchControllerCheck(server, InstallMethodConfig, ManualUpgrade) + where check.CanRun() + select check as Check).ToList(); + + if (vSwitchChecks.Count > 0) + groups.Add(new CheckGroup(Messages.CHECKING_VSWITCH_CONTROLLER_GROUP, vSwitchChecks)); + //protocol check - for each pool var sslChecks = (from Host server in SelectedMasters let check = new PoolLegacySslCheck(server, InstallMethodConfig, ManualUpgrade) @@ -217,6 +226,15 @@ namespace XenAdmin.Wizards.RollingUpgradeWizard if (iloChecks.Count > 0) groups.Add(new CheckGroup(Messages.CHECKING_POWER_ON_MODE_GROUP, iloChecks)); + //Checking PV guests - for hosts that have any PV guests and warn the user before the upgrade. + var pvChecks = (from Host server in SelectedMasters + let check = new PVGuestsCheck(server, true, ManualUpgrade, InstallMethodConfig) + where check.CanRun() + select check as Check).ToList(); + + if (pvChecks.Count > 0) + groups.Add(new CheckGroup(Messages.CHECKING_PV_GUESTS, pvChecks)); + //HA checks - for each pool var haChecks = (from Host server in SelectedMasters select new HAOffCheck(server) as Check).ToList(); @@ -256,15 +274,6 @@ namespace XenAdmin.Wizards.RollingUpgradeWizard groups.Add(new CheckGroup(Messages.CHECKING_CLUSTERING_STATUS, gfs2Checks)); } - //Checking PV guests - for hosts that have any PV guests and warn the user before the upgrade. - var pvChecks = (from Host server in SelectedMasters - let check = new PVGuestsCheck(server, true, ManualUpgrade, InstallMethodConfig) - where check.CanRun() - select check as Check).ToList(); - - if (pvChecks.Count > 0) - groups.Add(new CheckGroup(Messages.CHECKING_PV_GUESTS, pvChecks)); - //Checking automated updates are possible if apply updates checkbox is ticked if (ApplyUpdatesToNewVersion) { diff --git a/XenAdmin/XenAdmin.csproj b/XenAdmin/XenAdmin.csproj index 32da82f03..137ca674b 100755 --- a/XenAdmin/XenAdmin.csproj +++ b/XenAdmin/XenAdmin.csproj @@ -241,6 +241,7 @@ + @@ -259,6 +260,7 @@ + @@ -6990,4 +6992,4 @@ copy "$(ProjectDir)\..\packages\putty.exe" "$(TargetDir)" - \ No newline at end of file + diff --git a/XenAdmin/XenSearch/Columns.cs b/XenAdmin/XenSearch/Columns.cs index 4ed30dd21..4757f655f 100644 --- a/XenAdmin/XenSearch/Columns.cs +++ b/XenAdmin/XenSearch/Columns.cs @@ -264,7 +264,7 @@ namespace XenAdmin.XenSearch private void ClickHandler(IXenObject o) { - if (Program.MainWindow.SelectObject(o) && Program.MainWindow.TheTabControl.TabPages.Contains(Program.MainWindow.TabPageGeneral)) + if (Program.MainWindow.SelectObjectInTree(o) && Program.MainWindow.TheTabControl.TabPages.Contains(Program.MainWindow.TabPageGeneral)) { Program.MainWindow.SwitchToTab(MainWindow.Tab.General); } diff --git a/XenAdminTests/MainWindowWrapper/MockMainWindow.cs b/XenAdminTests/MainWindowWrapper/MockMainWindow.cs index 1def79c9c..ec7b6826a 100644 --- a/XenAdminTests/MainWindowWrapper/MockMainWindow.cs +++ b/XenAdminTests/MainWindowWrapper/MockMainWindow.cs @@ -59,11 +59,6 @@ namespace XenAdminTests { } - public void ShowPerXenModelObjectWizard(IXenObject obj, Form wizard) - { - - } - public void ShowPerConnectionWizard(IXenConnection connection, Form wizard, Form parentForm = null) { @@ -84,11 +79,6 @@ namespace XenAdminTests throw new NotImplementedException(); } - public void CloseActiveWizards(IXenObject xenObject) - { - throw new NotImplementedException(); - } - public System.Collections.ObjectModel.Collection GetXenConnectionsCopy() { throw new NotImplementedException(); diff --git a/XenAdminTests/UnitTests/ExceptionSerializationTest.cs b/XenAdminTests/UnitTests/ExceptionSerializationTest.cs index 4d7fe5560..db44a419c 100644 --- a/XenAdminTests/UnitTests/ExceptionSerializationTest.cs +++ b/XenAdminTests/UnitTests/ExceptionSerializationTest.cs @@ -1,4 +1,35 @@ -using System; +/* Copyright (c) Citrix Systems, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, + * with or without modification, are permitted provided + * that the following conditions are met: + * + * * Redistributions of source code must retain the above + * copyright notice, this list of conditions and the + * following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + + using System; using System.Collections.Generic; using System.IO; using System.Runtime.Serialization.Formatters.Binary; diff --git a/XenAdminTests/XenModelTests/AddressTests.cs b/XenAdminTests/XenModelTests/AddressTests.cs index c48b72ecd..4733a497d 100644 --- a/XenAdminTests/XenModelTests/AddressTests.cs +++ b/XenAdminTests/XenModelTests/AddressTests.cs @@ -1,4 +1,35 @@ -using System.Collections.Generic; +/* Copyright (c) Citrix Systems, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, + * with or without modification, are permitted provided + * that the following conditions are met: + * + * * Redistributions of source code must retain the above + * copyright notice, this list of conditions and the + * following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +using System.Collections.Generic; using NUnit.Framework; using XenAdmin.Core; diff --git a/XenModel/FriendlyNames.ja.resx b/XenModel/FriendlyNames.ja.resx index b704debc8..2a82fe36b 100644 --- a/XenModel/FriendlyNames.ja.resx +++ b/XenModel/FriendlyNames.ja.resx @@ -345,6 +345,9 @@ StorageLink + + 不明 + Elastic Block Storage @@ -390,6 +393,9 @@ Local Performance Monitoring + + 不明 + udev diff --git a/XenModel/FriendlyNames.zh-CN.resx b/XenModel/FriendlyNames.zh-CN.resx index f2c5f5bf7..94585519a 100644 --- a/XenModel/FriendlyNames.zh-CN.resx +++ b/XenModel/FriendlyNames.zh-CN.resx @@ -345,6 +345,9 @@ StorageLink + + 未知 + 弹性块存储 @@ -390,6 +393,9 @@ 本地性能监视 + + 未知 + udev diff --git a/XenModel/InvisibleMessages.ja.resx b/XenModel/InvisibleMessages.ja.resx index 8ee29b809..61a1ebeb0 100644 --- a/XenModel/InvisibleMessages.ja.resx +++ b/XenModel/InvisibleMessages.ja.resx @@ -117,15 +117,6 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - https://{0}/index.html?transactionID={1} - - - activate.vmd.citrix.com - - - https://{0}/reactivation_server.php - https://cis.citrix.com/legal/ diff --git a/XenModel/InvisibleMessages.zh-CN.resx b/XenModel/InvisibleMessages.zh-CN.resx index f56eeb30a..9b9a2c598 100644 --- a/XenModel/InvisibleMessages.zh-CN.resx +++ b/XenModel/InvisibleMessages.zh-CN.resx @@ -117,15 +117,6 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - https://{0}/index.html?transactionID={1} - - - activate.vmd.citrix.com - - - https://{0}/reactivation_server.php - https://cis.citrix.com/legal/ diff --git a/XenModel/Messages.Designer.cs b/XenModel/Messages.Designer.cs index d4499ede2..e5057004e 100755 --- a/XenModel/Messages.Designer.cs +++ b/XenModel/Messages.Designer.cs @@ -7329,6 +7329,24 @@ namespace XenAdmin { } } + /// + /// Looks up a localized string similar to vSwitch Controller check. + /// + public static string CHECKING_VSWITCH_CONTROLLER { + get { + return ResourceManager.GetString("CHECKING_VSWITCH_CONTROLLER", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Checking vSwitch Controller configuration. + /// + public static string CHECKING_VSWITCH_CONTROLLER_GROUP { + get { + return ResourceManager.GetString("CHECKING_VSWITCH_CONTROLLER_GROUP", resourceCulture); + } + } + /// /// Looks up a localized string similar to Checking [XenCenter] version. /// @@ -11568,9 +11586,9 @@ namespace XenAdmin { /// /// Looks up a localized string similar to unable to determine failure reason. /// - public static string DELAY_LOADED_COMBO_BOX_ITEM_FAILURE_UNKOWN { + public static string DELAY_LOADED_COMBO_BOX_ITEM_FAILURE_UNKNOWN { get { - return ResourceManager.GetString("DELAY_LOADED_COMBO_BOX_ITEM_FAILURE_UNKOWN", resourceCulture); + return ResourceManager.GetString("DELAY_LOADED_COMBO_BOX_ITEM_FAILURE_UNKNOWN", resourceCulture); } } @@ -15276,7 +15294,7 @@ namespace XenAdmin { } /// - /// Looks up a localized string similar to The following Vms could not be resumed:. + /// Looks up a localized string similar to The following VMs could not be resumed:. /// public static string ERROR_DIALOG_RESUME_VM_TEXT { get { @@ -19792,7 +19810,7 @@ namespace XenAdmin { } /// - /// Looks up a localized string similar to The server could not complete the import due to an unkown error.. + /// Looks up a localized string similar to The server could not complete the import due to an unknown error.. /// public static string IMPORT_GENERIC_FAIL { get { @@ -20191,7 +20209,7 @@ namespace XenAdmin { } /// - /// Looks up a localized string similar to The [Xenserver] Template that you are attempting to import already exists in the selected pool.. + /// Looks up a localized string similar to The [XenServer] Template that you are attempting to import already exists in the selected pool.. /// public static string IMPORT_TEMPLATE_ALREADY_EXISTS { get { @@ -21046,7 +21064,16 @@ namespace XenAdmin { } /// - /// Looks up a localized string similar to Invalid hostname. + /// Looks up a localized string similar to Invalid disk size. + /// + public static string INVALID_DISK_SIZE { + get { + return ResourceManager.GetString("INVALID_DISK_SIZE", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invalid host name. /// public static string INVALID_HOST { get { @@ -21055,7 +21082,7 @@ namespace XenAdmin { } /// - /// Looks up a localized string similar to Invalid disk size. + /// Looks up a localized string similar to Invalid number. /// public static string INVALID_NUMBER { get { @@ -21401,7 +21428,7 @@ namespace XenAdmin { } /// - /// Looks up a localized string similar to Learn more. + /// Looks up a localized string similar to Learn more.... /// public static string LEARN_MORE { get { @@ -24581,6 +24608,15 @@ namespace XenAdmin { } } + /// + /// Looks up a localized string similar to Allowed VLAN range: {0} to {1}. + /// + public static string NETW_DETAILS_VLAN_RANGE { + get { + return ResourceManager.GetString("NETW_DETAILS_VLAN_RANGE", resourceCulture); + } + } + /// /// Looks up a localized string similar to Configure the new network. /// @@ -24635,6 +24671,15 @@ namespace XenAdmin { } } + /// + /// Looks up a localized string similar to VLAN 0 will receive all traffic not on any other VLAN. + /// + public static string NETW_VLAN_ZERO { + get { + return ResourceManager.GetString("NETW_VLAN_ZERO", resourceCulture); + } + } + /// /// Looks up a localized string similar to Network. /// @@ -25637,7 +25682,7 @@ namespace XenAdmin { } /// - /// Looks up a localized string similar to This server's linux pack installation state differs from that of the master. + /// Looks up a localized string similar to This server's Linux pack installation state differs from that of the master. /// public static string NEWPOOL_LINUXPACK { get { @@ -25749,7 +25794,7 @@ namespace XenAdmin { /// ///As SMB storage repositories are shared, the virtual disks stored in them allow VMs to be started on any server in a resource pool and to be migrated between them using Live Migration. /// - ///When you configure a SMB storage repository, you simply provide the hostname or IP address of the SMB server, the user name, the password and the path to a directory that will be [rest of string was truncated]";. + ///When you configure a SMB storage repository, you simply provide the host name or IP address of the SMB server, the user name, the password and the path to a directory that will b [rest of string was truncated]";. /// public static string NEWSR_CIFS_BLURB { get { @@ -26251,7 +26296,7 @@ namespace XenAdmin { /// /// Looks up a localized string similar to If you have access to a Network Appliance (NetApp) filer with sufficient disk space, running a version of Data ONTAP 7G (version 7.2 or greater), you can configure a custom NetApp Storage Repository. /// - ///The driver uses the ZAPI interface to the filer to create a group of FlexVols which correspond to an SR. VDIs are created as virtual LUNs on the filer, and attached to the host using an iSCSI data path. + ///The driver uses the XAPI interface to the filer to create a group of FlexVols which correspond to an SR. VDIs are created as virtual LUNs on the filer, and attached to the host using an iSCSI data path. /// ///VM cloning uses the snapshot and clone capabilities of the filer to provide high performance and to e [rest of string was truncated]";. /// @@ -26437,7 +26482,7 @@ namespace XenAdmin { /// ///As NFS storage repositories are shared, the virtual disks stored in them allow VMs to be started on any server in a resource pool and to be migrated between them using Live Migration. /// - ///When you configure an NFS storage repository, you simply provide the hostname or IP address of the NFS server and the path to a directory that will be used to contain the storage reposit [rest of string was truncated]";. + ///When you configure an NFS storage repository, you simply provide the host name or IP address of the NFS server and the path to a directory that will be used to contain the storage reposi [rest of string was truncated]";. /// public static string NEWSR_VHDONFS_BLURB { get { @@ -27695,9 +27740,9 @@ namespace XenAdmin { /// /// Looks up a localized string similar to The VM is not agile. Restart cannot be guaranteed.. /// - public static string NOT_AGILE_UNKOWN { + public static string NOT_AGILE_UNKNOWN { get { - return ResourceManager.GetString("NOT_AGILE_UNKOWN", resourceCulture); + return ResourceManager.GetString("NOT_AGILE_UNKNOWN", resourceCulture); } } @@ -29723,7 +29768,7 @@ namespace XenAdmin { } /// - /// Looks up a localized string similar to Server '{0}' could not be evacuated because there was not enough free memory on the other servers to migrate all the VMs from this server. Please suspend or shutdown some VMs and then press Retry to resume the process.. + /// Looks up a localized string similar to Server '{0}' could not be evacuated because there was not enough free memory on the other servers to migrate all the VMs from this server. Please suspend or shut down some VMs and then press Retry to resume the process.. /// public static string PLAN_ACTION_FAILURE_NOT_ENOUGH_MEMORY { get { @@ -30148,7 +30193,7 @@ namespace XenAdmin { } /// - /// Looks up a localized string similar to {0}: Support for paravirtualized (PV) guests has been removed as of {1}. Click "Learn more" to see the list of supported guest operating systems. . + /// Looks up a localized string similar to {0}: Support for paravirtualized (PV) guests has been removed in {1}. Click Learn more to see the list of supported guest operating systems.. /// public static string POOL_HAS_PV_GUEST_WARNING { get { @@ -30638,6 +30683,33 @@ namespace XenAdmin { } } + /// + /// Looks up a localized string similar to {0}: Support for the vSwitch Controller has been removed in {1}.. + /// + public static string PROBLEM_VSWITCH_CONTROLLER_DESCRIPTION { + get { + return ResourceManager.GetString("PROBLEM_VSWITCH_CONTROLLER_DESCRIPTION", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Support for the vSwitch Controller has been removed in {0}. You must deconfigure the controller because any features that require it will no longer work. Please click the link below for more information.. + /// + public static string PROBLEM_VSWITCH_CONTROLLER_INFO_ERROR { + get { + return ResourceManager.GetString("PROBLEM_VSWITCH_CONTROLLER_INFO_ERROR", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to If you are upgrading to {0} and above, you must deconfigure the vSwitch Controller because support for it has been removed in this release and any features that require it will no longer work. Please click the link below for more information.. + /// + public static string PROBLEM_VSWITCH_CONTROLLER_INFO_WARNING { + get { + return ResourceManager.GetString("PROBLEM_VSWITCH_CONTROLLER_INFO_WARNING", resourceCulture); + } + } + /// /// Looks up a localized string similar to [XenCenter] version. /// @@ -33940,7 +34012,7 @@ namespace XenAdmin { } /// - /// Looks up a localized string similar to Enter a valid hostname or IP address and try again.. + /// Looks up a localized string similar to Enter a valid host name or IP address and try again.. /// public static string SOLUTION_NOT_FOUND { get { @@ -34011,15 +34083,6 @@ namespace XenAdmin { } } - /// - /// Looks up a localized string similar to This SR cannot be detached with [XenCenter].. - /// - public static string SR_CANNOT_BE_DETACHED_WITH_XC { - get { - return ResourceManager.GetString("SR_CANNOT_BE_DETACHED_WITH_XC", resourceCulture); - } - } - /// /// Looks up a localized string similar to This SR cannot be forgotten with [XenCenter].. /// @@ -36722,15 +36785,6 @@ namespace XenAdmin { } } - /// - /// Looks up a localized string similar to Select the checkboxes for each server you want to update. Select a pool checkbox to select all the available servers in the pool.. - /// - public static string UPDATES_WIZARD_PAGE1_TOPTEXT { - get { - return ResourceManager.GetString("UPDATES_WIZARD_PAGE1_TOPTEXT", resourceCulture); - } - } - /// /// Looks up a localized string similar to {0}: The update has already been applied to this server. This server will be skipped.. /// @@ -39670,24 +39724,6 @@ namespace XenAdmin { } } - /// - /// Looks up a localized string similar to Your new network will be mapped to an existing physical network interface and assigned a VLAN number to use on that interface. You can select the physical interface you would like to use below.. - /// - public static string WIZARD_DESC_NETWORK_SETTINGS_EXTERNAL { - get { - return ResourceManager.GetString("WIZARD_DESC_NETWORK_SETTINGS_EXTERNAL", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Check the box below if you would like to automatically add this network to new VMs.. - /// - public static string WIZARD_DESC_NETWORK_SETTINGS_INTERNAL { - get { - return ResourceManager.GetString("WIZARD_DESC_NETWORK_SETTINGS_INTERNAL", resourceCulture); - } - } - /// /// Looks up a localized string similar to There was an internal error completing this wizard. Please see the logs for more information.. /// diff --git a/XenModel/Messages.ja.resx b/XenModel/Messages.ja.resx index e6ef08117..2806fb8f4 100755 --- a/XenModel/Messages.ja.resx +++ b/XenModel/Messages.ja.resx @@ -997,7 +997,7 @@ ヘルス チェック設定の転送 - '{0}' 上の統合された GPU パススルーの更新 + '{0}' 上の統合された GPU パススルーの更新 アップロード エラー。パッチはアップロードされましたが、ホストで見つかりません。 @@ -4110,7 +4110,7 @@ VM 移行処理のパフォーマンスや信頼性を向上させるため、 {0} - {1} - + 失敗理由を特定できません @@ -5943,7 +5943,7 @@ CD をイジェクトしてから再試行してください。 メモリ - メモリと VCPU + メモリと vCPU 状態 @@ -7575,6 +7575,9 @@ SCSI ID: {2} [XenServer] Express をアクティブ化するときは、サーバーを 1 つだけ選択してください。 + + {0} より前のサーバーにライセンスを適用する場合、一度に 1 つのサーバーのみを選択する必要があります。 + ライセンス サーバー {0} に接続できません。再接続の猶予期間は {1} までです。 @@ -9594,7 +9597,7 @@ VM が再起動したら、[[Citrix VM Tools] をインストール] を再度 この VM の SR は共有されていません。再起動は保証されません。 - + この VM はアジャイルではありません。再起動は保証されません。 @@ -12623,9 +12626,6 @@ SR-IOV ネットワークを有効にするには、サーバーの再起動が {0}: 最新の [Citrix VM Tools] がインストールされるまで、VM {1} を一時停止することはできません。 - - アップデート対象のサーバーのチェックボックスをオンにしてください。プール内で使用可能なすべてのサーバーをアップデートするには、プールのチェックボックスをオンにします。 - {0}: アップデートはこのサーバーに適用済みです。このサーバーはスキップされます。 @@ -13021,10 +13021,10 @@ SR-IOV ネットワークを有効にするには、サーバーの再起動が Mbps - マイクロ秒 + μs - ミリ秒 + ms mW @@ -13042,7 +13042,7 @@ SR-IOV ネットワークを有効にするには、サーバーの再起動が 0.0 - + s TB @@ -13418,7 +13418,7 @@ SR-IOV ネットワークを有効にするには、サーバーの再起動が この VM にはパススルー GPU が割り当てられています。 - メモリや VCPU への変更は、VM の再起動後に反映されます。 + メモリや vCPU への変更は、VM の再起動後に反映されます。 VM の全般設定の変更 diff --git a/XenModel/Messages.resx b/XenModel/Messages.resx index 08f6b9399..b251ac001 100755 --- a/XenModel/Messages.resx +++ b/XenModel/Messages.resx @@ -2628,6 +2628,12 @@ Do you want to assign it to the schedule '{2}' instead? Checking security protocol + + vSwitch Controller check + + + Checking vSwitch Controller configuration + Checking reboots required @@ -4117,7 +4123,7 @@ For optimal performance and reliability during VM migration, ensure that the net {0} - {1} - + unable to determine failure reason @@ -5365,7 +5371,7 @@ Would you like to eject these ISOs before continuing? Error Resuming VM on Server - The following Vms could not be resumed: + The following VMs could not be resumed: Error Resuming VM @@ -6939,7 +6945,7 @@ This might result in failure to migrate VMs to this server during the RPU or to Review End User License Agreement (EULA) - The server could not complete the import due to an unkown error. + The server could not complete the import due to an unknown error. The exported files are incomplete or in an unrecognized format. @@ -7074,7 +7080,7 @@ This might result in failure to migrate VMs to this server during the RPU or to Locate the file you want to import - The [Xenserver] Template that you are attempting to import already exists in the selected pool. + The [XenServer] Template that you are attempting to import already exists in the selected pool. Configure storage for the new template @@ -7310,11 +7316,14 @@ This might result in failure to migrate VMs to this server during the RPU or to Interfaces: {0} + + Invalid disk size + - Invalid hostname + Invalid host name - Invalid disk size + Invalid number Invalid parameter @@ -7444,7 +7453,7 @@ Size: {3} License Manager - Learn more + Learn more... Enter a user name and password with sufficient privileges to remove your machine account from AD. Authentication will be disabled even if the machine account cannot be removed. @@ -8678,6 +8687,9 @@ You should only proceed if you have verified that these settings are correct. This VLAN number is already in use + + Allowed VLAN range: {0} to {1} + Configure the new network @@ -8696,6 +8708,9 @@ You should only proceed if you have verified that these settings are correct. Choose the type of network to create + + VLAN 0 will receive all traffic not on any other VLAN + Never @@ -8754,7 +8769,7 @@ You should only proceed if you have verified that these settings are correct.This server does not have the same license as the pool master - This server's linux pack installation state differs from that of the master + This server's Linux pack installation state differs from that of the master The master is still connecting @@ -8791,7 +8806,7 @@ You should only proceed if you have verified that these settings are correct. +When you configure a SMB storage repository, you simply provide the host name or IP address of the SMB server, the user name, the password and the path to a directory that will be used to contain the storage repository. The SMB server must be configured to export the specified path to all servers in the pool. Select this option if you have a library of VM installation ISO images available as a Windows (SMB/CIFS) share that you want to attach to your host or pool. @@ -8972,7 +8987,7 @@ Do you want to reattach the SR? If you have access to a Network Appliance (NetApp) filer with sufficient disk space, running a version of Data ONTAP 7G (version 7.2 or greater), you can configure a custom NetApp Storage Repository. -The driver uses the ZAPI interface to the filer to create a group of FlexVols which correspond to an SR. VDIs are created as virtual LUNs on the filer, and attached to the host using an iSCSI data path. +The driver uses the XAPI interface to the filer to create a group of FlexVols which correspond to an SR. VDIs are created as virtual LUNs on the filer, and attached to the host using an iSCSI data path. VM cloning uses the snapshot and clone capabilities of the filer to provide high performance and to ensure compatibility with existing ONTAP filer management tools. @@ -9038,7 +9053,7 @@ VM cloning uses the snapshot and clone capabilities of the filer to provide high As NFS storage repositories are shared, the virtual disks stored in them allow VMs to be started on any server in a resource pool and to be migrated between them using Live Migration. -When you configure an NFS storage repository, you simply provide the hostname or IP address of the NFS server and the path to a directory that will be used to contain the storage repository. The NFS server must be configured to export the specified path to all servers in the pool. +When you configure an NFS storage repository, you simply provide the host name or IP address of the NFS server and the path to a directory that will be used to contain the storage repository. The NFS server must be configured to export the specified path to all servers in the pool. NFS @@ -9611,7 +9626,7 @@ It is strongly recommended that you Cancel and apply the latest version of the p The VM is using a non-shared SR. Restart cannot be guaranteed. - + The VM is not agile. Restart cannot be guaranteed. @@ -10342,7 +10357,7 @@ File not found Server '{0}' could not be evacuated because there were no servers available to accommodate all the VMs being migrated from this server. Please reboot the other servers that are pending a reboot following the update installation, and then press Retry to resume the process. - Server '{0}' could not be evacuated because there was not enough free memory on the other servers to migrate all the VMs from this server. Please suspend or shutdown some VMs and then press Retry to resume the process. + Server '{0}' could not be evacuated because there was not enough free memory on the other servers to migrate all the VMs from this server. Please suspend or shut down some VMs and then press Retry to resume the process. Installing [XenServer] on '{0}'... @@ -10494,7 +10509,7 @@ Please reconnect the host and try again This pool has no shared storage - {0}: Support for paravirtualized (PV) guests has been removed as of {1}. Click "Learn more" to see the list of supported guest operating systems. + {0}: Support for paravirtualized (PV) guests has been removed in {1}. Click Learn more to see the list of supported guest operating systems. The pool is partially licensed @@ -10586,6 +10601,15 @@ Please reconnect the host and try again If you are upgrading to {0} and above, you will not be able to use security protocols earlier than TLS 1.2 for communication with the server and you may lose permanently access to it. + + {0}: Support for the vSwitch Controller has been removed in {1}. + + + Support for the vSwitch Controller has been removed in {0}. You must deconfigure the controller because any features that require it will no longer work. Please click the link below for more information. + + + If you are upgrading to {0} and above, you must deconfigure the vSwitch Controller because support for it has been removed in this release and any features that require it will no longer work. Please click the link below for more information. + The MAC address entered has already been assigned to the VM: {1} @@ -11763,7 +11787,7 @@ Do you want to connect to the pool master '{1}'? Please wait and then try again. - Enter a valid hostname or IP address and try again. + Enter a valid host name or IP address and try again. Try again with a more privileged user account. @@ -11839,9 +11863,6 @@ You may need to reboot your server(s) to enable SR-IOV network. This SR cannot be destroyed with [XenCenter]. - - This SR cannot be detached with [XenCenter]. - This SR cannot be forgotten with [XenCenter]. @@ -12661,9 +12682,6 @@ Please check your settings and try again. {0}: The VM {1} cannot be suspended until it has up to date [Citrix VM Tools]. - - Select the checkboxes for each server you want to update. Select a pool checkbox to select all the available servers in the pool. - {0}: The update has already been applied to this server. This server will be skipped. @@ -13698,12 +13716,6 @@ Schedule: &Next > - - Your new network will be mapped to an existing physical network interface and assigned a VLAN number to use on that interface. You can select the physical interface you would like to use below. - - - Check the box below if you would like to automatically add this network to new VMs. - There was an internal error completing this wizard. Please see the logs for more information. @@ -14463,4 +14475,4 @@ You will need to navigate to the Console on each of the selected VMs to complete You are here - \ No newline at end of file + diff --git a/XenModel/Messages.zh-CN.resx b/XenModel/Messages.zh-CN.resx index 16122917b..dfa29cb06 100755 --- a/XenModel/Messages.zh-CN.resx +++ b/XenModel/Messages.zh-CN.resx @@ -1234,7 +1234,7 @@ 关闭 - 正在生成 VM“{0}”的快照... + 正在创建 VM“{0}”的快照... 已启动 @@ -4105,7 +4105,7 @@ {0} - {1} - + 无法确定失败原因 @@ -5937,7 +5937,7 @@ 内存 - 内存和 VCPU + 内存和 vCPU 状态 @@ -6659,9 +6659,9 @@ 本地和远程({0}) - 如果要升级到 [XenServer] {1} 及更高版本,则将增加 {0} 上的控制域内存。 + 如果要升级到 [XenServer] {1} 及更高版本,则将增加 {0} 上的控制域内存。 -这可能会导致在 RPU 期间无法将 VM 迁移到此服务器,或在升级后无法容纳当前位于此服务器上的所有 VM。 +这可能会导致在 RPU 期间无法将 VM 迁移到此服务器,或者在升级后无法容纳当前位于此服务器上的所有 VM。 {0}: 由于控制域内存可能会增加,此服务器可能在升级后无法容纳其所有 VM。 @@ -6926,7 +6926,7 @@ 服务器因出现未知错误而无法完成导入。 - 导出的文件不完整,或格式无法识别。 + 导出的文件不完整,或者格式无法识别。 修复 ISO 无法复制到选定的 SR @@ -7570,6 +7570,9 @@ SCSI ID: {2} 激活 [XenServer] Express 时,必须一次选择一个服务器。 + + 许可使用早于 {0} 的服务器时,必须一次选择一台服务器。 + 无法访问许可证服务器 {0}。您可以在 {1} 之前重新连接许可证服务器。 @@ -9593,7 +9596,7 @@ VM 克隆使用文件管理器的快照和克隆功能来实现高性能,并 VM 使用非共享 SR。无法保证重新启动。 - + VM 无灵活性。无法保证重新启动。 @@ -11441,7 +11444,7 @@ VM 克隆使用文件管理器的快照和克隆功能来实现高性能,并 池主服务器上的当前时间为: {0} - 此版本的 [XenCenter] 支持 [XenServer] {0} 及更高版本。 + 本版本的 [XenCenter] 支持 [XenServer] {0} 及更高版本。 使用早期版本的 [XenCenter] 管理此服务器。 @@ -12620,9 +12623,6 @@ VM 克隆使用文件管理器的快照和克隆功能来实现高性能,并 {0}: 安装最新版本的 [Citrix VM Tools] 之前不能暂停 VM {1}。 - - 选中要更新的每个服务器对应的复选框。选中池的复选框可选择该池中的所有可用服务器。 - {0}: 更新已应用到该服务器。将跳过该服务器。 @@ -13415,7 +13415,7 @@ VM 克隆使用文件管理器的快照和克隆功能来实现高性能,并 已为此 VM 分配了直通 GPU。 - 内存和/或 VCPU 更改将在重新启动 VM 时生效。 + 内存和/或 vCPU 更改将在重新启动 VM 时生效。 VM 常规更改 diff --git a/XenModel/XenAPI-Extensions/SR.cs b/XenModel/XenAPI-Extensions/SR.cs index 3ed8b390b..ebe29ca22 100644 --- a/XenModel/XenAPI-Extensions/SR.cs +++ b/XenModel/XenAPI-Extensions/SR.cs @@ -218,11 +218,6 @@ namespace XenAPI return null; } - public bool IsDetachable() - { - return !IsDetached() && !HasRunningVMs() && CanCreateWithXenCenter(); - } - /// /// Can create with XC, or is citrix storage link gateway. Special case alert! /// diff --git a/XenModel/XenAPI/FriendlyErrorNames.ja.resx b/XenModel/XenAPI/FriendlyErrorNames.ja.resx index 14d187b4e..1a08031c8 100644 --- a/XenModel/XenAPI/FriendlyErrorNames.ja.resx +++ b/XenModel/XenAPI/FriendlyErrorNames.ja.resx @@ -112,10 +112,10 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 アクティブ化キーを適用するには、エディションの設定が free である必要があります。 @@ -1353,7 +1353,7 @@ 指定された SMB バージョンは使用できません。1.0 または 3.0 を選択してください - xe-mount-isosr には "-o" が必要です + xe-mount-iso-sr には "-o" が必要です 指定した VDI は現在使用中です。 diff --git a/XenModel/XenAPI/FriendlyErrorNames.zh-CN.resx b/XenModel/XenAPI/FriendlyErrorNames.zh-CN.resx index dcddbdfa4..6caafd666 100644 --- a/XenModel/XenAPI/FriendlyErrorNames.zh-CN.resx +++ b/XenModel/XenAPI/FriendlyErrorNames.zh-CN.resx @@ -112,10 +112,10 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 仅当版本设置为“免费”时,才能应用激活密钥。 @@ -1353,7 +1353,7 @@ 不允许使用给定的 SMB 版本。请选择 1.0 或 3.0 - 需要 -o 以及 xe-mount-isosr + 需要 -o 以及 xe-mount-iso-sr 指定的 VDI 当前正在使用 diff --git a/XenOvfApi/Content.ja.resx b/XenOvfApi/Content.ja.resx index f3defcf71..6beb97681 100644 --- a/XenOvfApi/Content.ja.resx +++ b/XenOvfApi/Content.ja.resx @@ -121,7 +121,7 @@ Xen アプライアンス ウィザード - VMWare VMX から変換済み + VMware VMX から変換済み Virtual PC から変換済み diff --git a/XenOvfApi/Content.resx b/XenOvfApi/Content.resx index 889e31dc1..6e39e833c 100644 --- a/XenOvfApi/Content.resx +++ b/XenOvfApi/Content.resx @@ -121,7 +121,7 @@ Xen Appliance Wizard - Converted from VMWare VMX + Converted from VMware VMX Converted from Virtual PC diff --git a/XenOvfApi/Content.zh-CN.resx b/XenOvfApi/Content.zh-CN.resx index 13904b978..9c980fa38 100644 --- a/XenOvfApi/Content.zh-CN.resx +++ b/XenOvfApi/Content.zh-CN.resx @@ -121,7 +121,7 @@ Xen 设备向导 - 转换自 VMWare VMX + 转换自 VMware VMX 转换自 Virtual PC diff --git a/XenOvfTransport/Messages.Designer.cs b/XenOvfTransport/Messages.Designer.cs index 7fd809bd2..f20cfb7fe 100644 --- a/XenOvfTransport/Messages.Designer.cs +++ b/XenOvfTransport/Messages.Designer.cs @@ -313,7 +313,7 @@ namespace XenOvfTransport { } /// - /// Looks up a localized string similar to Please shutdown or suspend virtual machine {0} before exporting.. + /// Looks up a localized string similar to Please shut down or suspend virtual machine {0} before exporting.. /// internal static string ERROR_VM_NOT_HALTED { get { @@ -439,7 +439,7 @@ namespace XenOvfTransport { } /// - /// Looks up a localized string similar to Failed to shutdown Transfer VM.. + /// Looks up a localized string similar to Failed to shut down the Transfer VM.. /// internal static string ISCSI_SHUTDOWN_ERROR { get { @@ -448,7 +448,7 @@ namespace XenOvfTransport { } /// - /// Looks up a localized string similar to Failed to start Transfer VM.. + /// Looks up a localized string similar to Failed to start the Transfer VM.. /// internal static string ISCSI_START_ERROR { get { diff --git a/XenOvfTransport/Messages.resx b/XenOvfTransport/Messages.resx index 38a64e2a7..7167717a0 100644 --- a/XenOvfTransport/Messages.resx +++ b/XenOvfTransport/Messages.resx @@ -202,7 +202,7 @@ Failed to find virtual machine {0}. - Please shutdown or suspend virtual machine {0} before exporting. + Please shut down or suspend virtual machine {0} before exporting. Export: @@ -244,10 +244,10 @@ The address of the Transfer VM is unknown. - Failed to shutdown Transfer VM. + Failed to shut down the Transfer VM. - Failed to start Transfer VM. + Failed to start the Transfer VM. Canceled virtual disk verification after export. diff --git a/XenServerHealthCheck/Properties/AssemblyInfo.cs b/XenServerHealthCheck/Properties/AssemblyInfo.cs index ccb0c44a9..6a1a72685 100755 --- a/XenServerHealthCheck/Properties/AssemblyInfo.cs +++ b/XenServerHealthCheck/Properties/AssemblyInfo.cs @@ -1,4 +1,35 @@ -using System.Reflection; +/* Copyright (c) Citrix Systems, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, + * with or without modification, are permitted provided + * that the following conditions are met: + * + * * Redistributions of source code must retain the above + * copyright notice, this list of conditions and the + * following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the + * following disclaimer in the documentation and/or other + * materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; diff --git a/devtools/copyrightcheck/copyrightcheck.sh b/devtools/copyrightcheck/copyrightcheck.sh deleted file mode 100644 index c0b9093e4..000000000 --- a/devtools/copyrightcheck/copyrightcheck.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash - -# Copyright (c) Citrix Systems, Inc. -# All rights reserved. -# -# Redistribution and use in source and binary forms, -# with or without modification, are permitted provided -# that the following conditions are met: -# -# * Redistributions of source code must retain the above -# copyright notice, this list of conditions and the -# following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the -# following disclaimer in the documentation and/or other -# materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND -# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. - -set -eu - -echo "INFO: copyrightcheck" - -dir="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -src="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )/../.." && pwd )" - -output=$( /usr/bin/find "$src/XenAdmin" "$src/XenModel" "$src/XenOvfApi" "$src/XenOvfTransport" "$src/mk" "$src/Branding" "$src/XenServerHealthCheckTests" "$src/devtools" -not -ipath '*obj/*' -type f \( -iname \*.cs -o -iname \*.sh \) -not -ipath '*Designer*' -exec grep -L "Copyright (c) Citrix Systems, Inc." {} \;) - -echo "$output" | sed -e "s,$src/,,g" - -test -z "$output" diff --git a/devtools/i18ncheck/autoscalemode-file.sh b/devtools/i18ncheck/autoscalemode-file.sh deleted file mode 100644 index 014d0ef5f..000000000 --- a/devtools/i18ncheck/autoscalemode-file.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh - -# Copyright (c) Citrix Systems, Inc. -# All rights reserved. -# -# Redistribution and use in source and binary forms, -# with or without modification, are permitted provided -# that the following conditions are met: -# -# * Redistributions of source code must retain the above -# copyright notice, this list of conditions and the -# following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the -# following disclaimer in the documentation and/or other -# materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND -# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. - -set -eu - -grep -q 'AutoScaleMode\.\(Font\|None\)' "$1" && echo "$1 has incorrect AutoScaleMode!" diff --git a/devtools/i18ncheck/i18ncheck-file.sh b/devtools/i18ncheck/i18ncheck-file.sh deleted file mode 100644 index e692c8fa7..000000000 --- a/devtools/i18ncheck/i18ncheck-file.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh - -# Copyright (c) Citrix Systems, Inc. -# All rights reserved. -# -# Redistribution and use in source and binary forms, -# with or without modification, are permitted provided -# that the following conditions are met: -# -# * Redistributions of source code must retain the above -# copyright notice, this list of conditions and the -# following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the -# following disclaimer in the documentation and/or other -# materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND -# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. - -set -eu - -grep -q '\.Text = "' "$1" && echo "$1 is uninternationalized!" diff --git a/devtools/i18ncheck/i18ncheck.sh b/devtools/i18ncheck/i18ncheck.sh deleted file mode 100644 index 96fa10dc3..000000000 --- a/devtools/i18ncheck/i18ncheck.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/bash - -# Copyright (c) Citrix Systems, Inc. -# All rights reserved. -# -# Redistribution and use in source and binary forms, -# with or without modification, are permitted provided -# that the following conditions are met: -# -# * Redistributions of source code must retain the above -# copyright notice, this list of conditions and the -# following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the -# following disclaimer in the documentation and/or other -# materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND -# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. - -set -eu - -dir="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -src="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )/../../XenAdmin" && pwd )" -if [ ! -d "${src}" ]; then - echo Failed to locate XenAdmin - exit 1 -fi - -output=$(/usr/bin/find "$src" -name \*esigner.cs -exec sh "$dir/i18ncheck-file.sh" \{\} \;) - -echo -n "$output" | sed -e "s,$src/,,g" | sed -e 's,.Designer.cs,,gi' | sed -e 's,/,.,g' -test -z "$output" || { echo; exit 1; } - -output=$(/usr/bin/find "$src" -name \*esigner.cs -exec sh "$dir/autoscalemode-file.sh" \{\} \;) - -echo -n "$output" | sed -e "s,$src/,,g" | sed -e 's,.Designer.cs,,gi' | sed -e 's,/,.,g' -test -z "$output" || { echo; exit 1; } - -output=$(/usr/bin/find "$src" -name \*.cs -a \! -name \*esigner.cs -exec sh "$dir/stringcheck-file.sh" \{\} \; ) - -echo -n "$output" | sed -e "s,$src/,,g" -test -z "$output" || { echo; exit 1; } diff --git a/devtools/i18ncheck/stringcheck-file.sh b/devtools/i18ncheck/stringcheck-file.sh deleted file mode 100644 index 5fcc5e299..000000000 --- a/devtools/i18ncheck/stringcheck-file.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh - -# Copyright (c) Citrix Systems, Inc. -# All rights reserved. -# -# Redistribution and use in source and binary forms, -# with or without modification, are permitted provided -# that the following conditions are met: -# -# * Redistributions of source code must retain the above -# copyright notice, this list of conditions and the -# following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the -# following disclaimer in the documentation and/or other -# materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND -# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. - -set -eu - -grep -q 'DrawString(\"' "$1" && echo "$1 has hardcoded strings!" diff --git a/devtools/spellcheck/invalidWords.txt b/devtools/spellcheck/invalidWords.txt deleted file mode 100644 index fc64e07a1..000000000 --- a/devtools/spellcheck/invalidWords.txt +++ /dev/null @@ -1,60 +0,0 @@ -activiat -activiation -appropiate -availible -availilbe -availble -cusomize -debain -defintion -deleteing -dependan -dependance -destory -equalogic -extactly -futher -heath -inteval -maintainance -maintainence -maintanence -maintenence -managment -mulitple -neccessary -numberic -occured -organis -organisation -performace -pervious -prefered -proirity -recieved -recived -reciev -reciv -remeber -repositary -seach -seperat -seperatly -licenseversion -tsevero -shrotcut -I've created a shrotcut to my file -sotre -stroage -strorage -suceed -sucess -succesful -updateing -whilst -this is not an appropiate spelling -whilst -I've lost my licence behind the sofa -licence -I've lost my licences under the fish tank -licences diff --git a/devtools/spellcheck/spellcheck-brand-file.sh b/devtools/spellcheck/spellcheck-brand-file.sh deleted file mode 100644 index b360ca6ce..000000000 --- a/devtools/spellcheck/spellcheck-brand-file.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh - -# Copyright (c) Citrix Systems, Inc. -# All rights reserved. -# -# Redistribution and use in source and binary forms, -# with or without modification, are permitted provided -# that the following conditions are met: -# -# * Redistributions of source code must retain the above -# copyright notice, this list of conditions and the -# following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the -# following disclaimer in the documentation and/or other -# materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND -# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. - -set -eu - -WORDS="[^[\/"]XenCenter\|XenCenter[[:space:]][^p].*\|.*[[:space:]]XenCenter\|XenCenter[,].*\|^XenCenter\|XenCenter$\|[^[\/"]XenServer\|XenServer[[:space:]][^p].*\|XenServer[,].*\|^XenServer\|XenServer$\|[^[\/]Citrix\|.*[[:space:]]Citrix\|Citrix[,].*\|^Citrix\|Citrix$" - -FOUND_TYPO=$(grep -iow $WORDS $1) -if [ "${FOUND_TYPO}" != "" ] -then - echo "$1 contains $FOUND_TYPO" -fi diff --git a/devtools/spellcheck/spellcheck-file.sh b/devtools/spellcheck/spellcheck-file.sh deleted file mode 100644 index 3fbcf1dea..000000000 --- a/devtools/spellcheck/spellcheck-file.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/sh - -# Copyright (c) Citrix Systems, Inc. -# All rights reserved. -# -# Redistribution and use in source and binary forms, -# with or without modification, are permitted provided -# that the following conditions are met: -# -# * Redistributions of source code must retain the above -# copyright notice, this list of conditions and the -# following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the -# following disclaimer in the documentation and/or other -# materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND -# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. - -set -eu - -WORDS="activiat.*\|appropiate\|availible\|availilbe\|availble\|cusomize\|debain\|defintion\|deleteing\|dependan.*\|destory\|equalogic\|extactly\|futher\|heath\|inteval\|maintainance\|maintainence\|maintanence\|maintenence\|managment\|mulitple\|neccessary\|numberic\|occured\|organis.*\|performace\|pervious\|prefered\|proirity\|reciev.*\|reciv.*\|remeber\|repositary\|seach\|seperat.*\|.*[^r]sever[^aei].*\|shrotcut\|sotre\|stroage\|strorage\|suceed.*\|sucess\|succesful\|updateing\|whilst\|wish\|licence[s]\?" - -FOUND_TYPO=$(grep -iow $WORDS $1) -if [ "${FOUND_TYPO}" != "" ] -then - echo "$1 contains $FOUND_TYPO" -fi - -for w in "operation system" "goto " "TODO[: ]*[rR]emove -" -do - grep -qi "$w" "$1" && echo "$1 contains $w" -done diff --git a/devtools/spellcheck/spellcheck.sh b/devtools/spellcheck/spellcheck.sh deleted file mode 100755 index 1aef6bea5..000000000 --- a/devtools/spellcheck/spellcheck.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash - -# Copyright (c) Citrix Systems, Inc. -# All rights reserved. -# -# Redistribution and use in source and binary forms, -# with or without modification, are permitted provided -# that the following conditions are met: -# -# * Redistributions of source code must retain the above -# copyright notice, this list of conditions and the -# following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the -# following disclaimer in the documentation and/or other -# materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND -# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. - -set -eu - -echo "INFO: spellcheck" - -dir="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -src="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )/../.." && pwd )" - -output=$(/usr/bin/find "$src/XenAdmin" "$src/XenModel" "$src/XenOvfApi" "$src/XenOvfTransport" \( -name \*.cs -o -name \*.resx \) -exec sh "$dir/spellcheck-file.sh" \{\} \;) - -output_brand=$(/usr/bin/find "$src/XenAdmin" "$src/XenModel" "$src/XenOvfApi" "$src/XenOvfTransport" \( -name \*.resx \) -exec sh "$dir/spellcheck-brand-file.sh" \{\} \;) - -echo "$output" | sed -e "s,$src/,,g" - -echo "$output_brand" | sed -e "s,$src/,,g" - -test -z "$output" - -test -z "$output_brand" diff --git a/devtools/spellcheck/test_spell_checker.sh b/devtools/spellcheck/test_spell_checker.sh deleted file mode 100644 index 10cdc9090..000000000 --- a/devtools/spellcheck/test_spell_checker.sh +++ /dev/null @@ -1,85 +0,0 @@ -#!/bin/bash - -# Copyright (c) Citrix Systems, Inc. -# All rights reserved. -# -# Redistribution and use in source and binary forms, -# with or without modification, are permitted provided -# that the following conditions are met: -# -# * Redistributions of source code must retain the above -# copyright notice, this list of conditions and the -# following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the -# following disclaimer in the documentation and/or other -# materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND -# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. - -# -# Run this script to check the spellchecker script -# -SCRIPT=$PWD/spellcheck-file.sh -INVALID_WORDS_FILE=$PWD/invalidWords.txt -VALID_WORDS_FILE=$PWD/validWords.txt - -INVALID_WORDS_COUNT_CALCULATED=`$SCRIPT $INVALID_WORDS_FILE | wc -l` -INVALID_WORDS_COUNT=`cat $INVALID_WORDS_FILE | wc -l` - -VALID_WORDS_COUNT_CALCULATED=`$SCRIPT $VALID_WORDS_FILE | wc -l` -VALID_WORDS_COUNT=`cat $VALID_WORDS_FILE | wc -l` - -TESTS_FAILED=false - -## Test 1, invalid words - enter words that should fail here -echo Test 1: Checking invalid words file...... -echo ========================================== -if [ $INVALID_WORDS_COUNT -ne $INVALID_WORDS_COUNT_CALCULATED ] ; then - echo "***** FAILURE *****" - echo Invalid words in file are: $INVALID_WORDS_COUNT - echo Invalid words from the spellchecking script: $INVALID_WORDS_COUNT_CALCULATED - # Write out calculated invalid words - helpful for debugging an errors - #$SCRIPT $INVALID_WORDS_FILE | tr ' ' '\n' | sed '1,2d' > calcluatedInvalidWords.txt - TESTS_FAILED=true -else - echo Invalid words file passed: AOK -fi - -echo - -## Test 2, valid words - enter words that should pass into here -echo Test 2: Checking valid words file...... -echo ========================================== -if [ $VALID_WORDS_COUNT_CALCULATED -ne "0" ] ; then - echo "***** FAILURE *****" - echo Valid words in file are: $VALID_WORDS_COUNT - echo Valid words from the spellchecking script: $VALID_WORDS_COUNT_CALCULATED - TESTS_FAILED=true -else - echo Valid words file passed: AOK -fi - -echo - -##Report any failures -if $TESTS_FAILED ; then - echo "***** Tests have FAILED *****" - exit 1 -else - echo Tests passed: AOK - exit 0 -fi diff --git a/devtools/spellcheck/validWords.txt b/devtools/spellcheck/validWords.txt deleted file mode 100644 index d804921b8..000000000 --- a/devtools/spellcheck/validWords.txt +++ /dev/null @@ -1,11 +0,0 @@ -while -while shepherds -licenses -My licenses are great -licensing -licensed -license -LICENCE_LATER_MESSAGE -liverseversrm -LATER_LICENCE_MESSAGE -LATER_MESSAGE_LICENCE \ No newline at end of file diff --git a/packages/DOTNET_BUILD_LOCATION b/packages/DOTNET_BUILD_LOCATION index 1555f6f0c..a25155b3f 100644 --- a/packages/DOTNET_BUILD_LOCATION +++ b/packages/DOTNET_BUILD_LOCATION @@ -1 +1 @@ -xc-local-release/dotnet-packages/master/30 +xc-local-release/dotnet-packages/master/31 diff --git a/scripts/check_copyright.ps1 b/scripts/check_copyright.ps1 new file mode 100644 index 000000000..8cb96034c --- /dev/null +++ b/scripts/check_copyright.ps1 @@ -0,0 +1,60 @@ +# Copyright (c) Citrix Systems, Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, +# with or without modification, are permitted provided +# that the following conditions are met: +# +# * Redistributions of source code must retain the above +# copyright notice, this list of conditions and the +# following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the +# following disclaimer in the documentation and/or other +# materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +Param( + [Parameter(HelpMessage = "Whether to list the names of the examined files")] + [switch]$NOISY +) + +Write-Output "Started copyright check at $(Get-Date)" + +$INCLUDES = @("*.cs", "*.sh", "*.wxs", "*.wxi", "*.wxl", "*.patch") +$EXCLUDES = @("*.Designer.cs") + +$REPO = Get-Item "$PSScriptRoot\.." | Select-Object -ExpandProperty FullName +$files = Get-ChildItem -Recurse -File -Path $REPO -Include $INCLUDES -Exclude $EXCLUDES + +[System.Collections.ArrayList]$badFiles = @() + +foreach ($file in $files) { + if ($NOISY) { + Write-Output "Copyright check on $file" + } + + $result = Select-String -Path $file -Pattern 'Copyright (c) Citrix Systems, Inc.' -CaseSensitive -SimpleMatch + if ($null -eq $result) { + $badFiles.Add($file) > $null + } +} + +$badFiles | Select-Object FullName | Write-Output + +Write-Output "Finished copyright check at $(Get-Date)" +exit $badFiles.Count diff --git a/scripts/check_i18n.ps1 b/scripts/check_i18n.ps1 new file mode 100644 index 000000000..699bcd3c9 --- /dev/null +++ b/scripts/check_i18n.ps1 @@ -0,0 +1,86 @@ +# Copyright (c) Citrix Systems, Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, +# with or without modification, are permitted provided +# that the following conditions are met: +# +# * Redistributions of source code must retain the above +# copyright notice, this list of conditions and the +# following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the +# following disclaimer in the documentation and/or other +# materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +#Requires -Version 3.0 + +Param( + [Parameter(HelpMessage = "Whether to list the names of the examined files")] + [switch]$NOISY +) + +Write-Host "Started i18n check at $(Get-Date)" + +$INCLUDES = @("*.cs") +$EXCLUDES = @("*\Debug\*", "*\Release\*") + +$REPO = Get-Item "$PSScriptRoot\.." | Select-Object -ExpandProperty FullName +$files = Get-ChildItem -Recurse -File -Path $REPO -Include $INCLUDES -Exclude $EXCLUDES + +$designerFiles = $files | Where-Object { $_.Name -like "*.Designer.cs" } +$codeFiles = $files | Where-Object { $_.Name -notlike "*.Designer.cs" } + +[System.Collections.Hashtable]$badFiles = @{ } + +foreach ($file in $designerFiles) { + if ($NOISY) { + Write-Host "i18n check on $file" + } + + $result = Select-String -Path $file -Pattern 'AutoScaleMode.Font' -CaseSensitive -SimpleMatch + if ($null -ne $result) { + $badFiles[$file]="AutoScaleMode.Font" + } + + $result = Select-String -Path $file -Pattern 'AutoScaleMode.None' -CaseSensitive -SimpleMatch + if ($null -ne $result) { + $badFiles[$file]="AutoScaleMode.Dpi" + } + + $result = Select-String -Path $file -Pattern '.Text = "' -CaseSensitive -SimpleMatch + if ($null -ne $result) { + $badFiles[$file]="Uninternationalised Text" + } +} + +foreach ($file in $codeFiles) { + if ($NOISY) { + Write-Host "i18n check on $file" + } + + $result = Select-String -Path $file -Pattern 'DrawString("' -CaseSensitive -SimpleMatch + if ($null -ne $result) { + $badFiles[$file]="Hardcoded DrawString" + } +} + +$badFiles| ForEach-Object GetEnumerator | ForEach-Object {$_.key.FullName, $_.value } + +Write-Host "Finished i18n check at $(Get-Date)" +exit $badFiles.Count diff --git a/scripts/check_spelling.ps1 b/scripts/check_spelling.ps1 new file mode 100644 index 000000000..b9f90e2f3 --- /dev/null +++ b/scripts/check_spelling.ps1 @@ -0,0 +1,76 @@ +# Copyright (c) Citrix Systems, Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, +# with or without modification, are permitted provided +# that the following conditions are met: +# +# * Redistributions of source code must retain the above +# copyright notice, this list of conditions and the +# following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the +# following disclaimer in the documentation and/or other +# materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +Param( + [Parameter(HelpMessage = "Whether to list the names of the examined files")] + [switch]$NOISY +) + +$ErrorActionPreference = "Stop" + +Write-Host "Started spell check at $(Get-Date)" + +$INCLUDES = @("*.resx") +$EXCLUDES = @("*.ja.resx", "*.zh-CN.resx") + +$REPO = Get-Item "$PSScriptRoot\.." | Select-Object -ExpandProperty FullName +$files = Get-ChildItem -Recurse -File -Path $REPO -Include $INCLUDES -Exclude $EXCLUDES + +foreach ($file in $files) { + if ($file.Name -in @("InvisibleMessages.resx", "KeyMap.resx", "Resources.resx", "Branding.resx")) { + Write-Host "Skipping $file" + continue + } + + if ($NOISY) { + Write-Host "Spell check on $file" + } + + [xml]$xml = Get-Content $file + + $found = @() + $found = Select-Xml -Xml $xml -XPath "//data" |` + Select-Object -ExpandProperty node |` + Where-Object { ($_.name -like "*Text") -or ($_.name -cmatch '^[A-Z_]*$') } |` + Select-Object -ExpandProperty Value |` + Where-Object { $_.GetType() -eq [System.String] } |` + Foreach-Object { $_.Replace("&", "").Replace("'", "").Replace("\n", " ") } |` + aspell --add-wordlists="$PSScriptRoot\dictionary.txt" --list + + if ($found.Count -gt 0) { + if (-not $NOISY) { + Write-Warning "Found typos in $file" + } + $found | Sort-Object | Get-Unique + } +} + +#Remove-Item $customDic +Write-Host "Finished spell check at $(Get-Date)" diff --git a/mk/deps-map.json b/scripts/deps-map.json similarity index 89% rename from mk/deps-map.json rename to scripts/deps-map.json index fe40d94b0..071e6e4f5 100644 --- a/mk/deps-map.json +++ b/scripts/deps-map.json @@ -45,6 +45,11 @@ "target": "xenadmin.git/packages/", "flat": "true" }, + { + "pattern": "@REMOTE_DOTNET@/SOURCES/dotnet-packages-sources.zip", + "target": "xenadmin.git/packages/", + "flat": "true" + }, { "pattern": "xs-local-contrib/citrix/xencenter/XenCenterOVF.zip", "target": "xenadmin.git/packages/", diff --git a/scripts/dictionary.txt b/scripts/dictionary.txt new file mode 100644 index 000000000..dfcf63d88 --- /dev/null +++ b/scripts/dictionary.txt @@ -0,0 +1,131 @@ +Asianux +CentOS +CIFS +Citrix +CLI +CoreOS +CPU +CPUs +CSLG +CVM +DAS +decrypt +Decrypting +deserialize +DHCP +DMC +DNS +DRAC +EqualLogic +failback +Failback +failover +Failover +FCoE +Fixup +fixup +GFS +GPU +GPUs +HBA +hotfix +hotfixes +Hotfix +Hotfixes +HVM +HyperV +hypervisor +Hypervisor +IGMP +IntelliCache +IOMMU +IOV +IQN +IQNs +iSCSI +ISO +ISOs +lifecycle +loopback +LACP +Linux +LUN +LUNs +LVM +MTU +multipath +multipathing +NAS +NetApp +NFS +NIC +NICs +Nutanix +NVIDIA +OCFS +OEM +OVA +OVF +Paravirtualization +paravirtualized +PBD +PBDs +PCI +PIF +PIFs +PowerShell +pre +PuTTY +PV +PVS +QoS +Quiesce +Quiesced +quiesced +RBAC +RPU +RRD +scalable +SDK +SMB +SMTP +SR +SRs +SSL +StorageLink +tapdisk +TLS +toolstack +Toolstack +UEFI +vApp +vApps +VBD +VBDs +vCPU +vCPUs +VDI +VDIs +vGPU +vGPUs +VIF +VIFs +virtualized +VLAN +VLANs +VM +VMDK +VMs +VMware +VSS +vSwitch +WIM +WLB +XAPI +XenApp +XenAppliance +XenCenter +XenDesktop +XenMotion +XenServer +XVA diff --git a/mk/download_hotfixes.ps1 b/scripts/download_hotfixes.ps1 similarity index 73% rename from mk/download_hotfixes.ps1 rename to scripts/download_hotfixes.ps1 index 542d5e95f..d50eb6d61 100644 --- a/mk/download_hotfixes.ps1 +++ b/scripts/download_hotfixes.ps1 @@ -34,43 +34,43 @@ #Requires -Version 3.0 Param( - [Parameter(Mandatory=$true, HelpMessage ="Artifactory domain (e.g. artifactory.domain.com)")] + [Parameter(Mandatory = $true, HelpMessage = "Artifactory domain (e.g. artifactory.domain.com)")] [String]$DOMAIN, - [Parameter(HelpMessage ="Whether to download source packages")] + [Parameter(HelpMessage = "Whether to download source packages")] [switch]$SOURCES ) $DOMAIN = $DOMAIN.Trim() -$MK_DIR = Get-Item "$PSScriptRoot\..\mk" | select -ExpandProperty FullName +$SCRIPT_DIR = Get-Item "$PSScriptRoot\" | select -ExpandProperty FullName $HOTFIX_DIR = "$PSScriptRoot\..\Branding\Hotfixes" if (-not (Test-Path $HOTFIX_DIR)) { - $HOTFIX_DIR = New-Item $HOTFIX_DIR -ItemType Directory | select -ExpandProperty FullName + $HOTFIX_DIR = New-Item $HOTFIX_DIR -ItemType Directory | select -ExpandProperty FullName } -$HOTFIX_MAP = Get-Content "$MK_DIR\hotfix-map.json" | ConvertFrom-Json +$HOTFIX_MAP = Get-Content "$SCRIPT_DIR\hotfix-map.json" | ConvertFrom-Json -foreach($dep in $HOTFIX_MAP.files) { +foreach ($dep in $HOTFIX_MAP.files) { $pattern = "https://$DOMAIN/" + $dep.pattern $filename = Split-Path $pattern -leaf - $download=$false + $download = $false if ($filename -like "*.xsupdate") { - $download = $true + $download = $true } elseif ($filename -like "*-sources.iso") { - $download = $SOURCES + $download = $SOURCES } elseif ($filename -like "*.iso") { - $download = $true + $download = $true } - elseif ($filename -like "*-src-pkgs.tar") { - $download = $SOURCES + elseif ($filename -like "*-src-pkgs.tar") { + $download = $SOURCES } if ($download) { - Invoke-WebRequest -Uri $pattern -Method Get -OutFile "$HOTFIX_DIR\$filename" + Invoke-WebRequest -Uri $pattern -Method Get -OutFile "$HOTFIX_DIR\$filename" } } diff --git a/packages/download_packages.ps1 b/scripts/download_packages.ps1 similarity index 65% rename from packages/download_packages.ps1 rename to scripts/download_packages.ps1 index 457b94ed7..9e5f68337 100644 --- a/packages/download_packages.ps1 +++ b/scripts/download_packages.ps1 @@ -34,34 +34,39 @@ #Requires -Version 3.0 Param( - [Parameter(Mandatory=$true, HelpMessage ="Artifactory domain (e.g. artifactory.domain.com)")] + [Parameter(Mandatory = $true, HelpMessage = "Artifactory domain (e.g. artifactory.domain.com)")] [String]$DOMAIN, - [Parameter(HelpMessage ="Whether to download symbols (*.pdb files)")] - [switch]$SYMBOLS + [Parameter(HelpMessage = "Whether to download symbols (*.pdb files)")] + [switch]$SYMBOLS, + + [Parameter(HelpMessage = "Whether to download all packages needed to build the installer")] + [switch]$ZIP ) $DOMAIN = $DOMAIN.Trim() -$PACKAGE_DIR = Get-Item "$PSScriptRoot" | select -ExpandProperty FullName -$MK_DIR = Get-Item "$PSScriptRoot\..\mk" | select -ExpandProperty FullName +$SCRIPT_DIR = Get-Item "$PSScriptRoot\" | select -ExpandProperty FullName +$PACKAGE_DIR = Get-Item "$PSScriptRoot\..\packages" | select -ExpandProperty FullName #dotnet packages $BUILD_LOCATION = (Get-Content "$PACKAGE_DIR\DOTNET_BUILD_LOCATION").Trim() -$DEPS_MAP = Get-Content "$MK_DIR\deps-map.json" ` - | foreach {$_ -replace '@REMOTE_DOTNET@',"$BUILD_LOCATION"} ` - | ConvertFrom-Json +$DEPS_MAP = Get-Content "$SCRIPT_DIR\deps-map.json" |` + foreach { $_ -replace '@REMOTE_DOTNET@', "$BUILD_LOCATION" } |` + ConvertFrom-Json -foreach($dep in $DEPS_MAP.files) { +foreach ($dep in $DEPS_MAP.files) { $pattern = "https://$DOMAIN/" + $dep.pattern $filename = Split-Path $pattern -leaf - if (($filename -eq "putty.exe") -or ($filename -like "*.dll")) { - Invoke-WebRequest -Uri $pattern -Method Get -OutFile "$PACKAGE_DIR\$filename" + if (($filename -like "*.dll") -and $SYMBOLS) { + $symbolfile = [IO.Path]::GetFileNameWithoutExtension($filename) + ".pdb" + Write-Output "Downloading $symbolfile" + Invoke-WebRequest -Uri $pattern -Method Get -OutFile "$PACKAGE_DIR\$symbolfile" + } - if ($SYMBOLS) { - $symbolfile = [IO.Path]::GetFileNameWithoutExtension($filename) + ".pdb" - Invoke-WebRequest -Uri $pattern -Method Get -OutFile "$PACKAGE_DIR\$symbolfile" - } + if (($filename -eq "putty.exe") -or ($filename -like "*.dll") -or (($filename -like "*.zip") -and $ZIP)) { + Write-Output "Downloading $filename" + Invoke-WebRequest -Uri $pattern -Method Get -OutFile "$PACKAGE_DIR\$filename" } } diff --git a/mk/hotfix-map.json b/scripts/hotfix-map.json similarity index 100% rename from mk/hotfix-map.json rename to scripts/hotfix-map.json diff --git a/mk/re-branding.sh b/scripts/re-branding.sh old mode 100755 new mode 100644 similarity index 100% rename from mk/re-branding.sh rename to scripts/re-branding.sh diff --git a/mk/sign.bat b/scripts/sign.bat similarity index 84% rename from mk/sign.bat rename to scripts/sign.bat index 7ea1fa23c..2ee9480e4 100644 --- a/mk/sign.bat +++ b/scripts/sign.bat @@ -52,9 +52,9 @@ set descr=%~8 set thefile=%~7 if /I "%~x7"==".msi" ( - set cross_sign=no + set is_msi=yes ) else ( - set cross_sign=yes + set is_msi=no ) set CTXSIGN=C:\ctxsign2\ctxsign.exe @@ -76,24 +76,27 @@ if "%sbe%"=="true" ( set /p CCSS_TICKET= < out.txt - echo %CTXSIGN% --sign --key XenServer.NET_KEY --cross-sign --pagehashes yes --type Authenticode ^ - --description "%descr%" "%thefile%" + if "%is_msi%"=="no" ( + echo %CTXSIGN% --sign --key XenServer.NET_KEY --cross-sign --pagehashes yes --type Authenticode ^ + --description "%descr%" "%thefile%" - date /t && time /t - %CTXSIGN% --sign --key XenServer.NET_KEY --cross-sign --pagehashes yes --type Authenticode ^ - --description "%descr%" "%thefile%" + date /t && time /t + %CTXSIGN% --sign --key XenServer.NET_KEY --cross-sign --pagehashes yes --type Authenticode ^ + --description "%descr%" "%thefile%" - if "%cross_sign%"=="yes" ( date /t && time /t %CTXSIGN% --sign --authenticode-append --authenticode-SHA256 --key XenServerSHA256.NET_KEY ^ --cross-sign --pagehashes yes "%thefile%" + ) else ( + %CTXSIGN% --sign --key XenServerSHA256.NET_KEY --pagehashes yes --type Authenticode ^ + --description "%descr%" "%thefile%" ) %CTXSIGN% --end ) else ( echo "Self signing" - if /I "%cross_sign%" == "yes" ( + if /I "%is_msi%" == "no" ( signtool sign -v -sm -sha1 %thumb_sha1% -d "%descr%" -t %timestamp_server% "%thefile%" signtool sign -v -sm -as -sha1 %thumb_sha256% -d "%descr%" -tr %timestamp_server% -td sha256 "%thefile%" ) else ( diff --git a/mk/xenadmin-build.sh b/scripts/xenadmin-build.sh old mode 100755 new mode 100644 similarity index 93% rename from mk/xenadmin-build.sh rename to scripts/xenadmin-build.sh index 519a41cfc..ca971b6e3 --- a/mk/xenadmin-build.sh +++ b/scripts/xenadmin-build.sh @@ -65,18 +65,22 @@ mkdir_clean ${SCRATCH_DIR} mkdir_clean ${OUTPUT_DIR} source ${REPO}/Branding/branding.sh -source ${REPO}/mk/re-branding.sh $1 +source ${REPO}/scripts/re-branding.sh $1 #packages sources +mkdir_clean ${SCRATCH_DIR}/SOURCES cd ${REPO} gitCommit=`git rev-parse HEAD` -git archive --format=zip -o "_output/${BRANDING_BRAND_CONSOLE}-sources.zip" ${gitCommit} +git archive --format=zip -o "_scratch/SOURCES/xenadmin-sources.zip" ${gitCommit} +cp ${REPO}/packages/dotnet-packages-sources.zip ${SCRATCH_DIR}/SOURCES +cd ${SCRATCH_DIR}/SOURCES && zip ${BRANDING_BRAND_CONSOLE}-source.zip dotnet-packages-sources.zip xenadmin-sources.zip +cp ${SCRATCH_DIR}/SOURCES/${BRANDING_BRAND_CONSOLE}-source.zip ${OUTPUT_DIR}/${BRANDING_BRAND_CONSOLE}-source.zip ${UNZIP} -d ${SCRATCH_DIR} ${REPO}/packages/XenCenterOVF.zip cd ${REPO} && "${MSBUILD}" ${SWITCHES} XenAdmin.sln #sign files only if all parameters are set and non-empty -SIGN_BAT="${REPO}/mk/sign.bat ${GLOBAL_BUILD_NUMBER} $2 $3 $4 $5 $6" +SIGN_BAT="${REPO}/scripts/sign.bat ${GLOBAL_BUILD_NUMBER} $2 $3 $4 $5 $6" SIGN_DESCR="${BRANDING_COMPANY_NAME_SHORT} ${BRANDING_BRAND_CONSOLE}" if [ -z "$2" ] || [ -z "$3" ] || [ -z "$4" ] || [ -z "$5" ] || [ -z "$6" ] ; then