Merge pull request #3139 from kc284/vtpm-CP-42691

CP-39687+CP-42691: XVA export for VMs with vTPMs is now supported; use allowed_operations for enabling vTPM add/remove
This commit is contained in:
Konstantina Chremmou 2023-04-25 17:06:49 +01:00 committed by GitHub
commit d24409d132
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 748 additions and 61 deletions

View File

@ -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);
}

View File

@ -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)

View File

@ -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;
}
}

View File

@ -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;

View File

@ -148,7 +148,7 @@
<value>m_ctrlError</value>
</data>
<data name="&gt;&gt;m_ctrlError.Type" xml:space="preserve">
<value>XenAdmin.Controls.Common.PasswordFailure, [XenCenter_No_Space]Main, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</value>
<value>XenAdmin.Controls.Common.PasswordFailure, [XenCenter_No_Space], Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;m_ctrlError.Parent" xml:space="preserve">
<value>tableLayoutPanel2</value>
@ -185,7 +185,7 @@ Note that only VMs that are currently shut down or suspended are listed here.</v
<value>m_labelIntro</value>
</data>
<data name="&gt;&gt;m_labelIntro.Type" xml:space="preserve">
<value>XenAdmin.Controls.Common.AutoHeightLabel, [XenCenter_No_Space]Main, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</value>
<value>XenAdmin.Controls.Common.AutoHeightLabel, [XenCenter_No_Space], Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;m_labelIntro.Parent" xml:space="preserve">
<value>tableLayoutPanel2</value>
@ -311,7 +311,7 @@ Note that only VMs that are currently shut down or suspended are listed here.</v
<value>autoHeightLabel1</value>
</data>
<data name="&gt;&gt;autoHeightLabel1.Type" xml:space="preserve">
<value>XenAdmin.Controls.Common.AutoHeightLabel, [XenCenter_No_Space]Main, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</value>
<value>XenAdmin.Controls.Common.AutoHeightLabel, [XenCenter_No_Space], Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;autoHeightLabel1.Parent" xml:space="preserve">
<value>m_tlpInfo</value>
@ -323,7 +323,7 @@ Note that only VMs that are currently shut down or suspended are listed here.</v
<value>Fill</value>
</data>
<data name="m_tlpInfo.Location" type="System.Drawing.Point, System.Drawing">
<value>3, 295</value>
<value>3, 299</value>
</data>
<data name="m_tlpInfo.RowCount" type="System.Int32, mscorlib">
<value>1</value>
@ -392,7 +392,7 @@ Note that only VMs that are currently shut down or suspended are listed here.</v
<value>6, 3, 6, 3</value>
</data>
<data name="m_dataGridView.Size" type="System.Drawing.Size, System.Drawing">
<value>567, 180</value>
<value>567, 184</value>
</data>
<data name="m_dataGridView.TabIndex" type="System.Int32, mscorlib">
<value>102</value>
@ -452,7 +452,7 @@ Note that only VMs that are currently shut down or suspended are listed here.</v
<value>Fill</value>
</data>
<data name="tableLayoutPanel3.Location" type="System.Drawing.Point, System.Drawing">
<value>3, 260</value>
<value>3, 264</value>
</data>
<data name="tableLayoutPanel3.RowCount" type="System.Int32, mscorlib">
<value>1</value>
@ -500,7 +500,7 @@ Note that only VMs that are currently shut down or suspended are listed here.</v
<value>m_searchTextBox</value>
</data>
<data name="&gt;&gt;m_searchTextBox.Type" xml:space="preserve">
<value>XenAdmin.Controls.SearchTextBox, [XenCenter_No_Space]Main, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</value>
<value>XenAdmin.Controls.SearchTextBox, [XenCenter_No_Space], Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
<data name="&gt;&gt;m_searchTextBox.Parent" xml:space="preserve">
<value>tableLayoutPanel4</value>
@ -598,47 +598,47 @@ Note that only VMs that are currently shut down or suspended are listed here.</v
<data name="&gt;&gt;pictureBox2.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="label1.AutoSize" type="System.Boolean, mscorlib">
<data name="labelWarning.AutoSize" type="System.Boolean, mscorlib">
<value>True</value>
</data>
<data name="label1.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<data name="labelWarning.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
</data>
<data name="label1.Location" type="System.Drawing.Point, System.Drawing">
<data name="labelWarning.Location" type="System.Drawing.Point, System.Drawing">
<value>25, 0</value>
</data>
<data name="label1.Size" type="System.Drawing.Size, System.Drawing">
<value>545, 26</value>
<data name="labelWarning.Size" type="System.Drawing.Size, System.Drawing">
<value>545, 22</value>
</data>
<data name="label1.TabIndex" type="System.Int32, mscorlib">
<data name="labelWarning.TabIndex" type="System.Int32, mscorlib">
<value>1</value>
</data>
<data name="label1.Text" xml:space="preserve">
<value>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.</value>
<data name="labelWarning.Text" xml:space="preserve">
<value>labelWarning</value>
</data>
<data name="&gt;&gt;label1.Name" xml:space="preserve">
<value>label1</value>
<data name="&gt;&gt;labelWarning.Name" xml:space="preserve">
<value>labelWarning</value>
</data>
<data name="&gt;&gt;label1.Type" xml:space="preserve">
<data name="&gt;&gt;labelWarning.Type" xml:space="preserve">
<value>System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;label1.Parent" xml:space="preserve">
<data name="&gt;&gt;labelWarning.Parent" xml:space="preserve">
<value>_tlpWarning</value>
</data>
<data name="&gt;&gt;label1.ZOrder" xml:space="preserve">
<data name="&gt;&gt;labelWarning.ZOrder" xml:space="preserve">
<value>1</value>
</data>
<data name="_tlpWarning.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
</data>
<data name="_tlpWarning.Location" type="System.Drawing.Point, System.Drawing">
<value>3, 327</value>
<value>3, 331</value>
</data>
<data name="_tlpWarning.RowCount" type="System.Int32, mscorlib">
<value>1</value>
</data>
<data name="_tlpWarning.Size" type="System.Drawing.Size, System.Drawing">
<value>573, 26</value>
<value>573, 22</value>
</data>
<data name="_tlpWarning.TabIndex" type="System.Int32, mscorlib">
<value>105</value>
@ -656,7 +656,7 @@ Note that only VMs that are currently shut down or suspended are listed here.</v
<value>6</value>
</data>
<data name="_tlpWarning.LayoutSettings" type="System.Windows.Forms.TableLayoutSettings, System.Windows.Forms">
<value>&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;TableLayoutSettings&gt;&lt;Controls&gt;&lt;Control Name="pictureBox2" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="label1" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;/Controls&gt;&lt;Columns Styles="AutoSize,0,Percent,100" /&gt;&lt;Rows Styles="AutoSize,0" /&gt;&lt;/TableLayoutSettings&gt;</value>
<value>&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;TableLayoutSettings&gt;&lt;Controls&gt;&lt;Control Name="pictureBox2" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /&gt;&lt;Control Name="labelWarning" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /&gt;&lt;/Controls&gt;&lt;Columns Styles="AutoSize,0,Percent,100" /&gt;&lt;Rows Styles="AutoSize,0" /&gt;&lt;/TableLayoutSettings&gt;</value>
</data>
<data name="tableLayoutPanel2.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
@ -731,6 +731,6 @@ Note that only VMs that are currently shut down or suspended are listed here.</v
<value>ExportSelectVMsPage</value>
</data>
<data name="&gt;&gt;$this.Type" xml:space="preserve">
<value>XenAdmin.Controls.XenTabPage, [XenCenter_No_Space]Main, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</value>
<value>XenAdmin.Controls.XenTabPage, [XenCenter_No_Space], Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</value>
</data>
</root>

View File

@ -313,11 +313,11 @@
<Compile Include="Dialogs\VtpmManagementPage.Designer.cs">
<DependentUpon>VtpmManagementPage.cs</DependentUpon>
</Compile>
<Compile Include="Dialogs\VtmpManagementDialog.cs">
<Compile Include="Dialogs\VtpmManagementDialog.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Dialogs\VtmpManagementDialog.Designer.cs">
<DependentUpon>VtmpManagementDialog.cs</DependentUpon>
<Compile Include="Dialogs\VtpmManagementDialog.Designer.cs">
<DependentUpon>VtpmManagementDialog.cs</DependentUpon>
</Compile>
<Compile Include="Dialogs\OptionsPages\ConfirmationOptionsPage.cs">
<SubType>UserControl</SubType>
@ -1804,16 +1804,16 @@
<EmbeddedResource Include="Dialogs\VtpmManagementPage.zh-CN.resx">
<DependentUpon>VtpmManagementPage.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Dialogs\VtmpManagementDialog.ja.resx">
<DependentUpon>VtmpManagementDialog.cs</DependentUpon>
<EmbeddedResource Include="Dialogs\VtpmManagementDialog.ja.resx">
<DependentUpon>VtpmManagementDialog.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Dialogs\VtmpManagementDialog.resx">
<DependentUpon>VtmpManagementDialog.cs</DependentUpon>
<EmbeddedResource Include="Dialogs\VtpmManagementDialog.resx">
<DependentUpon>VtpmManagementDialog.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Dialogs\VtmpManagementDialog.zh-CN.resx">
<DependentUpon>VtmpManagementDialog.cs</DependentUpon>
<EmbeddedResource Include="Dialogs\VtpmManagementDialog.zh-CN.resx">
<DependentUpon>VtpmManagementDialog.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Dialogs\OptionsPages\ConfirmationOptionsPage.ja.resx">

View File

@ -275,7 +275,12 @@ namespace XenAdmin.Actions.VMActions
private void AssignVtpm()
{
if (_assignVtpm)
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);
}

View File

@ -40129,6 +40129,24 @@ namespace XenAdmin {
}
}
/// <summary>
/// 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&apos; security features may be deactivated and the VMs may not start..
/// </summary>
public static string VTPM_EXPORT_UNSUPPORTED_FOR_ALL {
get {
return ResourceManager.GetString("VTPM_EXPORT_UNSUPPORTED_FOR_ALL", resourceCulture);
}
}
/// <summary>
/// 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&apos; security features may be deactivated and the VMs may not start..
/// </summary>
public static string VTPM_EXPORT_UNSUPPORTED_FOR_OVF {
get {
return ResourceManager.GetString("VTPM_EXPORT_UNSUPPORTED_FOR_OVF", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The maximum number of vTPMs that can be attached to this VM is {0}..
/// </summary>
@ -40165,6 +40183,24 @@ namespace XenAdmin {
}
}
/// <summary>
/// Looks up a localized string similar to Attaching a new vTPM to this VM is currently not allowed..
/// </summary>
public static string VTPM_OPERATION_DISALLOWED_ADD {
get {
return ResourceManager.GetString("VTPM_OPERATION_DISALLOWED_ADD", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Removing this vTPM from the VM is currently not allowed..
/// </summary>
public static string VTPM_OPERATION_DISALLOWED_REMOVE {
get {
return ResourceManager.GetString("VTPM_OPERATION_DISALLOWED_REMOVE", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to You need to shut down this VM before you can attach a new vTPM to it..
/// </summary>

View File

@ -13861,6 +13861,12 @@ Schedule:
<data name="VTPM_ATTACHED_ONE" xml:space="preserve">
<value>A vTPM is attached to this VM.</value>
</data>
<data name="VTPM_EXPORT_UNSUPPORTED_FOR_ALL" xml:space="preserve">
<value>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.</value>
</data>
<data name="VTPM_EXPORT_UNSUPPORTED_FOR_OVF" xml:space="preserve">
<value>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.</value>
</data>
<data name="VTPM_MAX_REACHED" xml:space="preserve">
<value>The maximum number of vTPMs that can be attached to this VM is {0}.</value>
</data>
@ -13873,6 +13879,12 @@ Schedule:
<data name="VTPM_NONE_ATTACHED" xml:space="preserve">
<value>There are no vTPMs attached to this VM.</value>
</data>
<data name="VTPM_OPERATION_DISALLOWED_ADD" xml:space="preserve">
<value>Attaching a new vTPM to this VM is currently not allowed.</value>
</data>
<data name="VTPM_OPERATION_DISALLOWED_REMOVE" xml:space="preserve">
<value>Removing this vTPM from the VM is currently not allowed.</value>
</data>
<data name="VTPM_POWER_STATE_WRONG_ATTACH" xml:space="preserve">
<value>You need to shut down this VM before you can attach a new vTPM to it.</value>
</data>

View File

@ -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
}
}

View File

@ -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;
}

View File

@ -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 {
}
/// <summary>
/// Looks up a localized string similar to The dynamic memory range violates constraint static_min &lt;= 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..
/// </summary>
public static string MEMORY_CONSTRAINT_VIOLATION_MAXPIN {
get {
@ -5375,6 +5375,15 @@ namespace XenAPI {
}
}
/// <summary>
/// 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..
/// </summary>
public static string TELEMETRY_NEXT_COLLECTION_TOO_LATE {
get {
return ResourceManager.GetString("TELEMETRY_NEXT_COLLECTION_TOO_LATE", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Cannot contact the other host using TLS on the specified address and port.
/// </summary>

View File

@ -748,7 +748,7 @@
<value>The dynamic memory range does not satisfy the following constraint.</value>
</data>
<data name="MEMORY_CONSTRAINT_VIOLATION_MAXPIN" xml:space="preserve">
<value>The dynamic memory range violates constraint static_min &lt;= dynamic_min = dynamic_max = static_max.</value>
<value>The dynamic memory range violates constraint static_min = dynamic_min = dynamic_max = static_max.</value>
</data>
<data name="MEMORY_CONSTRAINT_VIOLATION_ORDER" xml:space="preserve">
<value>The dynamic memory range violates constraint static_min &lt;= dynamic_min &lt;= dynamic_max &lt;= static_max.</value>
@ -1892,6 +1892,9 @@ Authorized Roles: {1}</value>
<data name="TASK_CANCELLED" xml:space="preserve">
<value>The request was asynchronously canceled.</value>
</data>
<data name="TELEMETRY_NEXT_COLLECTION_TOO_LATE" xml:space="preserve">
<value>The next scheduled telemetry data collection is too far into the future. Pick a timestamp within two telemetry intervals starting from now.</value>
</data>
<data name="TLS_CONNECTION_FAILED" xml:space="preserve">
<value>Cannot contact the other host using TLS on the specified address and port</value>
</data>

View File

@ -1116,6 +1116,13 @@ namespace XenAPI
return Rpc<string>("pool.get_repository_proxy_username", new JArray(session, _pool ?? ""), serializer);
}
public XenRef<Secret> pool_get_repository_proxy_password(string session, string _pool)
{
var converters = new List<JsonConverter> {new XenRefConverter<Secret>()};
var serializer = CreateSerializer(converters);
return Rpc<XenRef<Secret>>("pool.get_repository_proxy_password", new JArray(session, _pool ?? ""), serializer);
}
public bool pool_get_migration_compression(string session, string _pool)
{
var converters = new List<JsonConverter> {};
@ -1130,6 +1137,27 @@ namespace XenAPI
return Rpc<bool>("pool.get_coordinator_bias", new JArray(session, _pool ?? ""), serializer);
}
public XenRef<Secret> pool_get_telemetry_uuid(string session, string _pool)
{
var converters = new List<JsonConverter> {new XenRefConverter<Secret>()};
var serializer = CreateSerializer(converters);
return Rpc<XenRef<Secret>>("pool.get_telemetry_uuid", new JArray(session, _pool ?? ""), serializer);
}
public telemetry_frequency pool_get_telemetry_frequency(string session, string _pool)
{
var converters = new List<JsonConverter> {new telemetry_frequencyConverter()};
var serializer = CreateSerializer(converters);
return Rpc<telemetry_frequency>("pool.get_telemetry_frequency", new JArray(session, _pool ?? ""), serializer);
}
public DateTime pool_get_telemetry_next_collection(string session, string _pool)
{
var converters = new List<JsonConverter> {new XenDateTimeConverter()};
var serializer = CreateSerializer(converters);
return Rpc<DateTime>("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<JsonConverter> {};
@ -2145,6 +2173,34 @@ namespace XenAPI
return Rpc<XenRef<Task>>("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<JsonConverter> {new XenDateTimeConverter()};
var serializer = CreateSerializer(converters);
Rpc("pool.set_telemetry_next_collection", new JArray(session, _pool ?? "", _value), serializer);
}
public XenRef<Task> async_pool_set_telemetry_next_collection(string session, string _pool, DateTime _value)
{
var converters = new List<JsonConverter> {new XenRefConverter<Task>(), new XenDateTimeConverter()};
var serializer = CreateSerializer(converters);
return Rpc<XenRef<Task>>("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<JsonConverter> {};
var serializer = CreateSerializer(converters);
Rpc("pool.reset_telemetry_uuid", new JArray(session, _pool ?? ""), serializer);
}
public XenRef<Task> async_pool_reset_telemetry_uuid(string session, string _pool)
{
var converters = new List<JsonConverter> {new XenRefConverter<Task>()};
var serializer = CreateSerializer(converters);
return Rpc<XenRef<Task>>("Async.pool.reset_telemetry_uuid", new JArray(session, _pool ?? ""), serializer);
}
public List<XenRef<Pool>> pool_get_all(string session)
{
var converters = new List<JsonConverter> {new XenRefListConverter<Pool>()};
@ -11938,6 +11994,20 @@ namespace XenAPI
return Rpc<string>("VTPM.get_uuid", new JArray(session, _vtpm ?? ""), serializer);
}
public List<vtpm_operations> vtpm_get_allowed_operations(string session, string _vtpm)
{
var converters = new List<JsonConverter> {};
var serializer = CreateSerializer(converters);
return Rpc<List<vtpm_operations>>("VTPM.get_allowed_operations", new JArray(session, _vtpm ?? ""), serializer);
}
public Dictionary<string, vtpm_operations> vtpm_get_current_operations(string session, string _vtpm)
{
var converters = new List<JsonConverter> {};
var serializer = CreateSerializer(converters);
return Rpc<Dictionary<string, vtpm_operations>>("VTPM.get_current_operations", new JArray(session, _vtpm ?? ""), serializer);
}
public XenRef<VM> vtpm_get_vm(string session, string _vtpm)
{
var converters = new List<JsonConverter> {new XenRefConverter<VM>()};

View File

@ -680,6 +680,52 @@ using System.Collections.Generic;
}
internal static Dictionary<string, vtpm_operations> convert_from_proxy_string_vtpm_operations(Object o)
{
Hashtable table = (Hashtable)o;
Dictionary<string, vtpm_operations> result = new Dictionary<string, vtpm_operations>();
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<string, vtpm_operations> 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<string, vusb_operations> convert_from_proxy_string_vusb_operations(Object o)
{
Hashtable table = (Hashtable)o;

View File

@ -95,8 +95,12 @@ namespace XenAPI
string client_certificate_auth_name,
string repository_proxy_url,
string repository_proxy_username,
XenRef<Secret> repository_proxy_password,
bool migration_compression,
bool coordinator_bias)
bool coordinator_bias,
XenRef<Secret> 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;
}
/// <summary>
@ -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;
}
/// <summary>
@ -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<Secret>(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<Secret>(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);
}
/// <summary>
/// Get the repository_proxy_password field of the given pool.
/// First published in 21.3.0.
/// </summary>
/// <param name="session">The session</param>
/// <param name="_pool">The opaque_ref of the given pool</param>
public static XenRef<Secret> get_repository_proxy_password(Session session, string _pool)
{
return session.JsonRpcClient.pool_get_repository_proxy_password(session.opaque_ref, _pool);
}
/// <summary>
/// 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);
}
/// <summary>
/// Get the telemetry_uuid field of the given pool.
/// Experimental. First published in 23.9.0.
/// </summary>
/// <param name="session">The session</param>
/// <param name="_pool">The opaque_ref of the given pool</param>
public static XenRef<Secret> get_telemetry_uuid(Session session, string _pool)
{
return session.JsonRpcClient.pool_get_telemetry_uuid(session.opaque_ref, _pool);
}
/// <summary>
/// Get the telemetry_frequency field of the given pool.
/// Experimental. First published in 23.9.0.
/// </summary>
/// <param name="session">The session</param>
/// <param name="_pool">The opaque_ref of the given pool</param>
public static telemetry_frequency get_telemetry_frequency(Session session, string _pool)
{
return session.JsonRpcClient.pool_get_telemetry_frequency(session.opaque_ref, _pool);
}
/// <summary>
/// Get the telemetry_next_collection field of the given pool.
/// Experimental. First published in 23.9.0.
/// </summary>
/// <param name="session">The session</param>
/// <param name="_pool">The opaque_ref of the given pool</param>
public static DateTime get_telemetry_next_collection(Session session, string _pool)
{
return session.JsonRpcClient.pool_get_telemetry_next_collection(session.opaque_ref, _pool);
}
/// <summary>
/// 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);
}
/// <summary>
/// Set the timestamp for the next telemetry data collection.
/// Experimental. First published in 23.9.0.
/// </summary>
/// <param name="session">The session</param>
/// <param name="_pool">The opaque_ref of the given pool</param>
/// <param name="_value">The earliest timestamp (in UTC) when the next round of telemetry collection can be carried out.</param>
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);
}
/// <summary>
/// Set the timestamp for the next telemetry data collection.
/// Experimental. First published in 23.9.0.
/// </summary>
/// <param name="session">The session</param>
/// <param name="_pool">The opaque_ref of the given pool</param>
/// <param name="_value">The earliest timestamp (in UTC) when the next round of telemetry collection can be carried out.</param>
public static XenRef<Task> 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);
}
/// <summary>
/// Assign a new UUID to telemetry data.
/// Experimental. First published in 23.9.0.
/// </summary>
/// <param name="session">The session</param>
/// <param name="_pool">The opaque_ref of the given pool</param>
public static void reset_telemetry_uuid(Session session, string _pool)
{
session.JsonRpcClient.pool_reset_telemetry_uuid(session.opaque_ref, _pool);
}
/// <summary>
/// Assign a new UUID to telemetry data.
/// Experimental. First published in 23.9.0.
/// </summary>
/// <param name="session">The session</param>
/// <param name="_pool">The opaque_ref of the given pool</param>
public static XenRef<Task> async_reset_telemetry_uuid(Session session, string _pool)
{
return session.JsonRpcClient.async_pool_reset_telemetry_uuid(session.opaque_ref, _pool);
}
/// <summary>
/// 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 = "";
/// <summary>
/// Password for the authentication of the proxy used in syncing with the enabled repositories
/// First published in 21.3.0.
/// </summary>
[JsonConverter(typeof(XenRefConverter<Secret>))]
public virtual XenRef<Secret> 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<Secret> _repository_proxy_password = new XenRef<Secret>("OpaqueRef:NULL");
/// <summary>
/// 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;
/// <summary>
/// The UUID of the pool for identification of telemetry data
/// Experimental. First published in 23.9.0.
/// </summary>
[JsonConverter(typeof(XenRefConverter<Secret>))]
public virtual XenRef<Secret> telemetry_uuid
{
get { return _telemetry_uuid; }
set
{
if (!Helper.AreEqual(value, _telemetry_uuid))
{
_telemetry_uuid = value;
NotifyPropertyChanged("telemetry_uuid");
}
}
}
private XenRef<Secret> _telemetry_uuid = new XenRef<Secret>("OpaqueRef:NULL");
/// <summary>
/// How often the telemetry collection will be carried out
/// Experimental. First published in 23.9.0.
/// </summary>
[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;
/// <summary>
/// The earliest timestamp (in UTC) when the next round of telemetry collection can be carried out
/// Experimental. First published in 23.9.0.
/// </summary>
[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);
}
}

View File

@ -52,6 +52,8 @@ namespace XenAPI
}
public VTPM(string uuid,
List<vtpm_operations> allowed_operations,
Dictionary<string, vtpm_operations> current_operations,
XenRef<VM> VM,
XenRef<VM> 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<vtpm_operations>(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<VM>(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);
}
/// <summary>
/// Get the allowed_operations field of the given VTPM.
/// First published in XenServer 4.0.
/// </summary>
/// <param name="session">The session</param>
/// <param name="_vtpm">The opaque_ref of the given vtpm</param>
public static List<vtpm_operations> get_allowed_operations(Session session, string _vtpm)
{
return session.JsonRpcClient.vtpm_get_allowed_operations(session.opaque_ref, _vtpm);
}
/// <summary>
/// Get the current_operations field of the given VTPM.
/// First published in XenServer 4.0.
/// </summary>
/// <param name="session">The session</param>
/// <param name="_vtpm">The opaque_ref of the given vtpm</param>
public static Dictionary<string, vtpm_operations> get_current_operations(Session session, string _vtpm)
{
return session.JsonRpcClient.vtpm_get_current_operations(session.opaque_ref, _vtpm);
}
/// <summary>
/// Get the VM field of the given VTPM.
/// First published in XenServer 4.0.
@ -316,6 +352,42 @@ namespace XenAPI
}
private string _uuid = "";
/// <summary>
/// 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.
/// </summary>
public virtual List<vtpm_operations> allowed_operations
{
get { return _allowed_operations; }
set
{
if (!Helper.AreEqual(value, _allowed_operations))
{
_allowed_operations = value;
NotifyPropertyChanged("allowed_operations");
}
}
}
private List<vtpm_operations> _allowed_operations = new List<vtpm_operations>() {};
/// <summary>
/// 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.
/// </summary>
public virtual Dictionary<string, vtpm_operations> current_operations
{
get { return _current_operations; }
set
{
if (!Helper.AreEqual(value, _current_operations))
{
_current_operations = value;
NotifyPropertyChanged("current_operations");
}
}
}
private Dictionary<string, vtpm_operations> _current_operations = new Dictionary<string, vtpm_operations>() {};
/// <summary>
/// The virtual machine the TPM is attached to
/// First published in XenServer 4.0.

View File

@ -48,6 +48,10 @@ namespace XenAPI
/// </summary>
pv_in_pvh,
/// <summary>
/// PVH
/// </summary>
pvh,
/// <summary>
/// Not specified or unknown domain type
/// </summary>
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:

View File

@ -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
{
/// <summary>
/// Run telemetry task daily
/// </summary>
daily,
/// <summary>
/// Run telemetry task weekly
/// </summary>
weekly,
/// <summary>
/// Run telemetry task monthly
/// </summary>
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());
}
}
}

View File

@ -227,6 +227,10 @@ namespace XenAPI
/// refers to the act of uninstalling the VM
/// </summary>
destroy,
/// <summary>
/// Creating and adding a VTPM to this VM
/// </summary>
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";
}

View File

@ -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
{
/// <summary>
/// Destroy a VTPM
/// </summary>
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());
}
}
}

View File

@ -391,6 +391,7 @@
<Compile Include="XenAPI\sriov_configuration_mode.cs" />
<Compile Include="XenAPI\sr_health.cs" />
<Compile Include="XenAPI\Sr_stat.cs" />
<Compile Include="XenAPI\telemetry_frequency.cs" />
<Compile Include="XenAPI\tristate_type.cs" />
<Compile Include="XenAPI\tunnel_protocol.cs" />
<Compile Include="XenAPI\update_after_apply_guidance.cs" />
@ -408,6 +409,7 @@
<Compile Include="XenAPI\vmss_type.cs" />
<Compile Include="XenAPI\VM_appliance.cs" />
<Compile Include="XenAPI\vm_appliance_operation.cs" />
<Compile Include="XenAPI\vtpm_operations.cs" />
<Compile Include="XenAPI\VUSB.cs" />
<Compile Include="XenAPI\vusb_operations.cs" />
<Compile Include="XenSearch\Common.cs" />