diff --git a/XenAdmin/Dialogs/VtmpManagementDialog.Designer.cs b/XenAdmin/Dialogs/VtpmManagementDialog.Designer.cs similarity index 100% rename from XenAdmin/Dialogs/VtmpManagementDialog.Designer.cs rename to XenAdmin/Dialogs/VtpmManagementDialog.Designer.cs diff --git a/XenAdmin/Dialogs/VtmpManagementDialog.cs b/XenAdmin/Dialogs/VtpmManagementDialog.cs similarity index 87% rename from XenAdmin/Dialogs/VtmpManagementDialog.cs rename to XenAdmin/Dialogs/VtpmManagementDialog.cs index 34fc60314..81ce43d23 100644 --- a/XenAdmin/Dialogs/VtmpManagementDialog.cs +++ b/XenAdmin/Dialogs/VtpmManagementDialog.cs @@ -175,6 +175,22 @@ namespace XenAdmin.Dialogs dlg.ShowDialog(this); } + private bool CanRemoveVtpm(VTPM vtpm, out string cannotReason) + { + cannotReason = null; + + if (Helpers.XapiEqualOrGreater_23_10_0(vtpm.Connection)) + { + if (vtpm.allowed_operations.Contains(vtpm_operations.destroy)) + return true; + + cannotReason = Messages.VTPM_OPERATION_DISALLOWED_REMOVE; + return false; + } + + return _vm.CanRemoveVtpm(out cannotReason); + } + private void ResizeVerticalTabs() { int maxHeight = splitContainer.Panel1.Height - toolTipContainerAdd.Height; @@ -182,12 +198,12 @@ namespace XenAdmin.Dialogs toolTipContainerAdd.Top = verticalTabs.Top + verticalTabs.Height; } - private void ShowTooltip(Point location) + private void ShowTooltip(VtpmManagementPage page, Point location) { if (!_toolTipVisible) { Cursor = Cursors.Hand; - var msg = _vm.CanRemoveVtpm(out var cannotReason) ? Messages.VTPM_REMOVE : cannotReason; + var msg = CanRemoveVtpm(page.Vtpm, out var cannotReason) ? Messages.VTPM_REMOVE : cannotReason; if (!string.IsNullOrEmpty(cannotReason)) { @@ -231,7 +247,7 @@ namespace XenAdmin.Dialogs if (!(verticalTabs.Items[pageIndex] is VtpmManagementPage page)) return; - var deleteIcon = _vm.CanRemoveVtpm(out _) ? Images.StaticImages._000_Abort_h32bit_16 : Images.StaticImages._000_Abort_gray_h32bit_16; + var deleteIcon = CanRemoveVtpm(page.Vtpm, out _) ? Images.StaticImages._000_Abort_h32bit_16 : Images.StaticImages._000_Abort_gray_h32bit_16; page.DeleteIconBounds = new Rectangle(e.Bounds.Right - deleteIcon.Width - (32 - deleteIcon.Width) / 2, e.Bounds.Y + (32 - deleteIcon.Height) / 2, deleteIcon.Width, deleteIcon.Height); @@ -249,7 +265,7 @@ namespace XenAdmin.Dialogs return; if (page.DeleteIconBounds.Contains(e.Location)) - ShowTooltip(e.Location); + ShowTooltip(page, e.Location); else HideTooltip(); } @@ -263,7 +279,7 @@ namespace XenAdmin.Dialogs if (!(verticalTabs.Items[pageIndex] is VtpmManagementPage page)) return; - if (page.DeleteIconBounds.Contains(e.Location) && _vm.CanRemoveVtpm(out _)) + if (page.DeleteIconBounds.Contains(e.Location) && CanRemoveVtpm(page.Vtpm, out _)) RemoveVtpm(page.Vtpm); } diff --git a/XenAdmin/Dialogs/VtmpManagementDialog.ja.resx b/XenAdmin/Dialogs/VtpmManagementDialog.ja.resx similarity index 100% rename from XenAdmin/Dialogs/VtmpManagementDialog.ja.resx rename to XenAdmin/Dialogs/VtpmManagementDialog.ja.resx diff --git a/XenAdmin/Dialogs/VtmpManagementDialog.resx b/XenAdmin/Dialogs/VtpmManagementDialog.resx similarity index 100% rename from XenAdmin/Dialogs/VtmpManagementDialog.resx rename to XenAdmin/Dialogs/VtpmManagementDialog.resx diff --git a/XenAdmin/Dialogs/VtmpManagementDialog.zh-CN.resx b/XenAdmin/Dialogs/VtpmManagementDialog.zh-CN.resx similarity index 100% rename from XenAdmin/Dialogs/VtmpManagementDialog.zh-CN.resx rename to XenAdmin/Dialogs/VtpmManagementDialog.zh-CN.resx diff --git a/XenAdmin/Dialogs/VtpmManagementPage.cs b/XenAdmin/Dialogs/VtpmManagementPage.cs index 3b2e3b6f3..7c9c47ecf 100644 --- a/XenAdmin/Dialogs/VtpmManagementPage.cs +++ b/XenAdmin/Dialogs/VtpmManagementPage.cs @@ -81,9 +81,7 @@ namespace XenAdmin.Dialogs private void UpdateButtons() { - var vm = Vtpm.Connection.Resolve(Vtpm.VM); - string cannotReason = null; - buttonRemove.Enabled = vm!= null && vm.CanRemoveVtpm(out cannotReason); + buttonRemove.Enabled = CanRemoveVtpm(out string cannotReason); if (buttonRemove.Enabled) toolTipContainerRemove.RemoveAll(); @@ -91,13 +89,33 @@ namespace XenAdmin.Dialogs toolTipContainerRemove.SetToolTip(cannotReason); } + private bool CanRemoveVtpm(out string cannotReason) + { + cannotReason = null; + + if (Helpers.XapiEqualOrGreater_23_10_0(Vtpm.Connection)) + { + if (Vtpm.allowed_operations.Contains(vtpm_operations.destroy)) + return true; + + cannotReason = Messages.VTPM_OPERATION_DISALLOWED_REMOVE; + return false; + } + + var vm = Vtpm.Connection.Resolve(Vtpm.VM); + return vm != null && vm.CanRemoveVtpm(out cannotReason); + } + private void Vtpm_PropertyChanged(object sender, PropertyChangedEventArgs e) { - if (!(sender is VTPM)) + if (!(sender is VTPM vtpm)) return; if (e.PropertyName == "is_protected" || e.PropertyName == "is_unique") Program.Invoke(this, UpdateProperties); + + if (e.PropertyName == "allowed_operations" && Helpers.XapiEqualOrGreater_23_10_0(vtpm.Connection)) + Program.Invoke(this, UpdateButtons); } private void buttonRemove_Click(object sender, EventArgs e) diff --git a/XenAdmin/Wizards/ExportWizard/ExportSelectVMsPage.Designer.cs b/XenAdmin/Wizards/ExportWizard/ExportSelectVMsPage.Designer.cs index 541c4a5d2..b3a013db4 100644 --- a/XenAdmin/Wizards/ExportWizard/ExportSelectVMsPage.Designer.cs +++ b/XenAdmin/Wizards/ExportWizard/ExportSelectVMsPage.Designer.cs @@ -50,7 +50,7 @@ this.label2 = new System.Windows.Forms.Label(); this._tlpWarning = new System.Windows.Forms.TableLayoutPanel(); this.pictureBox2 = new System.Windows.Forms.PictureBox(); - this.label1 = new System.Windows.Forms.Label(); + this.labelWarning = new System.Windows.Forms.Label(); this.tableLayoutPanel2.SuspendLayout(); this.m_tlpInfo.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); @@ -208,7 +208,7 @@ // resources.ApplyResources(this._tlpWarning, "_tlpWarning"); this._tlpWarning.Controls.Add(this.pictureBox2, 0, 0); - this._tlpWarning.Controls.Add(this.label1, 1, 0); + this._tlpWarning.Controls.Add(this.labelWarning, 1, 0); this._tlpWarning.Name = "_tlpWarning"; // // pictureBox2 @@ -218,10 +218,10 @@ this.pictureBox2.Name = "pictureBox2"; this.pictureBox2.TabStop = false; // - // label1 + // labelWarning // - resources.ApplyResources(this.label1, "label1"); - this.label1.Name = "label1"; + resources.ApplyResources(this.labelWarning, "labelWarning"); + this.labelWarning.Name = "labelWarning"; // // ExportSelectVMsPage // @@ -270,6 +270,6 @@ private System.Windows.Forms.DataGridViewTextBoxColumn columnVapp; private System.Windows.Forms.TableLayoutPanel _tlpWarning; private System.Windows.Forms.PictureBox pictureBox2; - private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label labelWarning; } } diff --git a/XenAdmin/Wizards/ExportWizard/ExportSelectVMsPage.cs b/XenAdmin/Wizards/ExportWizard/ExportSelectVMsPage.cs index 5dd65b262..b2a02fa05 100644 --- a/XenAdmin/Wizards/ExportWizard/ExportSelectVMsPage.cs +++ b/XenAdmin/Wizards/ExportWizard/ExportSelectVMsPage.cs @@ -304,9 +304,24 @@ namespace XenAdmin.Wizards.ExportWizard { var count = VMsToExport.Count; m_tlpInfo.Visible = ExportAsXva && count > 1; - _tlpWarning.Visible = !Helpers.FeatureForbidden(Connection, Host.RestrictVtpm) && - Helpers.XapiEqualOrGreater_22_26_0(Connection) && - VMsToExport.Any(v => v.VTPMs.Count > 0); + + if (Helpers.FeatureForbidden(Connection, Host.RestrictVtpm) || + !Helpers.XapiEqualOrGreater_22_26_0(Connection) || + !VMsToExport.Any(v => v.VTPMs.Count > 0)) + { + _tlpWarning.Visible = false; + } + else if (Helpers.XapiEqualOrGreater_23_9_0(Connection)) + { + labelWarning.Text = Messages.VTPM_EXPORT_UNSUPPORTED_FOR_OVF; + _tlpWarning.Visible = !ExportAsXva; + } + else + { + labelWarning.Text = Messages.VTPM_EXPORT_UNSUPPORTED_FOR_ALL; + _tlpWarning.Visible = true; + } + m_buttonNextEnabled = ExportAsXva ? count == 1 : count > 0; m_buttonClearAll.Enabled = count > 0; m_buttonSelectAll.Enabled = count < m_dataGridView.RowCount; diff --git a/XenAdmin/Wizards/ExportWizard/ExportSelectVMsPage.resx b/XenAdmin/Wizards/ExportWizard/ExportSelectVMsPage.resx index fb508fcb0..0ffd81dd3 100644 --- a/XenAdmin/Wizards/ExportWizard/ExportSelectVMsPage.resx +++ b/XenAdmin/Wizards/ExportWizard/ExportSelectVMsPage.resx @@ -148,7 +148,7 @@ m_ctrlError - XenAdmin.Controls.Common.PasswordFailure, [XenCenter_No_Space]Main, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + XenAdmin.Controls.Common.PasswordFailure, [XenCenter_No_Space], Version=0.0.0.0, Culture=neutral, PublicKeyToken=null tableLayoutPanel2 @@ -185,7 +185,7 @@ Note that only VMs that are currently shut down or suspended are listed here.m_labelIntro - XenAdmin.Controls.Common.AutoHeightLabel, [XenCenter_No_Space]Main, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + XenAdmin.Controls.Common.AutoHeightLabel, [XenCenter_No_Space], Version=0.0.0.0, Culture=neutral, PublicKeyToken=null tableLayoutPanel2 @@ -311,7 +311,7 @@ Note that only VMs that are currently shut down or suspended are listed here.autoHeightLabel1 - XenAdmin.Controls.Common.AutoHeightLabel, [XenCenter_No_Space]Main, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + XenAdmin.Controls.Common.AutoHeightLabel, [XenCenter_No_Space], Version=0.0.0.0, Culture=neutral, PublicKeyToken=null m_tlpInfo @@ -323,7 +323,7 @@ Note that only VMs that are currently shut down or suspended are listed here.Fill - 3, 295 + 3, 299 1 @@ -392,7 +392,7 @@ Note that only VMs that are currently shut down or suspended are listed here.6, 3, 6, 3 - 567, 180 + 567, 184 102 @@ -452,7 +452,7 @@ Note that only VMs that are currently shut down or suspended are listed here.Fill - 3, 260 + 3, 264 1 @@ -500,7 +500,7 @@ Note that only VMs that are currently shut down or suspended are listed here.m_searchTextBox - XenAdmin.Controls.SearchTextBox, [XenCenter_No_Space]Main, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + XenAdmin.Controls.SearchTextBox, [XenCenter_No_Space], Version=0.0.0.0, Culture=neutral, PublicKeyToken=null tableLayoutPanel4 @@ -598,47 +598,47 @@ Note that only VMs that are currently shut down or suspended are listed here. 0 - + True - + Fill - + 25, 0 - - 545, 26 + + 545, 22 - + 1 - - Exporting VMs with attached vTPMs is not supported. If you export and re-import these VMs, some of their security features may be deactivated and the VMs may not start. + + labelWarning - - label1 + + labelWarning - + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + _tlpWarning - + 1 Fill - 3, 327 + 3, 331 1 - 573, 26 + 573, 22 105 @@ -656,7 +656,7 @@ Note that only VMs that are currently shut down or suspended are listed here.6 - <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="pictureBox2" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="label1" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /></Controls><Columns Styles="AutoSize,0,Percent,100" /><Rows Styles="AutoSize,0" /></TableLayoutSettings> + <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="pictureBox2" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="labelWarning" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /></Controls><Columns Styles="AutoSize,0,Percent,100" /><Rows Styles="AutoSize,0" /></TableLayoutSettings> Fill @@ -731,6 +731,6 @@ Note that only VMs that are currently shut down or suspended are listed here.ExportSelectVMsPage - XenAdmin.Controls.XenTabPage, [XenCenter_No_Space]Main, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + XenAdmin.Controls.XenTabPage, [XenCenter_No_Space], Version=0.0.0.0, Culture=neutral, PublicKeyToken=null \ No newline at end of file diff --git a/XenAdmin/XenAdmin.csproj b/XenAdmin/XenAdmin.csproj index 088c8c062..3cfc6776c 100755 --- a/XenAdmin/XenAdmin.csproj +++ b/XenAdmin/XenAdmin.csproj @@ -313,11 +313,11 @@ VtpmManagementPage.cs - + Form - - VtmpManagementDialog.cs + + VtpmManagementDialog.cs UserControl @@ -1804,16 +1804,16 @@ VtpmManagementPage.cs - - VtmpManagementDialog.cs + + VtpmManagementDialog.cs Designer - - VtmpManagementDialog.cs + + VtpmManagementDialog.cs Designer - - VtmpManagementDialog.cs + + VtpmManagementDialog.cs Designer diff --git a/XenModel/Actions/VM/CreateVMAction.cs b/XenModel/Actions/VM/CreateVMAction.cs index f7740081b..a791ba9ea 100644 --- a/XenModel/Actions/VM/CreateVMAction.cs +++ b/XenModel/Actions/VM/CreateVMAction.cs @@ -275,8 +275,13 @@ namespace XenAdmin.Actions.VMActions private void AssignVtpm() { - if (_assignVtpm) - new NewVtpmAction(Connection, VM).RunSync(Session); + if (!_assignVtpm) + return; + + if (Helpers.XapiEqualOrGreater_23_10_0(Connection) && !VM.allowed_operations.Contains(vm_operations.create_vtpm)) + return; + + new NewVtpmAction(Connection, VM).RunSync(Session); } private void AssignVgpu() diff --git a/XenModel/Messages.Designer.cs b/XenModel/Messages.Designer.cs index ef7a07629..b40798fd9 100755 --- a/XenModel/Messages.Designer.cs +++ b/XenModel/Messages.Designer.cs @@ -40129,6 +40129,24 @@ namespace XenAdmin { } } + /// + /// Looks up a localized string similar to Your selection includes VMs with attached vTPMs. If you export and re-import these VMs, the vTPM data will not be preserved. Some of the VMs' security features may be deactivated and the VMs may not start.. + /// + public static string VTPM_EXPORT_UNSUPPORTED_FOR_ALL { + get { + return ResourceManager.GetString("VTPM_EXPORT_UNSUPPORTED_FOR_ALL", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to VMs with attached vTPMs can only be exported in XVA format. If you export and re-import these VMs, the vTPM data will not be preserved. Some of the VMs' security features may be deactivated and the VMs may not start.. + /// + public static string VTPM_EXPORT_UNSUPPORTED_FOR_OVF { + get { + return ResourceManager.GetString("VTPM_EXPORT_UNSUPPORTED_FOR_OVF", resourceCulture); + } + } + /// /// Looks up a localized string similar to The maximum number of vTPMs that can be attached to this VM is {0}.. /// @@ -40165,6 +40183,24 @@ namespace XenAdmin { } } + /// + /// Looks up a localized string similar to Attaching a new vTPM to this VM is currently not allowed.. + /// + public static string VTPM_OPERATION_DISALLOWED_ADD { + get { + return ResourceManager.GetString("VTPM_OPERATION_DISALLOWED_ADD", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Removing this vTPM from the VM is currently not allowed.. + /// + public static string VTPM_OPERATION_DISALLOWED_REMOVE { + get { + return ResourceManager.GetString("VTPM_OPERATION_DISALLOWED_REMOVE", resourceCulture); + } + } + /// /// Looks up a localized string similar to You need to shut down this VM before you can attach a new vTPM to it.. /// diff --git a/XenModel/Messages.resx b/XenModel/Messages.resx index db76ca439..a6b9d6596 100755 --- a/XenModel/Messages.resx +++ b/XenModel/Messages.resx @@ -13861,6 +13861,12 @@ Schedule: A vTPM is attached to this VM. + + Your selection includes VMs with attached vTPMs. If you export and re-import these VMs, the vTPM data will not be preserved. Some of the VMs' security features may be deactivated and the VMs may not start. + + + VMs with attached vTPMs can only be exported in XVA format. If you export and re-import these VMs, the vTPM data will not be preserved. Some of the VMs' security features may be deactivated and the VMs may not start. + The maximum number of vTPMs that can be attached to this VM is {0}. @@ -13873,6 +13879,12 @@ Schedule: There are no vTPMs attached to this VM. + + Attaching a new vTPM to this VM is currently not allowed. + + + Removing this vTPM from the VM is currently not allowed. + You need to shut down this VM before you can attach a new vTPM to it. diff --git a/XenModel/Utils/Helpers.Versions.cs b/XenModel/Utils/Helpers.Versions.cs index caf2d7c27..2ce4c59d9 100644 --- a/XenModel/Utils/Helpers.Versions.cs +++ b/XenModel/Utils/Helpers.Versions.cs @@ -450,6 +450,18 @@ namespace XenAdmin.Core return coordinator == null || ProductVersionCompare(coordinator.GetXapiVersion(), "22.33.0") >= 0; } + public static bool XapiEqualOrGreater_23_9_0(IXenConnection conn) + { + var coordinator = GetCoordinator(conn); + return coordinator == null || ProductVersionCompare(coordinator.GetXapiVersion(), "23.9.0") >= 0; + } + + public static bool XapiEqualOrGreater_23_10_0(IXenConnection conn) + { + var coordinator = GetCoordinator(conn); + return coordinator == null || ProductVersionCompare(coordinator.GetXapiVersion(), "23.10.0") >= 0; + } + #endregion } } diff --git a/XenModel/XenAPI-Extensions/VM.cs b/XenModel/XenAPI-Extensions/VM.cs index f2f3e7efb..7b1d3c446 100644 --- a/XenModel/XenAPI-Extensions/VM.cs +++ b/XenModel/XenAPI-Extensions/VM.cs @@ -1797,9 +1797,18 @@ namespace XenAPI { cannotReason = null; - if (VTPMs.Count >= VM.MAX_ALLOWED_VTPMS) + if (Helpers.XapiEqualOrGreater_23_10_0(Connection)) { - cannotReason = string.Format(Messages.VTPM_MAX_REACHED, VM.MAX_ALLOWED_VTPMS); + if (allowed_operations.Contains(vm_operations.create_vtpm)) + return true; + + cannotReason = Messages.VTPM_OPERATION_DISALLOWED_ADD; + return false; + } + + if (VTPMs.Count >= MAX_ALLOWED_VTPMS) + { + cannotReason = string.Format(Messages.VTPM_MAX_REACHED, MAX_ALLOWED_VTPMS); return false; } diff --git a/XenModel/XenAPI/FriendlyErrorNames.Designer.cs b/XenModel/XenAPI/FriendlyErrorNames.Designer.cs index 02ed86869..3ff76a866 100755 --- a/XenModel/XenAPI/FriendlyErrorNames.Designer.cs +++ b/XenModel/XenAPI/FriendlyErrorNames.Designer.cs @@ -19,7 +19,7 @@ namespace XenAPI { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class FriendlyErrorNames { @@ -1969,7 +1969,7 @@ namespace XenAPI { } /// - /// Looks up a localized string similar to The dynamic memory range violates constraint static_min <= dynamic_min = dynamic_max = static_max.. + /// Looks up a localized string similar to The dynamic memory range violates constraint static_min = dynamic_min = dynamic_max = static_max.. /// public static string MEMORY_CONSTRAINT_VIOLATION_MAXPIN { get { @@ -5375,6 +5375,15 @@ namespace XenAPI { } } + /// + /// Looks up a localized string similar to The next scheduled telemetry data collection is too far into the future. Pick a timestamp within two telemetry intervals starting from now.. + /// + public static string TELEMETRY_NEXT_COLLECTION_TOO_LATE { + get { + return ResourceManager.GetString("TELEMETRY_NEXT_COLLECTION_TOO_LATE", resourceCulture); + } + } + /// /// Looks up a localized string similar to Cannot contact the other host using TLS on the specified address and port. /// diff --git a/XenModel/XenAPI/FriendlyErrorNames.resx b/XenModel/XenAPI/FriendlyErrorNames.resx index 7ab17cdb0..3695aaa6f 100755 --- a/XenModel/XenAPI/FriendlyErrorNames.resx +++ b/XenModel/XenAPI/FriendlyErrorNames.resx @@ -748,7 +748,7 @@ The dynamic memory range does not satisfy the following constraint. - The dynamic memory range violates constraint static_min <= dynamic_min = dynamic_max = static_max. + The dynamic memory range violates constraint static_min = dynamic_min = dynamic_max = static_max. The dynamic memory range violates constraint static_min <= dynamic_min <= dynamic_max <= static_max. @@ -1892,6 +1892,9 @@ Authorized Roles: {1} The request was asynchronously canceled. + + The next scheduled telemetry data collection is too far into the future. Pick a timestamp within two telemetry intervals starting from now. + Cannot contact the other host using TLS on the specified address and port diff --git a/XenModel/XenAPI/JsonRpcClient.cs b/XenModel/XenAPI/JsonRpcClient.cs index 21812b69e..7f7990fe1 100755 --- a/XenModel/XenAPI/JsonRpcClient.cs +++ b/XenModel/XenAPI/JsonRpcClient.cs @@ -1116,6 +1116,13 @@ namespace XenAPI return Rpc("pool.get_repository_proxy_username", new JArray(session, _pool ?? ""), serializer); } + public XenRef pool_get_repository_proxy_password(string session, string _pool) + { + var converters = new List {new XenRefConverter()}; + var serializer = CreateSerializer(converters); + return Rpc>("pool.get_repository_proxy_password", new JArray(session, _pool ?? ""), serializer); + } + public bool pool_get_migration_compression(string session, string _pool) { var converters = new List {}; @@ -1130,6 +1137,27 @@ namespace XenAPI return Rpc("pool.get_coordinator_bias", new JArray(session, _pool ?? ""), serializer); } + public XenRef pool_get_telemetry_uuid(string session, string _pool) + { + var converters = new List {new XenRefConverter()}; + var serializer = CreateSerializer(converters); + return Rpc>("pool.get_telemetry_uuid", new JArray(session, _pool ?? ""), serializer); + } + + public telemetry_frequency pool_get_telemetry_frequency(string session, string _pool) + { + var converters = new List {new telemetry_frequencyConverter()}; + var serializer = CreateSerializer(converters); + return Rpc("pool.get_telemetry_frequency", new JArray(session, _pool ?? ""), serializer); + } + + public DateTime pool_get_telemetry_next_collection(string session, string _pool) + { + var converters = new List {new XenDateTimeConverter()}; + var serializer = CreateSerializer(converters); + return Rpc("pool.get_telemetry_next_collection", new JArray(session, _pool ?? ""), serializer); + } + public void pool_set_name_label(string session, string _pool, string _name_label) { var converters = new List {}; @@ -2145,6 +2173,34 @@ namespace XenAPI return Rpc>("Async.pool.set_https_only", new JArray(session, _pool ?? "", _value), serializer); } + public void pool_set_telemetry_next_collection(string session, string _pool, DateTime _value) + { + var converters = new List {new XenDateTimeConverter()}; + var serializer = CreateSerializer(converters); + Rpc("pool.set_telemetry_next_collection", new JArray(session, _pool ?? "", _value), serializer); + } + + public XenRef async_pool_set_telemetry_next_collection(string session, string _pool, DateTime _value) + { + var converters = new List {new XenRefConverter(), new XenDateTimeConverter()}; + var serializer = CreateSerializer(converters); + return Rpc>("Async.pool.set_telemetry_next_collection", new JArray(session, _pool ?? "", _value), serializer); + } + + public void pool_reset_telemetry_uuid(string session, string _pool) + { + var converters = new List {}; + var serializer = CreateSerializer(converters); + Rpc("pool.reset_telemetry_uuid", new JArray(session, _pool ?? ""), serializer); + } + + public XenRef async_pool_reset_telemetry_uuid(string session, string _pool) + { + var converters = new List {new XenRefConverter()}; + var serializer = CreateSerializer(converters); + return Rpc>("Async.pool.reset_telemetry_uuid", new JArray(session, _pool ?? ""), serializer); + } + public List> pool_get_all(string session) { var converters = new List {new XenRefListConverter()}; @@ -11938,6 +11994,20 @@ namespace XenAPI return Rpc("VTPM.get_uuid", new JArray(session, _vtpm ?? ""), serializer); } + public List vtpm_get_allowed_operations(string session, string _vtpm) + { + var converters = new List {}; + var serializer = CreateSerializer(converters); + return Rpc>("VTPM.get_allowed_operations", new JArray(session, _vtpm ?? ""), serializer); + } + + public Dictionary vtpm_get_current_operations(string session, string _vtpm) + { + var converters = new List {}; + var serializer = CreateSerializer(converters); + return Rpc>("VTPM.get_current_operations", new JArray(session, _vtpm ?? ""), serializer); + } + public XenRef vtpm_get_vm(string session, string _vtpm) { var converters = new List {new XenRefConverter()}; diff --git a/XenModel/XenAPI/Maps.cs b/XenModel/XenAPI/Maps.cs index 0cb009938..a1f0b899a 100644 --- a/XenModel/XenAPI/Maps.cs +++ b/XenModel/XenAPI/Maps.cs @@ -680,6 +680,52 @@ using System.Collections.Generic; } + internal static Dictionary convert_from_proxy_string_vtpm_operations(Object o) + { + Hashtable table = (Hashtable)o; + Dictionary result = new Dictionary(); + if (table != null) + { + foreach (string key in table.Keys) + { + try + { + string k = key; + vtpm_operations v = table[key] == null ? (vtpm_operations) 0 : (vtpm_operations)Helper.EnumParseDefault(typeof(vtpm_operations), (string)table[key]); + result[k] = v; + } + catch + { + // continue + } + } + } + return result; + } + + internal static Hashtable convert_to_proxy_string_vtpm_operations(Dictionary table) + { + var result = new Hashtable(); + if (table != null) + { + foreach (string key in table.Keys) + { + try + { + string k = key ?? ""; + string v = vtpm_operations_helper.ToString(table[key]); + result[k] = v; + } + catch + { + // continue + } + } + } + return result; + } + + internal static Dictionary convert_from_proxy_string_vusb_operations(Object o) { Hashtable table = (Hashtable)o; diff --git a/XenModel/XenAPI/Pool.cs b/XenModel/XenAPI/Pool.cs index d256c5220..a1c7c4ad9 100644 --- a/XenModel/XenAPI/Pool.cs +++ b/XenModel/XenAPI/Pool.cs @@ -95,8 +95,12 @@ namespace XenAPI string client_certificate_auth_name, string repository_proxy_url, string repository_proxy_username, + XenRef repository_proxy_password, bool migration_compression, - bool coordinator_bias) + bool coordinator_bias, + XenRef telemetry_uuid, + telemetry_frequency telemetry_frequency, + DateTime telemetry_next_collection) { this.uuid = uuid; this.name_label = name_label; @@ -142,8 +146,12 @@ namespace XenAPI this.client_certificate_auth_name = client_certificate_auth_name; this.repository_proxy_url = repository_proxy_url; this.repository_proxy_username = repository_proxy_username; + this.repository_proxy_password = repository_proxy_password; this.migration_compression = migration_compression; this.coordinator_bias = coordinator_bias; + this.telemetry_uuid = telemetry_uuid; + this.telemetry_frequency = telemetry_frequency; + this.telemetry_next_collection = telemetry_next_collection; } /// @@ -210,8 +218,12 @@ namespace XenAPI client_certificate_auth_name = record.client_certificate_auth_name; repository_proxy_url = record.repository_proxy_url; repository_proxy_username = record.repository_proxy_username; + repository_proxy_password = record.repository_proxy_password; migration_compression = record.migration_compression; coordinator_bias = record.coordinator_bias; + telemetry_uuid = record.telemetry_uuid; + telemetry_frequency = record.telemetry_frequency; + telemetry_next_collection = record.telemetry_next_collection; } /// @@ -310,10 +322,18 @@ namespace XenAPI repository_proxy_url = Marshalling.ParseString(table, "repository_proxy_url"); if (table.ContainsKey("repository_proxy_username")) repository_proxy_username = Marshalling.ParseString(table, "repository_proxy_username"); + if (table.ContainsKey("repository_proxy_password")) + repository_proxy_password = Marshalling.ParseRef(table, "repository_proxy_password"); if (table.ContainsKey("migration_compression")) migration_compression = Marshalling.ParseBool(table, "migration_compression"); if (table.ContainsKey("coordinator_bias")) coordinator_bias = Marshalling.ParseBool(table, "coordinator_bias"); + if (table.ContainsKey("telemetry_uuid")) + telemetry_uuid = Marshalling.ParseRef(table, "telemetry_uuid"); + if (table.ContainsKey("telemetry_frequency")) + telemetry_frequency = (telemetry_frequency)Helper.EnumParseDefault(typeof(telemetry_frequency), Marshalling.ParseString(table, "telemetry_frequency")); + if (table.ContainsKey("telemetry_next_collection")) + telemetry_next_collection = Marshalling.ParseDateTime(table, "telemetry_next_collection"); } public bool DeepEquals(Pool other, bool ignoreCurrentOperations) @@ -369,8 +389,12 @@ namespace XenAPI Helper.AreEqual2(this._client_certificate_auth_name, other._client_certificate_auth_name) && Helper.AreEqual2(this._repository_proxy_url, other._repository_proxy_url) && Helper.AreEqual2(this._repository_proxy_username, other._repository_proxy_username) && + Helper.AreEqual2(this._repository_proxy_password, other._repository_proxy_password) && Helper.AreEqual2(this._migration_compression, other._migration_compression) && - Helper.AreEqual2(this._coordinator_bias, other._coordinator_bias); + Helper.AreEqual2(this._coordinator_bias, other._coordinator_bias) && + Helper.AreEqual2(this._telemetry_uuid, other._telemetry_uuid) && + Helper.AreEqual2(this._telemetry_frequency, other._telemetry_frequency) && + Helper.AreEqual2(this._telemetry_next_collection, other._telemetry_next_collection); } public override string SaveChanges(Session session, string opaqueRef, Pool server) @@ -969,6 +993,17 @@ namespace XenAPI return session.JsonRpcClient.pool_get_repository_proxy_username(session.opaque_ref, _pool); } + /// + /// Get the repository_proxy_password field of the given pool. + /// First published in 21.3.0. + /// + /// The session + /// The opaque_ref of the given pool + public static XenRef get_repository_proxy_password(Session session, string _pool) + { + return session.JsonRpcClient.pool_get_repository_proxy_password(session.opaque_ref, _pool); + } + /// /// Get the migration_compression field of the given pool. /// Experimental. First published in 22.33.0. @@ -991,6 +1026,39 @@ namespace XenAPI return session.JsonRpcClient.pool_get_coordinator_bias(session.opaque_ref, _pool); } + /// + /// Get the telemetry_uuid field of the given pool. + /// Experimental. First published in 23.9.0. + /// + /// The session + /// The opaque_ref of the given pool + public static XenRef get_telemetry_uuid(Session session, string _pool) + { + return session.JsonRpcClient.pool_get_telemetry_uuid(session.opaque_ref, _pool); + } + + /// + /// Get the telemetry_frequency field of the given pool. + /// Experimental. First published in 23.9.0. + /// + /// The session + /// The opaque_ref of the given pool + public static telemetry_frequency get_telemetry_frequency(Session session, string _pool) + { + return session.JsonRpcClient.pool_get_telemetry_frequency(session.opaque_ref, _pool); + } + + /// + /// Get the telemetry_next_collection field of the given pool. + /// Experimental. First published in 23.9.0. + /// + /// The session + /// The opaque_ref of the given pool + public static DateTime get_telemetry_next_collection(Session session, string _pool) + { + return session.JsonRpcClient.pool_get_telemetry_next_collection(session.opaque_ref, _pool); + } + /// /// Set the name_label field of the given pool. /// First published in XenServer 4.0. @@ -2707,6 +2775,52 @@ namespace XenAPI return session.JsonRpcClient.async_pool_set_https_only(session.opaque_ref, _pool, _value); } + /// + /// Set the timestamp for the next telemetry data collection. + /// Experimental. First published in 23.9.0. + /// + /// The session + /// The opaque_ref of the given pool + /// The earliest timestamp (in UTC) when the next round of telemetry collection can be carried out. + public static void set_telemetry_next_collection(Session session, string _pool, DateTime _value) + { + session.JsonRpcClient.pool_set_telemetry_next_collection(session.opaque_ref, _pool, _value); + } + + /// + /// Set the timestamp for the next telemetry data collection. + /// Experimental. First published in 23.9.0. + /// + /// The session + /// The opaque_ref of the given pool + /// The earliest timestamp (in UTC) when the next round of telemetry collection can be carried out. + public static XenRef async_set_telemetry_next_collection(Session session, string _pool, DateTime _value) + { + return session.JsonRpcClient.async_pool_set_telemetry_next_collection(session.opaque_ref, _pool, _value); + } + + /// + /// Assign a new UUID to telemetry data. + /// Experimental. First published in 23.9.0. + /// + /// The session + /// The opaque_ref of the given pool + public static void reset_telemetry_uuid(Session session, string _pool) + { + session.JsonRpcClient.pool_reset_telemetry_uuid(session.opaque_ref, _pool); + } + + /// + /// Assign a new UUID to telemetry data. + /// Experimental. First published in 23.9.0. + /// + /// The session + /// The opaque_ref of the given pool + public static XenRef async_reset_telemetry_uuid(Session session, string _pool) + { + return session.JsonRpcClient.async_pool_reset_telemetry_uuid(session.opaque_ref, _pool); + } + /// /// Return a list of all the pools known to the system. /// First published in XenServer 4.0. @@ -3524,6 +3638,25 @@ namespace XenAPI } private string _repository_proxy_username = ""; + /// + /// Password for the authentication of the proxy used in syncing with the enabled repositories + /// First published in 21.3.0. + /// + [JsonConverter(typeof(XenRefConverter))] + public virtual XenRef repository_proxy_password + { + get { return _repository_proxy_password; } + set + { + if (!Helper.AreEqual(value, _repository_proxy_password)) + { + _repository_proxy_password = value; + NotifyPropertyChanged("repository_proxy_password"); + } + } + } + private XenRef _repository_proxy_password = new XenRef("OpaqueRef:NULL"); + /// /// Default behaviour during migration, True if stream compression should be used /// Experimental. First published in 22.33.0. @@ -3558,5 +3691,62 @@ namespace XenAPI } } private bool _coordinator_bias = true; + + /// + /// The UUID of the pool for identification of telemetry data + /// Experimental. First published in 23.9.0. + /// + [JsonConverter(typeof(XenRefConverter))] + public virtual XenRef telemetry_uuid + { + get { return _telemetry_uuid; } + set + { + if (!Helper.AreEqual(value, _telemetry_uuid)) + { + _telemetry_uuid = value; + NotifyPropertyChanged("telemetry_uuid"); + } + } + } + private XenRef _telemetry_uuid = new XenRef("OpaqueRef:NULL"); + + /// + /// How often the telemetry collection will be carried out + /// Experimental. First published in 23.9.0. + /// + [JsonConverter(typeof(telemetry_frequencyConverter))] + public virtual telemetry_frequency telemetry_frequency + { + get { return _telemetry_frequency; } + set + { + if (!Helper.AreEqual(value, _telemetry_frequency)) + { + _telemetry_frequency = value; + NotifyPropertyChanged("telemetry_frequency"); + } + } + } + private telemetry_frequency _telemetry_frequency = telemetry_frequency.weekly; + + /// + /// The earliest timestamp (in UTC) when the next round of telemetry collection can be carried out + /// Experimental. First published in 23.9.0. + /// + [JsonConverter(typeof(XenDateTimeConverter))] + public virtual DateTime telemetry_next_collection + { + get { return _telemetry_next_collection; } + set + { + if (!Helper.AreEqual(value, _telemetry_next_collection)) + { + _telemetry_next_collection = value; + NotifyPropertyChanged("telemetry_next_collection"); + } + } + } + private DateTime _telemetry_next_collection = DateTime.ParseExact("19700101T00:00:00Z", "yyyyMMddTHH:mm:ssZ", CultureInfo.InvariantCulture); } } diff --git a/XenModel/XenAPI/VTPM.cs b/XenModel/XenAPI/VTPM.cs index b1b871e58..69e5481b1 100644 --- a/XenModel/XenAPI/VTPM.cs +++ b/XenModel/XenAPI/VTPM.cs @@ -52,6 +52,8 @@ namespace XenAPI } public VTPM(string uuid, + List allowed_operations, + Dictionary current_operations, XenRef VM, XenRef backend, persistence_backend persistence_backend, @@ -59,6 +61,8 @@ namespace XenAPI bool is_protected) { this.uuid = uuid; + this.allowed_operations = allowed_operations; + this.current_operations = current_operations; this.VM = VM; this.backend = backend; this.persistence_backend = persistence_backend; @@ -87,6 +91,8 @@ namespace XenAPI public override void UpdateFrom(VTPM record) { uuid = record.uuid; + allowed_operations = record.allowed_operations; + current_operations = record.current_operations; VM = record.VM; backend = record.backend; persistence_backend = record.persistence_backend; @@ -104,6 +110,10 @@ namespace XenAPI { if (table.ContainsKey("uuid")) uuid = Marshalling.ParseString(table, "uuid"); + if (table.ContainsKey("allowed_operations")) + allowed_operations = Helper.StringArrayToEnumList(Marshalling.ParseStringArray(table, "allowed_operations")); + if (table.ContainsKey("current_operations")) + current_operations = Maps.convert_from_proxy_string_vtpm_operations(Marshalling.ParseHashTable(table, "current_operations")); if (table.ContainsKey("VM")) VM = Marshalling.ParseRef(table, "VM"); if (table.ContainsKey("backend")) @@ -116,14 +126,18 @@ namespace XenAPI is_protected = Marshalling.ParseBool(table, "is_protected"); } - public bool DeepEquals(VTPM other) + public bool DeepEquals(VTPM other, bool ignoreCurrentOperations) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; + if (!ignoreCurrentOperations && !Helper.AreEqual2(this.current_operations, other.current_operations)) + return false; + return Helper.AreEqual2(this._uuid, other._uuid) && + Helper.AreEqual2(this._allowed_operations, other._allowed_operations) && Helper.AreEqual2(this._VM, other._VM) && Helper.AreEqual2(this._backend, other._backend) && Helper.AreEqual2(this._persistence_backend, other._persistence_backend) && @@ -177,6 +191,28 @@ namespace XenAPI return session.JsonRpcClient.vtpm_get_uuid(session.opaque_ref, _vtpm); } + /// + /// Get the allowed_operations field of the given VTPM. + /// First published in XenServer 4.0. + /// + /// The session + /// The opaque_ref of the given vtpm + public static List get_allowed_operations(Session session, string _vtpm) + { + return session.JsonRpcClient.vtpm_get_allowed_operations(session.opaque_ref, _vtpm); + } + + /// + /// Get the current_operations field of the given VTPM. + /// First published in XenServer 4.0. + /// + /// The session + /// The opaque_ref of the given vtpm + public static Dictionary get_current_operations(Session session, string _vtpm) + { + return session.JsonRpcClient.vtpm_get_current_operations(session.opaque_ref, _vtpm); + } + /// /// Get the VM field of the given VTPM. /// First published in XenServer 4.0. @@ -316,6 +352,42 @@ namespace XenAPI } private string _uuid = ""; + /// + /// list of the operations allowed in this state. This list is advisory only and the server state may have changed by the time this field is read by a client. + /// First published in XenServer 4.0. + /// + public virtual List allowed_operations + { + get { return _allowed_operations; } + set + { + if (!Helper.AreEqual(value, _allowed_operations)) + { + _allowed_operations = value; + NotifyPropertyChanged("allowed_operations"); + } + } + } + private List _allowed_operations = new List() {}; + + /// + /// links each of the running tasks using this object (by reference) to a current_operation enum which describes the nature of the task. + /// First published in XenServer 4.0. + /// + public virtual Dictionary current_operations + { + get { return _current_operations; } + set + { + if (!Helper.AreEqual(value, _current_operations)) + { + _current_operations = value; + NotifyPropertyChanged("current_operations"); + } + } + } + private Dictionary _current_operations = new Dictionary() {}; + /// /// The virtual machine the TPM is attached to /// First published in XenServer 4.0. diff --git a/XenModel/XenAPI/domain_type.cs b/XenModel/XenAPI/domain_type.cs index 529e106f5..129c207e1 100644 --- a/XenModel/XenAPI/domain_type.cs +++ b/XenModel/XenAPI/domain_type.cs @@ -48,6 +48,10 @@ namespace XenAPI /// pv_in_pvh, /// + /// PVH + /// + pvh, + /// /// Not specified or unknown domain type /// unspecified, @@ -74,6 +78,8 @@ namespace XenAPI return "pv"; case domain_type.pv_in_pvh: return "pv_in_pvh"; + case domain_type.pvh: + return "pvh"; case domain_type.unspecified: return "unspecified"; default: diff --git a/XenModel/XenAPI/telemetry_frequency.cs b/XenModel/XenAPI/telemetry_frequency.cs new file mode 100644 index 000000000..b1d61eb26 --- /dev/null +++ b/XenModel/XenAPI/telemetry_frequency.cs @@ -0,0 +1,86 @@ +/* + * Copyright (c) Cloud Software Group, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1) Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2) 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 Newtonsoft.Json; + + +namespace XenAPI +{ + [JsonConverter(typeof(telemetry_frequencyConverter))] + public enum telemetry_frequency + { + /// + /// Run telemetry task daily + /// + daily, + /// + /// Run telemetry task weekly + /// + weekly, + /// + /// Run telemetry task monthly + /// + monthly, + unknown + } + + public static class telemetry_frequency_helper + { + public static string ToString(telemetry_frequency x) + { + return x.StringOf(); + } + } + + public static partial class EnumExt + { + public static string StringOf(this telemetry_frequency x) + { + switch (x) + { + case telemetry_frequency.daily: + return "daily"; + case telemetry_frequency.weekly: + return "weekly"; + case telemetry_frequency.monthly: + return "monthly"; + default: + return "unknown"; + } + } + } + + internal class telemetry_frequencyConverter : XenEnumConverter + { + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteValue(((telemetry_frequency)value).StringOf()); + } + } +} \ No newline at end of file diff --git a/XenModel/XenAPI/vm_operations.cs b/XenModel/XenAPI/vm_operations.cs index 772e71876..1f7d5df20 100644 --- a/XenModel/XenAPI/vm_operations.cs +++ b/XenModel/XenAPI/vm_operations.cs @@ -227,6 +227,10 @@ namespace XenAPI /// refers to the act of uninstalling the VM /// destroy, + /// + /// Creating and adding a VTPM to this VM + /// + create_vtpm, unknown } @@ -340,6 +344,8 @@ namespace XenAPI return "reverting"; case vm_operations.destroy: return "destroy"; + case vm_operations.create_vtpm: + return "create_vtpm"; default: return "unknown"; } diff --git a/XenModel/XenAPI/vtpm_operations.cs b/XenModel/XenAPI/vtpm_operations.cs new file mode 100644 index 000000000..710cf6992 --- /dev/null +++ b/XenModel/XenAPI/vtpm_operations.cs @@ -0,0 +1,74 @@ +/* + * Copyright (c) Cloud Software Group, Inc. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1) Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2) 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 Newtonsoft.Json; + + +namespace XenAPI +{ + [JsonConverter(typeof(vtpm_operationsConverter))] + public enum vtpm_operations + { + /// + /// Destroy a VTPM + /// + destroy, + unknown + } + + public static class vtpm_operations_helper + { + public static string ToString(vtpm_operations x) + { + return x.StringOf(); + } + } + + public static partial class EnumExt + { + public static string StringOf(this vtpm_operations x) + { + switch (x) + { + case vtpm_operations.destroy: + return "destroy"; + default: + return "unknown"; + } + } + } + + internal class vtpm_operationsConverter : XenEnumConverter + { + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteValue(((vtpm_operations)value).StringOf()); + } + } +} \ No newline at end of file diff --git a/XenModel/XenModel.csproj b/XenModel/XenModel.csproj index 9524a48de..3a6a9a7e8 100755 --- a/XenModel/XenModel.csproj +++ b/XenModel/XenModel.csproj @@ -391,6 +391,7 @@ + @@ -408,6 +409,7 @@ +