From d488860045fa57d480da5682878cff8eb9ab5f41 Mon Sep 17 00:00:00 2001 From: Cheng Zhang Date: Sun, 15 Feb 2015 10:52:12 +0800 Subject: [PATCH] CP-10925: Add Docker-specific information 1.Add Docker information in General Tab 2.Add Docker version in General Tab Signed-off-by: Cheng Zhang --- XenAdmin/TabPages/GeneralTabPage.Designer.cs | 40 +++ XenAdmin/TabPages/GeneralTabPage.cs | 63 ++++ XenAdmin/TabPages/GeneralTabPage.ja.resx | 133 +++++++ XenAdmin/TabPages/GeneralTabPage.resx | 133 +++++++ XenAdmin/TabPages/GeneralTabPage.zh-CN.resx | 133 +++++++ XenAdmin/XenAdmin.csproj | 3 +- XenModel/Messages.Designer.cs | 198 ++++++++++ XenModel/Messages.ja.resx | 66 ++++ XenModel/Messages.resx | 66 ++++ XenModel/Messages.zh-CN.resx | 66 ++++ XenModel/XenAPI-Extensions/VM.cs | 25 ++ XenModel/XenAPI-Extensions/VM_Docker_Info.cs | 338 ++++++++++++++++++ .../XenAPI-Extensions/VM_Docker_Version.cs | 121 +++++++ XenModel/XenModel.csproj | 2 + 14 files changed, 1386 insertions(+), 1 deletion(-) create mode 100755 XenModel/XenAPI-Extensions/VM_Docker_Info.cs create mode 100755 XenModel/XenAPI-Extensions/VM_Docker_Version.cs diff --git a/XenAdmin/TabPages/GeneralTabPage.Designer.cs b/XenAdmin/TabPages/GeneralTabPage.Designer.cs index 28c31da18..5d3ba4eb7 100644 --- a/XenAdmin/TabPages/GeneralTabPage.Designer.cs +++ b/XenAdmin/TabPages/GeneralTabPage.Designer.cs @@ -36,6 +36,8 @@ namespace XenAdmin.TabPages this.linkLabelExpand = new System.Windows.Forms.LinkLabel(); this.linkLabelCollapse = new System.Windows.Forms.LinkLabel(); this.panel2 = new XenAdmin.Controls.PanelNoFocusScroll(); + this.panelDockerInfo = new System.Windows.Forms.Panel(); + this.pdSectionDockerInfo = new XenAdmin.Controls.PDSection(); this.panelStorageLinkSystemCapabilities = new System.Windows.Forms.Panel(); this.pdSectionStorageLinkSystemCapabilities = new XenAdmin.Controls.PDSection(); this.panelMultipathBoot = new System.Windows.Forms.Panel(); @@ -68,10 +70,13 @@ namespace XenAdmin.TabPages this.pdSectionCustomFields = new XenAdmin.Controls.PDSection(); this.panelGeneral = new System.Windows.Forms.Panel(); this.pdSectionGeneral = new XenAdmin.Controls.PDSection(); + this.panelDockerVersion = new System.Windows.Forms.Panel(); + this.pdSectionDockerVersion = new XenAdmin.Controls.PDSection(); this.pageContainerPanel.SuspendLayout(); this.panel1.SuspendLayout(); this.panel3.SuspendLayout(); this.panel2.SuspendLayout(); + this.panelDockerInfo.SuspendLayout(); this.panelStorageLinkSystemCapabilities.SuspendLayout(); this.panelMultipathBoot.SuspendLayout(); this.panelStorageLink.SuspendLayout(); @@ -88,6 +93,7 @@ namespace XenAdmin.TabPages this.panelManagementInterfaces.SuspendLayout(); this.panelCustomFields.SuspendLayout(); this.panelGeneral.SuspendLayout(); + this.panelDockerVersion.SuspendLayout(); this.SuspendLayout(); // // pageContainerPanel @@ -134,6 +140,8 @@ namespace XenAdmin.TabPages // panel2 // resources.ApplyResources(this.panel2, "panel2"); + this.panel2.Controls.Add(this.panelDockerInfo); + this.panel2.Controls.Add(this.panelDockerVersion); this.panel2.Controls.Add(this.panelStorageLinkSystemCapabilities); this.panel2.Controls.Add(this.panelMultipathBoot); this.panel2.Controls.Add(this.panelStorageLink); @@ -152,6 +160,19 @@ namespace XenAdmin.TabPages this.panel2.Controls.Add(this.panelGeneral); this.panel2.Name = "panel2"; // + // panelDockerInfo + // + resources.ApplyResources(this.panelDockerInfo, "panelDockerInfo"); + this.panelDockerInfo.Controls.Add(this.pdSectionDockerInfo); + this.panelDockerInfo.Name = "panelDockerInfo"; + // + // pdSectionDockerInfo + // + this.pdSectionDockerInfo.BackColor = System.Drawing.Color.Gainsboro; + resources.ApplyResources(this.pdSectionDockerInfo, "pdSectionDockerInfo"); + this.pdSectionDockerInfo.Name = "pdSectionDockerInfo"; + this.pdSectionDockerInfo.ShowCellToolTips = false; + // // panelStorageLinkSystemCapabilities // resources.ApplyResources(this.panelStorageLinkSystemCapabilities, "panelStorageLinkSystemCapabilities"); @@ -374,6 +395,19 @@ namespace XenAdmin.TabPages this.pdSectionGeneral.ShowCellToolTips = false; this.pdSectionGeneral.ExpandedChanged += new System.Action(this.s_ExpandedEventHandler); // + // panelDockerVersion + // + resources.ApplyResources(this.panelDockerVersion, "panelDockerVersion"); + this.panelDockerVersion.Controls.Add(this.pdSectionDockerVersion); + this.panelDockerVersion.Name = "panelDockerVersion"; + // + // pdSectionDockerVersion + // + this.pdSectionDockerVersion.BackColor = System.Drawing.Color.Gainsboro; + resources.ApplyResources(this.pdSectionDockerVersion, "pdSectionDockerVersion"); + this.pdSectionDockerVersion.Name = "pdSectionDockerVersion"; + this.pdSectionDockerVersion.ShowCellToolTips = false; + // // GeneralTabPage // resources.ApplyResources(this, "$this"); @@ -386,6 +420,7 @@ namespace XenAdmin.TabPages this.panel3.PerformLayout(); this.panel2.ResumeLayout(false); this.panel2.PerformLayout(); + this.panelDockerInfo.ResumeLayout(false); this.panelStorageLinkSystemCapabilities.ResumeLayout(false); this.panelMultipathBoot.ResumeLayout(false); this.panelStorageLink.ResumeLayout(false); @@ -402,6 +437,7 @@ namespace XenAdmin.TabPages this.panelManagementInterfaces.ResumeLayout(false); this.panelCustomFields.ResumeLayout(false); this.panelGeneral.ResumeLayout(false); + this.panelDockerVersion.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); @@ -447,5 +483,9 @@ namespace XenAdmin.TabPages private XenAdmin.Controls.PDSection pdSectionMultipathBoot; private System.Windows.Forms.Panel panelStorageLinkSystemCapabilities; private XenAdmin.Controls.PDSection pdSectionStorageLinkSystemCapabilities; + private System.Windows.Forms.Panel panelDockerInfo; + private System.Windows.Forms.Panel panelDockerVersion; + private Controls.PDSection pdSectionDockerVersion; + private Controls.PDSection pdSectionDockerInfo; } } diff --git a/XenAdmin/TabPages/GeneralTabPage.cs b/XenAdmin/TabPages/GeneralTabPage.cs index 3c91db5fe..dd15edf80 100644 --- a/XenAdmin/TabPages/GeneralTabPage.cs +++ b/XenAdmin/TabPages/GeneralTabPage.cs @@ -467,6 +467,8 @@ namespace XenAdmin.TabPages generateStorageLinkSystemCapabilitiesBox(); generateMultipathBootBox(); generateVCPUsBox(); + generateDockerInfoBox(); + generateDockerVersionBox(); } // hide all the sections which haven't been populated, those that have make sure are visible @@ -1507,6 +1509,67 @@ namespace XenAdmin.TabPages } + private void addStringEntry(PDSection s, string key, string value) + { + s.AddEntry(key, value.Length != 0 ? value : Messages.NONE); + } + + private void generateDockerInfoBox() + { + VM vm = xenObject as VM; + if (vm == null) + return; + + VM_Docker_Info info = vm.DockerInfo; + if (info == null) + return; + + PDSection s = pdSectionDockerInfo; + addStringEntry(s, Messages.DOCKER_INFO_NGOROUTINES, info.NGoroutines); + addStringEntry(s, Messages.DOCKER_INFO_ROOT_DIR, info.DockerRootDir); + addStringEntry(s, Messages.DOCKER_INFO_DRIVER_STATUS, info.DriverStatus); + addStringEntry(s, Messages.OPERATING_SYSTEM, info.OperatingSystem); ; + addStringEntry(s, Messages.CONTAINER, info.Containers); + addStringEntry(s, Messages.MEMORY, Util.MemorySizeString(Convert.ToDouble(info.MemTotal))); + addStringEntry(s, Messages.DOCKER_INFO_DRIVER, info.Driver); + addStringEntry(s, Messages.DOCKER_INFO_INDEX_SERVER_ADDRESS, info.IndexServerAddress); + addStringEntry(s, Messages.DOCKER_INFO_INITIATE_PATH, info.InitPath); + addStringEntry(s, Messages.DOCKER_INFO_EXECUTION_DRIVER, info.ExecutionDriver); + addStringEntry(s, Messages.NAME, info.Name); + addStringEntry(s, Messages.DOCKER_INFO_NCPU, info.NCPU); + addStringEntry(s, Messages.DOCKER_INFO_DEBUG, info.Debug); + addStringEntry(s, Messages.ID, info.ID); + addStringEntry(s, Messages.DOCKER_INFO_IPV4_FORWARDING, info.IPv4Forwarding); + addStringEntry(s, Messages.DOCKER_INFO_KERNEL_VERSION, info.KernelVersion); + addStringEntry(s, Messages.DOCKER_INFO_NFD, info.NFd); + addStringEntry(s, Messages.DOCKER_INFO_INITIATE_SHA1, info.InitSha1); + addStringEntry(s, Messages.DOCKER_INFO_LABELS, info.Labels); + addStringEntry(s, Messages.DOCKER_INFO_MEMORY_LIMIT, Util.MemorySizeString(Convert.ToDouble(info.MemoryLimit))); + addStringEntry(s, Messages.DOCKER_INFO_SWAP_LIMIT, info.SwapLimit); + addStringEntry(s, Messages.CONTAINER_IMAGE, info.Images); + addStringEntry(s, Messages.DOCKER_INFO_NEVENT_LISTENER, info.NEventsListener); + } + + private void generateDockerVersionBox() + { + VM vm = xenObject as VM; + if (vm == null) + return; + + VM_Docker_Version version = vm.DockerVersion; + if (version == null) + return; + + PDSection s = pdSectionDockerVersion; + addStringEntry(s, Messages.DOCKER_INFO_KERNEL_VERSION, version.KernelVersion); + addStringEntry(s, Messages.DOCKER_INFO_ARCH, version.Arch); + addStringEntry(s, Messages.DOCKER_INFO_API_VERSION, version.ApiVersion); + addStringEntry(s, Messages.DOCKER_INFO_VERSION, version.Version); + addStringEntry(s, Messages.DOCKER_INFO_GIT_COMMIT, version.GitCommit); + addStringEntry(s, Messages.OPERATING_SYSTEM, version.Os); + addStringEntry(s, Messages.DOCKER_INFO_GO_VERSION, version.GoVersion); + } + private bool CPUsIdentical(IEnumerable cpus) { String cpuText = null; diff --git a/XenAdmin/TabPages/GeneralTabPage.ja.resx b/XenAdmin/TabPages/GeneralTabPage.ja.resx index c456c2858..da788d61b 100644 --- a/XenAdmin/TabPages/GeneralTabPage.ja.resx +++ b/XenAdmin/TabPages/GeneralTabPage.ja.resx @@ -1377,6 +1377,139 @@ 0 + + True + + + GrowAndShrink + + + Top + + + 0, 5 + + + 0, 34 + + + 1, 1, 1, 1 + + + Docker Version + + + 729, 34 + + + 0 + + + pdSectionDockerVersion + + + XenAdmin.Controls.PDSection, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + + + panelDockerVersion + + + 0 + + + Top + + + 0, 39 + + + 0, 5, 0, 5 + + + 729, 44 + + + 19 + + + panelDockerVersion + + + System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel2 + + + 16 + + + True + + + GrowAndShrink + + + Top + + + + 0, 5 + + + 0, 34 + + + 1, 1, 1, 1 + + + Docker Information + + + 729, 34 + + + 0 + + + pdSectionDockerInfo + + + XenAdmin.Controls.PDSection, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + + + panelDockerInfo + + + 0 + + + Top + + + 0, 704 + + + 0, 5, 0, 5 + + + 729, 44 + + + 18 + + + panelDockerInfo + + + System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel2 + + + 17 + True diff --git a/XenAdmin/TabPages/GeneralTabPage.resx b/XenAdmin/TabPages/GeneralTabPage.resx index 04987de74..2004860ea 100644 --- a/XenAdmin/TabPages/GeneralTabPage.resx +++ b/XenAdmin/TabPages/GeneralTabPage.resx @@ -1377,6 +1377,139 @@ 0 + + True + + + GrowAndShrink + + + Top + + + 0, 5 + + + 0, 34 + + + 1, 1, 1, 1 + + + Docker Version + + + 729, 34 + + + 0 + + + pdSectionDockerVersion + + + XenAdmin.Controls.PDSection, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + + + panelDockerVersion + + + 0 + + + Top + + + 0, 39 + + + 0, 5, 0, 5 + + + 729, 44 + + + 19 + + + panelDockerVersion + + + System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel2 + + + 16 + + + True + + + GrowAndShrink + + + Top + + + + 0, 5 + + + 0, 34 + + + 1, 1, 1, 1 + + + Docker Information + + + 729, 34 + + + 0 + + + pdSectionDockerInfo + + + XenAdmin.Controls.PDSection, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + + + panelDockerInfo + + + 0 + + + Top + + + 0, 704 + + + 0, 5, 0, 5 + + + 729, 44 + + + 18 + + + panelDockerInfo + + + System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel2 + + + 17 + True diff --git a/XenAdmin/TabPages/GeneralTabPage.zh-CN.resx b/XenAdmin/TabPages/GeneralTabPage.zh-CN.resx index d6b3131c1..7a14a8ae3 100644 --- a/XenAdmin/TabPages/GeneralTabPage.zh-CN.resx +++ b/XenAdmin/TabPages/GeneralTabPage.zh-CN.resx @@ -1377,6 +1377,139 @@ 0 + + True + + + GrowAndShrink + + + Top + + + 0, 5 + + + 0, 34 + + + 1, 1, 1, 1 + + + Docker Version + + + 729, 34 + + + 0 + + + pdSectionDockerVersion + + + XenAdmin.Controls.PDSection, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + + + panelDockerVersion + + + 0 + + + Top + + + 0, 39 + + + 0, 5, 0, 5 + + + 729, 44 + + + 19 + + + panelDockerVersion + + + System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel2 + + + 16 + + + True + + + GrowAndShrink + + + Top + + + + 0, 5 + + + 0, 34 + + + 1, 1, 1, 1 + + + Docker Information + + + 729, 34 + + + 0 + + + pdSectionDockerInfo + + + XenAdmin.Controls.PDSection, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + + + panelDockerInfo + + + 0 + + + Top + + + 0, 704 + + + 0, 5, 0, 5 + + + 729, 44 + + + 18 + + + panelDockerInfo + + + System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + panel2 + + + 17 + True diff --git a/XenAdmin/XenAdmin.csproj b/XenAdmin/XenAdmin.csproj index 2d75937b9..2fc8e7a7d 100644 --- a/XenAdmin/XenAdmin.csproj +++ b/XenAdmin/XenAdmin.csproj @@ -2092,7 +2092,7 @@ DockerProcessPage.cs Designer - + SrStoragePage.cs Designer @@ -5597,6 +5597,7 @@ GeneralTabPage.cs + Designer GpuPage.cs diff --git a/XenModel/Messages.Designer.cs b/XenModel/Messages.Designer.cs index 71c2f5c47..a3baba95d 100644 --- a/XenModel/Messages.Designer.cs +++ b/XenModel/Messages.Designer.cs @@ -10472,6 +10472,204 @@ namespace XenAdmin { } } + /// + /// Looks up a localized string similar to Api Version. + /// + public static string DOCKER_INFO_API_VERSION { + get { + return ResourceManager.GetString("DOCKER_INFO_API_VERSION", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Arch. + /// + public static string DOCKER_INFO_ARCH { + get { + return ResourceManager.GetString("DOCKER_INFO_ARCH", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Debug. + /// + public static string DOCKER_INFO_DEBUG { + get { + return ResourceManager.GetString("DOCKER_INFO_DEBUG", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Driver. + /// + public static string DOCKER_INFO_DRIVER { + get { + return ResourceManager.GetString("DOCKER_INFO_DRIVER", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Driver Status. + /// + public static string DOCKER_INFO_DRIVER_STATUS { + get { + return ResourceManager.GetString("DOCKER_INFO_DRIVER_STATUS", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Execution Driver. + /// + public static string DOCKER_INFO_EXECUTION_DRIVER { + get { + return ResourceManager.GetString("DOCKER_INFO_EXECUTION_DRIVER", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Git Commit. + /// + public static string DOCKER_INFO_GIT_COMMIT { + get { + return ResourceManager.GetString("DOCKER_INFO_GIT_COMMIT", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Go Version. + /// + public static string DOCKER_INFO_GO_VERSION { + get { + return ResourceManager.GetString("DOCKER_INFO_GO_VERSION", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Index Server Address. + /// + public static string DOCKER_INFO_INDEX_SERVER_ADDRESS { + get { + return ResourceManager.GetString("DOCKER_INFO_INDEX_SERVER_ADDRESS", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Initiate Path. + /// + public static string DOCKER_INFO_INITIATE_PATH { + get { + return ResourceManager.GetString("DOCKER_INFO_INITIATE_PATH", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Initiate Sha1. + /// + public static string DOCKER_INFO_INITIATE_SHA1 { + get { + return ResourceManager.GetString("DOCKER_INFO_INITIATE_SHA1", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to IPv4 Forwarding. + /// + public static string DOCKER_INFO_IPV4_FORWARDING { + get { + return ResourceManager.GetString("DOCKER_INFO_IPV4_FORWARDING", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Kernel Version. + /// + public static string DOCKER_INFO_KERNEL_VERSION { + get { + return ResourceManager.GetString("DOCKER_INFO_KERNEL_VERSION", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Labels. + /// + public static string DOCKER_INFO_LABELS { + get { + return ResourceManager.GetString("DOCKER_INFO_LABELS", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Memory Limit. + /// + public static string DOCKER_INFO_MEMORY_LIMIT { + get { + return ResourceManager.GetString("DOCKER_INFO_MEMORY_LIMIT", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to NCPU. + /// + public static string DOCKER_INFO_NCPU { + get { + return ResourceManager.GetString("DOCKER_INFO_NCPU", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to NEvents Listener. + /// + public static string DOCKER_INFO_NEVENT_LISTENER { + get { + return ResourceManager.GetString("DOCKER_INFO_NEVENT_LISTENER", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to NFd. + /// + public static string DOCKER_INFO_NFD { + get { + return ResourceManager.GetString("DOCKER_INFO_NFD", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to NGoroutines. + /// + public static string DOCKER_INFO_NGOROUTINES { + get { + return ResourceManager.GetString("DOCKER_INFO_NGOROUTINES", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Root Directory. + /// + public static string DOCKER_INFO_ROOT_DIR { + get { + return ResourceManager.GetString("DOCKER_INFO_ROOT_DIR", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Swap Limit. + /// + public static string DOCKER_INFO_SWAP_LIMIT { + get { + return ResourceManager.GetString("DOCKER_INFO_SWAP_LIMIT", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Version. + /// + public static string DOCKER_INFO_VERSION { + get { + return ResourceManager.GetString("DOCKER_INFO_VERSION", resourceCulture); + } + } + /// /// Looks up a localized string similar to Docker Processes. /// diff --git a/XenModel/Messages.ja.resx b/XenModel/Messages.ja.resx index b2958ba89..16d2eccf8 100644 --- a/XenModel/Messages.ja.resx +++ b/XenModel/Messages.ja.resx @@ -3646,6 +3646,72 @@ VM {2} をエクスポートしてもよろしいですか? Docker Processes + + Api Version + + + Arch + + + Debug + + + Driver + + + Driver Status + + + Execution Driver + + + Git Commit + + + Go Version + + + Index Server Address + + + Initiate Path + + + Initiate Sha1 + + + IPv4 Forwarding + + + Kernel Version + + + Labels + + + Memory Limit + + + NCPU + + + NEvents Listener + + + NFd + + + NGoroutines + + + Root Directory + + + Swap Limit + + + Version + 完了しました。 diff --git a/XenModel/Messages.resx b/XenModel/Messages.resx index f1af6b207..47c5ebf57 100644 --- a/XenModel/Messages.resx +++ b/XenModel/Messages.resx @@ -3718,6 +3718,72 @@ This will also delete its subfolders. Docker Processes + + Api Version + + + Arch + + + Debug + + + Driver + + + Driver Status + + + Execution Driver + + + Git Commit + + + Go Version + + + Index Server Address + + + Initiate Path + + + Initiate Sha1 + + + IPv4 Forwarding + + + Kernel Version + + + Labels + + + Memory Limit + + + NCPU + + + NEvents Listener + + + NFd + + + NGoroutines + + + Root Directory + + + Swap Limit + + + Version + done. diff --git a/XenModel/Messages.zh-CN.resx b/XenModel/Messages.zh-CN.resx index 87fc5517f..4323d2bfb 100644 --- a/XenModel/Messages.zh-CN.resx +++ b/XenModel/Messages.zh-CN.resx @@ -3645,6 +3645,72 @@ XenServer 可以重新启动服务器并将服务器的 CPU 级别降至池中 Docker进程 + + Api Version + + + Arch + + + Debug + + + Driver + + + Driver Status + + + Execution Driver + + + Git Commit + + + Go Version + + + Index Server Address + + + Initiate Path + + + Initiate Sha1 + + + IPv4 Forwarding + + + Kernel Version + + + Labels + + + Memory Limit + + + NCPU + + + NEvents Listener + + + NFd + + + NGoroutines + + + Root Directory + + + Swap Limit + + + Version + 已完成。 diff --git a/XenModel/XenAPI-Extensions/VM.cs b/XenModel/XenAPI-Extensions/VM.cs index 5b8884e3b..75ef4cea5 100644 --- a/XenModel/XenAPI-Extensions/VM.cs +++ b/XenModel/XenAPI-Extensions/VM.cs @@ -1688,6 +1688,30 @@ namespace XenAPI return v == null ? false : v.ToLower() == "true"; } } + + public VM_Docker_Info DockerInfo + { + get + { + string xml = Get(other_config, "docker_info"); + if (string.IsNullOrEmpty(xml)) + return null; + VM_Docker_Info info = new VM_Docker_Info(xml); + return info; + } + } + + public VM_Docker_Version DockerVersion + { + get + { + string xml = Get(other_config, "docker_version"); + if (string.IsNullOrEmpty(xml)) + return null; + VM_Docker_Version info = new VM_Docker_Version(xml); + return info; + } + } } public struct VMStartupOptions @@ -1709,4 +1733,5 @@ namespace XenAPI HaRestartPriority = haRestartPriority; } } + } diff --git a/XenModel/XenAPI-Extensions/VM_Docker_Info.cs b/XenModel/XenAPI-Extensions/VM_Docker_Info.cs new file mode 100755 index 000000000..6a194461c --- /dev/null +++ b/XenModel/XenAPI-Extensions/VM_Docker_Info.cs @@ -0,0 +1,338 @@ +using System.Linq; +using System.Xml; + +namespace XenAPI +{ + public class VM_Docker_Info + { + private string _NGoroutines; + public string NGoroutines + { + get { return _NGoroutines; } + set { + if (value != _NGoroutines) + _NGoroutines = value; + } + } + + private string _DockerRootDir; + public string DockerRootDir + { + get { return _DockerRootDir; } + set { + if (value != _DockerRootDir) + _DockerRootDir = value; + } + } + + private string _DriverStatus; + public string DriverStatus + { + get { return _DriverStatus; } + set { + if (value != _DriverStatus) + _DriverStatus = value; + } + } + + private string _OperatingSystem; + public string OperatingSystem + { + get { return _OperatingSystem; } + set { + if (value != _OperatingSystem) + _OperatingSystem = value; + } + } + + private string _Containers; + public string Containers + { + get { return _Containers; } + set { + if (value != _Containers) + _Containers = value; + } + } + + private string _MemTotal; + public string MemTotal + { + get { return _MemTotal; } + set { + if (value != _MemTotal) + _MemTotal = value; + } + } + + private string _Driver; + public string Driver + { + get { return _Driver; } + set { + if (value != _Driver) + _Driver = value; + } + } + + private string _IndexServerAddress; + public string IndexServerAddress + { + get { return _IndexServerAddress; } + set { + if (value != _IndexServerAddress) + _IndexServerAddress = value; + } + } + + private string _InitPath; + public string InitPath + { + get { return _InitPath; } + set { + if (value != _InitPath) + _InitPath = value; + } + } + + private string _ExecutionDriver; + public string ExecutionDriver + { + get { return _ExecutionDriver; } + set { + if (value != _ExecutionDriver) + _ExecutionDriver = value; + } + } + + private string _Name; + public string Name + { + get { return _Name; } + set { + if (value != _Name) + _Name = value; + } + } + + private string _NCPU; + public string NCPU + { + get { return _NCPU; } + set { + if (value != _NCPU) + _NCPU = value; + } + } + + private string _Debug; + public string Debug + { + get { return _Debug; } + set { + if (value != _Debug) + _Debug = value; + } + } + + private string _ID; + public string ID + { + get { return _ID; } + set { + if (value != _ID) + _ID = value; + } + } + + private string _IPv4Forwarding; + public string IPv4Forwarding + { + get { return _IPv4Forwarding; } + set { + if (value != _IPv4Forwarding) + _IPv4Forwarding = value; + } + } + + private string _KernelVersion; + public string KernelVersion + { + get { return _KernelVersion; } + set { + if (value != _KernelVersion) + _KernelVersion = value; + } + } + + private string _NFd; + public string NFd + { + get { return _NFd; } + set { + if (value != _NFd) + _NFd = value; + } + } + + private string _InitSha1; + public string InitSha1 + { + get { return _InitSha1; } + set { + if (value != _InitSha1) + _InitSha1 = value; + } + } + + private string _Labels; + public string Labels + { + get { return _Labels; } + set { + if (value != _Labels) + _Labels = value; + } + } + + private string _MemoryLimit; + public string MemoryLimit + { + get { return _MemoryLimit; } + set { + if (value != _MemoryLimit) + _MemoryLimit = value; + } + } + + private string _SwapLimit; + public string SwapLimit + { + get { return _SwapLimit; } + set { + if (value != _SwapLimit) + _SwapLimit = value; + } + } + + private string _Images; + public string Images + { + get { return _Images; } + set { + if (value != _Images) + _Images = value; + } + } + + private string _NEventsListener; + public string NEventsListener + { + get { return _NEventsListener; } + set { + if (value != _NEventsListener) + _NEventsListener = value; + } + } + + public VM_Docker_Info(string dockerInfo) + { + XmlDocument doc = new XmlDocument(); + doc.LoadXml(dockerInfo); + foreach (XmlNode docker_info in doc.GetElementsByTagName("docker_info")) + { + var propertyNode = docker_info.ChildNodes.Cast().FirstOrDefault(node => node.Name == "NGoroutines"); + if (propertyNode != null) + this.NGoroutines = propertyNode.InnerText; + + propertyNode = docker_info.ChildNodes.Cast().FirstOrDefault(node => node.Name == "DockerRootDir"); + if (propertyNode != null) + DockerRootDir = propertyNode.InnerText; + + propertyNode = docker_info.ChildNodes.Cast().FirstOrDefault(node => node.Name == "DriverStatus"); + if (propertyNode != null) + DriverStatus = propertyNode.InnerText; + + propertyNode = docker_info.ChildNodes.Cast().FirstOrDefault(node => node.Name == "OperatingSystem"); + if (propertyNode != null) + OperatingSystem = propertyNode.InnerText; + + propertyNode = docker_info.ChildNodes.Cast().FirstOrDefault(node => node.Name == "Containers"); + if (propertyNode != null) + Containers = propertyNode.InnerText; + + propertyNode = docker_info.ChildNodes.Cast().FirstOrDefault(node => node.Name == "MemTotal"); + if (propertyNode != null) + MemTotal = propertyNode.InnerText; + + propertyNode = docker_info.ChildNodes.Cast().FirstOrDefault(node => node.Name == "Driver"); + if (propertyNode != null) + Driver = propertyNode.InnerText; + + propertyNode = docker_info.ChildNodes.Cast().FirstOrDefault(node => node.Name == "IndexServerAddress"); + if (propertyNode != null) + IndexServerAddress = propertyNode.InnerText; + + propertyNode = docker_info.ChildNodes.Cast().FirstOrDefault(node => node.Name == "InitPath"); + if (propertyNode != null) + InitPath = propertyNode.InnerText; + + propertyNode = docker_info.ChildNodes.Cast().FirstOrDefault(node => node.Name == "ExecutionDriver"); + if (propertyNode != null) + ExecutionDriver = propertyNode.InnerText; + + propertyNode = docker_info.ChildNodes.Cast().FirstOrDefault(node => node.Name == "Name"); + if (propertyNode != null) + Name = propertyNode.InnerText; + + propertyNode = docker_info.ChildNodes.Cast().FirstOrDefault(node => node.Name == "NCPU"); + if (propertyNode != null) + NCPU = propertyNode.InnerText; + + propertyNode = docker_info.ChildNodes.Cast().FirstOrDefault(node => node.Name == "Debug"); + if (propertyNode != null) + Debug = propertyNode.InnerText; + + propertyNode = docker_info.ChildNodes.Cast().FirstOrDefault(node => node.Name == "ID"); + if (propertyNode != null) + ID = propertyNode.InnerText; + + propertyNode = docker_info.ChildNodes.Cast().FirstOrDefault(node => node.Name == "IPv4Forwarding"); + if (propertyNode != null) + IPv4Forwarding = propertyNode.InnerText; + + propertyNode = docker_info.ChildNodes.Cast().FirstOrDefault(node => node.Name == "KernelVersion"); + if (propertyNode != null) + KernelVersion = propertyNode.InnerText; + + propertyNode = docker_info.ChildNodes.Cast().FirstOrDefault(node => node.Name == "NFd"); + if (propertyNode != null) + NFd = propertyNode.InnerText; + + propertyNode = docker_info.ChildNodes.Cast().FirstOrDefault(node => node.Name == "InitSha1"); + if (propertyNode != null) + InitSha1 = propertyNode.InnerText; + + propertyNode = docker_info.ChildNodes.Cast().FirstOrDefault(node => node.Name == "Labels"); + if (propertyNode != null) + Labels = propertyNode.InnerText; + + propertyNode = docker_info.ChildNodes.Cast().FirstOrDefault(node => node.Name == "MemoryLimit"); + if (propertyNode != null) + MemoryLimit = propertyNode.InnerText; + + propertyNode = docker_info.ChildNodes.Cast().FirstOrDefault(node => node.Name == "SwapLimit"); + if (propertyNode != null) + SwapLimit = propertyNode.InnerText; + + propertyNode = docker_info.ChildNodes.Cast().FirstOrDefault(node => node.Name == "Images"); + if (propertyNode != null) + Images = propertyNode.InnerText; + + propertyNode = docker_info.ChildNodes.Cast().FirstOrDefault(node => node.Name == "NEventsListener"); + if (propertyNode != null) + NEventsListener = propertyNode.InnerText; + } + } + } +} diff --git a/XenModel/XenAPI-Extensions/VM_Docker_Version.cs b/XenModel/XenAPI-Extensions/VM_Docker_Version.cs new file mode 100755 index 000000000..9b10e6a00 --- /dev/null +++ b/XenModel/XenAPI-Extensions/VM_Docker_Version.cs @@ -0,0 +1,121 @@ +using System.Linq; +using System.Xml; + +namespace XenAPI +{ + public class VM_Docker_Version + { + private string _KernelVersion; + public string KernelVersion + { + get { return _KernelVersion; } + set + { + if (value != _KernelVersion) + _KernelVersion = value; + } + } + + private string _Arch; + public string Arch + { + get { return _Arch; } + set + { + if (value != _Arch) + _Arch = value; + } + } + + private string _ApiVersion; + public string ApiVersion + { + get { return _ApiVersion; } + set + { + if (value != _ApiVersion) + _ApiVersion = value; + } + } + + private string _Version; + public string Version + { + get { return _Version; } + set + { + if (value != _Version) + _Version = value; + } + } + + private string _GitCommit; + public string GitCommit + { + get { return _GitCommit; } + set + { + if (value != _GitCommit) + _GitCommit = value; + } + } + + private string _Os; + public string Os + { + get { return _Os; } + set + { + if (value != _Os) + _Os = value; + } + } + + private string _GoVersion; + public string GoVersion + { + get { return _GoVersion; } + set + { + if (value != _GoVersion) + _GoVersion = value; + } + } + + public VM_Docker_Version(string dockerVersion) + { + XmlDocument doc = new XmlDocument(); + doc.LoadXml(dockerVersion); + foreach (XmlNode docker_Version in doc.GetElementsByTagName("docker_version")) + { + var propertyNode = docker_Version.ChildNodes.Cast().FirstOrDefault(node => node.Name == "KernelVersion"); + if (propertyNode != null) + this.KernelVersion = propertyNode.InnerText; + + propertyNode = docker_Version.ChildNodes.Cast().FirstOrDefault(node => node.Name == "Arch"); + if (propertyNode != null) + this.Arch = propertyNode.InnerText; + + propertyNode = docker_Version.ChildNodes.Cast().FirstOrDefault(node => node.Name == "ApiVersion"); + if (propertyNode != null) + this.ApiVersion = propertyNode.InnerText; + + propertyNode = docker_Version.ChildNodes.Cast().FirstOrDefault(node => node.Name == "Version"); + if (propertyNode != null) + this.Version = propertyNode.InnerText; + + propertyNode = docker_Version.ChildNodes.Cast().FirstOrDefault(node => node.Name == "GitCommit"); + if (propertyNode != null) + this.GitCommit = propertyNode.InnerText; + + propertyNode = docker_Version.ChildNodes.Cast().FirstOrDefault(node => node.Name == "Os"); + if (propertyNode != null) + this.Os = propertyNode.InnerText; + + propertyNode = docker_Version.ChildNodes.Cast().FirstOrDefault(node => node.Name == "GoVersion"); + if (propertyNode != null) + this.GoVersion = propertyNode.InnerText; + } + } + } +} diff --git a/XenModel/XenModel.csproj b/XenModel/XenModel.csproj index bfa042f42..74775f42a 100644 --- a/XenModel/XenModel.csproj +++ b/XenModel/XenModel.csproj @@ -308,11 +308,13 @@ + +