From ad7e7c8117aeb094d47c2b534b5c54196e4dc8fa Mon Sep 17 00:00:00 2001 From: Konstantina Chremmou Date: Thu, 30 Nov 2023 01:26:49 +0000 Subject: [PATCH] CA-379225: Swap the pages of the Export wizard so that VM selection comes first Signed-off-by: Konstantina Chremmou --- XenAdmin/Help/HelpManager.resx | 14 +- .../ExportAppliancePage.Designer.cs | 170 +++++- .../ExportWizard/ExportAppliancePage.cs | 260 +++++--- .../ExportWizard/ExportAppliancePage.resx | 562 +++++++++++++++--- .../ExportWizard/ExportApplianceWizard.cs | 139 +++-- .../Wizards/ExportWizard/ExportFinishPage.cs | 2 + .../ExportSelectVMsPage.Designer.cs | 72 +-- .../ExportWizard/ExportSelectVMsPage.cs | 146 +---- .../ExportWizard/ExportSelectVMsPage.resx | 249 +------- XenAdmin/Wizards/XenWizardBase.cs | 19 +- XenModel/Messages.Designer.cs | 42 +- XenModel/Messages.resx | 16 +- 12 files changed, 956 insertions(+), 735 deletions(-) diff --git a/XenAdmin/Help/HelpManager.resx b/XenAdmin/Help/HelpManager.resx index 61fa898ab3..6c03bfd0a3 100644 --- a/XenAdmin/Help/HelpManager.resx +++ b/XenAdmin/Help/HelpManager.resx @@ -435,9 +435,12 @@ troubleshooting-eventlog - + vms-export-ovf + + vms-export + vms-export-ovf @@ -448,7 +451,7 @@ vms-export - vms-exportimport-about + vms-export-ovf vms-export-ovf @@ -456,11 +459,8 @@ vms-export - - vms-export-ovf - - - vms-export + + vms-exportimport vms-export diff --git a/XenAdmin/Wizards/ExportWizard/ExportAppliancePage.Designer.cs b/XenAdmin/Wizards/ExportWizard/ExportAppliancePage.Designer.cs index 323865d0c2..f7220ed113 100644 --- a/XenAdmin/Wizards/ExportWizard/ExportAppliancePage.Designer.cs +++ b/XenAdmin/Wizards/ExportWizard/ExportAppliancePage.Designer.cs @@ -34,12 +34,31 @@ private void InitializeComponent() this.m_labelSelect = new System.Windows.Forms.Label(); this.m_buttonBrowse = new System.Windows.Forms.Button(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this._tlpWarning = new System.Windows.Forms.TableLayoutPanel(); + this.pictureBox2 = new System.Windows.Forms.PictureBox(); + this.labelWarning = new System.Windows.Forms.Label(); this.m_textBoxApplianceName = new System.Windows.Forms.TextBox(); this.m_textBoxFolderName = new System.Windows.Forms.TextBox(); - this.label1 = new System.Windows.Forms.Label(); - this.m_comboBoxFormat = new System.Windows.Forms.ComboBox(); this.m_ctrlError = new XenAdmin.Controls.Common.PasswordFailure(); + this.groupBoxFormat = new System.Windows.Forms.GroupBox(); + this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); + this._tlpInfoOvf = new System.Windows.Forms.TableLayoutPanel(); + this.pictureBox3 = new System.Windows.Forms.PictureBox(); + this.labelOvf = new System.Windows.Forms.Label(); + this.radioButtonXva = new System.Windows.Forms.RadioButton(); + this._tlpInfoXva = new System.Windows.Forms.TableLayoutPanel(); + this.pictureBox1 = new System.Windows.Forms.PictureBox(); + this.labelXva = new System.Windows.Forms.Label(); + this.radioButtonOvf = new System.Windows.Forms.RadioButton(); this.tableLayoutPanel1.SuspendLayout(); + this._tlpWarning.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit(); + this.groupBoxFormat.SuspendLayout(); + this.tableLayoutPanel2.SuspendLayout(); + this._tlpInfoOvf.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit(); + this._tlpInfoXva.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.SuspendLayout(); // // m_labelIntro @@ -68,17 +87,37 @@ private void InitializeComponent() // tableLayoutPanel1 // resources.ApplyResources(this.tableLayoutPanel1, "tableLayoutPanel1"); + this.tableLayoutPanel1.Controls.Add(this._tlpWarning, 0, 4); this.tableLayoutPanel1.Controls.Add(this.m_labelIntro, 0, 0); - this.tableLayoutPanel1.Controls.Add(this.m_labelApplianceName, 0, 2); - this.tableLayoutPanel1.Controls.Add(this.m_textBoxApplianceName, 1, 2); - this.tableLayoutPanel1.Controls.Add(this.m_labelSelect, 0, 3); - this.tableLayoutPanel1.Controls.Add(this.m_textBoxFolderName, 1, 3); - this.tableLayoutPanel1.Controls.Add(this.m_buttonBrowse, 2, 3); - this.tableLayoutPanel1.Controls.Add(this.label1, 0, 4); - this.tableLayoutPanel1.Controls.Add(this.m_comboBoxFormat, 1, 4); - this.tableLayoutPanel1.Controls.Add(this.m_ctrlError, 1, 5); + this.tableLayoutPanel1.Controls.Add(this.m_labelApplianceName, 0, 1); + this.tableLayoutPanel1.Controls.Add(this.m_textBoxApplianceName, 1, 1); + this.tableLayoutPanel1.Controls.Add(this.m_labelSelect, 0, 2); + this.tableLayoutPanel1.Controls.Add(this.m_textBoxFolderName, 1, 2); + this.tableLayoutPanel1.Controls.Add(this.m_buttonBrowse, 2, 2); + this.tableLayoutPanel1.Controls.Add(this.m_ctrlError, 0, 5); + this.tableLayoutPanel1.Controls.Add(this.groupBoxFormat, 0, 3); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; // + // _tlpWarning + // + resources.ApplyResources(this._tlpWarning, "_tlpWarning"); + this.tableLayoutPanel1.SetColumnSpan(this._tlpWarning, 3); + this._tlpWarning.Controls.Add(this.pictureBox2, 0, 0); + this._tlpWarning.Controls.Add(this.labelWarning, 1, 0); + this._tlpWarning.Name = "_tlpWarning"; + // + // pictureBox2 + // + this.pictureBox2.Image = global::XenAdmin.Properties.Resources._000_Alert2_h32bit_16; + resources.ApplyResources(this.pictureBox2, "pictureBox2"); + this.pictureBox2.Name = "pictureBox2"; + this.pictureBox2.TabStop = false; + // + // labelWarning + // + resources.ApplyResources(this.labelWarning, "labelWarning"); + this.labelWarning.Name = "labelWarning"; + // // m_textBoxApplianceName // resources.ApplyResources(this.m_textBoxApplianceName, "m_textBoxApplianceName"); @@ -91,23 +130,82 @@ private void InitializeComponent() this.m_textBoxFolderName.Name = "m_textBoxFolderName"; this.m_textBoxFolderName.TextChanged += new System.EventHandler(this.m_textBoxFolderName_TextChanged); // - // label1 + // m_ctrlError + // + resources.ApplyResources(this.m_ctrlError, "m_ctrlError"); + this.tableLayoutPanel1.SetColumnSpan(this.m_ctrlError, 3); + this.m_ctrlError.Name = "m_ctrlError"; // - resources.ApplyResources(this.label1, "label1"); - this.label1.Name = "label1"; + // groupBoxFormat // - // m_comboBoxFormat + resources.ApplyResources(this.groupBoxFormat, "groupBoxFormat"); + this.tableLayoutPanel1.SetColumnSpan(this.groupBoxFormat, 3); + this.groupBoxFormat.Controls.Add(this.tableLayoutPanel2); + this.groupBoxFormat.Name = "groupBoxFormat"; + this.groupBoxFormat.TabStop = false; // - resources.ApplyResources(this.m_comboBoxFormat, "m_comboBoxFormat"); - this.m_comboBoxFormat.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.m_comboBoxFormat.FormattingEnabled = true; - this.m_comboBoxFormat.Name = "m_comboBoxFormat"; - this.m_comboBoxFormat.SelectedIndexChanged += new System.EventHandler(this.m_comboBoxFormat_SelectedIndexChanged); + // tableLayoutPanel2 // - // m_ctrlError + resources.ApplyResources(this.tableLayoutPanel2, "tableLayoutPanel2"); + this.tableLayoutPanel2.Controls.Add(this._tlpInfoOvf, 0, 3); + this.tableLayoutPanel2.Controls.Add(this.radioButtonXva, 0, 0); + this.tableLayoutPanel2.Controls.Add(this._tlpInfoXva, 0, 1); + this.tableLayoutPanel2.Controls.Add(this.radioButtonOvf, 0, 2); + this.tableLayoutPanel2.Name = "tableLayoutPanel2"; // - resources.ApplyResources(this.m_ctrlError, "m_ctrlError"); - this.m_ctrlError.Name = "m_ctrlError"; + // _tlpInfoOvf + // + resources.ApplyResources(this._tlpInfoOvf, "_tlpInfoOvf"); + this._tlpInfoOvf.Controls.Add(this.pictureBox3, 0, 0); + this._tlpInfoOvf.Controls.Add(this.labelOvf, 1, 0); + this._tlpInfoOvf.Name = "_tlpInfoOvf"; + // + // pictureBox3 + // + this.pictureBox3.Image = global::XenAdmin.Properties.Resources._000_Info3_h32bit_16; + resources.ApplyResources(this.pictureBox3, "pictureBox3"); + this.pictureBox3.Name = "pictureBox3"; + this.pictureBox3.TabStop = false; + // + // labelOvf + // + resources.ApplyResources(this.labelOvf, "labelOvf"); + this.labelOvf.Name = "labelOvf"; + // + // radioButtonXva + // + resources.ApplyResources(this.radioButtonXva, "radioButtonXva"); + this.radioButtonXva.Name = "radioButtonXva"; + this.radioButtonXva.TabStop = true; + this.radioButtonXva.UseVisualStyleBackColor = true; + this.radioButtonXva.CheckedChanged += new System.EventHandler(this.radioButtonXva_CheckedChanged); + // + // _tlpInfoXva + // + resources.ApplyResources(this._tlpInfoXva, "_tlpInfoXva"); + this._tlpInfoXva.Controls.Add(this.pictureBox1, 0, 0); + this._tlpInfoXva.Controls.Add(this.labelXva, 1, 0); + this._tlpInfoXva.Name = "_tlpInfoXva"; + // + // pictureBox1 + // + this.pictureBox1.Image = global::XenAdmin.Properties.Resources._000_Info3_h32bit_16; + resources.ApplyResources(this.pictureBox1, "pictureBox1"); + this.pictureBox1.Name = "pictureBox1"; + this.pictureBox1.TabStop = false; + // + // labelXva + // + resources.ApplyResources(this.labelXva, "labelXva"); + this.labelXva.Name = "labelXva"; + // + // radioButtonOvf + // + resources.ApplyResources(this.radioButtonOvf, "radioButtonOvf"); + this.radioButtonOvf.Name = "radioButtonOvf"; + this.radioButtonOvf.TabStop = true; + this.radioButtonOvf.UseVisualStyleBackColor = true; + this.radioButtonOvf.CheckedChanged += new System.EventHandler(this.radioButtonOvf_CheckedChanged); // // ExportAppliancePage // @@ -117,6 +215,19 @@ private void InitializeComponent() this.Name = "ExportAppliancePage"; this.tableLayoutPanel1.ResumeLayout(false); this.tableLayoutPanel1.PerformLayout(); + this._tlpWarning.ResumeLayout(false); + this._tlpWarning.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit(); + this.groupBoxFormat.ResumeLayout(false); + this.groupBoxFormat.PerformLayout(); + this.tableLayoutPanel2.ResumeLayout(false); + this.tableLayoutPanel2.PerformLayout(); + this._tlpInfoOvf.ResumeLayout(false); + this._tlpInfoOvf.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).EndInit(); + this._tlpInfoXva.ResumeLayout(false); + this._tlpInfoXva.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); this.ResumeLayout(false); } @@ -129,9 +240,20 @@ private void InitializeComponent() private System.Windows.Forms.Button m_buttonBrowse; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; private XenAdmin.Controls.Common.PasswordFailure m_ctrlError; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.ComboBox m_comboBoxFormat; private System.Windows.Forms.TextBox m_textBoxApplianceName; private System.Windows.Forms.TextBox m_textBoxFolderName; + private System.Windows.Forms.TableLayoutPanel _tlpInfoXva; + private System.Windows.Forms.PictureBox pictureBox1; + private System.Windows.Forms.TableLayoutPanel _tlpWarning; + private System.Windows.Forms.PictureBox pictureBox2; + private System.Windows.Forms.Label labelWarning; + private System.Windows.Forms.RadioButton radioButtonXva; + private System.Windows.Forms.RadioButton radioButtonOvf; + private System.Windows.Forms.GroupBox groupBoxFormat; + private System.Windows.Forms.Label labelXva; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2; + private System.Windows.Forms.TableLayoutPanel _tlpInfoOvf; + private System.Windows.Forms.PictureBox pictureBox3; + private System.Windows.Forms.Label labelOvf; } } diff --git a/XenAdmin/Wizards/ExportWizard/ExportAppliancePage.cs b/XenAdmin/Wizards/ExportWizard/ExportAppliancePage.cs index b59854efdd..756eac4fa0 100644 --- a/XenAdmin/Wizards/ExportWizard/ExportAppliancePage.cs +++ b/XenAdmin/Wizards/ExportWizard/ExportAppliancePage.cs @@ -29,11 +29,15 @@ */ using System; +using System.Collections.Generic; using System.IO; +using System.Linq; using System.Windows.Forms; using XenAdmin.Controls; using XenAdmin.Controls.Common; +using XenAdmin.Core; using XenAdmin.Wizards.ExportWizard.ApplianceChecks; +using XenAPI; using XenCenterLib; using XenModel; @@ -45,12 +49,19 @@ namespace XenAdmin.Wizards.ExportWizard /// internal partial class ExportAppliancePage : XenTabPage { - private bool m_buttonNextEnabled; - public ExportAppliancePage() { InitializeComponent(); - m_ctrlError.HideError(); + try + { + m_textBoxFolderName.Text = Win32.GetKnownFolderPath(Win32.KnownFolders.Downloads); + } + catch + { + //ignore + } + + m_ctrlError.HideError(); } #region Accessors @@ -60,27 +71,18 @@ public ExportAppliancePage() /// this property is used to deduce space requirements on the target drive before the wizard closes /// and the appliance folder is only created once the wizard finishes. /// - public string ApplianceDirectory { get { return m_textBoxFolderName.Text.Trim(); } } + public string ApplianceDirectory => m_textBoxFolderName.Text.Trim(); /// /// Gets or sets the exported appliance name (ovf/ova filename without extension). /// - public string ApplianceFileName - { - get { return m_textBoxApplianceName.Text.Trim(); } - set { m_textBoxApplianceName.Text = value; } - } + public string ApplianceFileName => m_textBoxApplianceName.Text.Trim(); - public bool ExportAsXva - { - get - { - var selectedItem = m_comboBoxFormat.SelectedItem as ToStringWrapper; - return selectedItem == null ? false : selectedItem.item; - } - } + public bool ExportAsXva => radioButtonXva.Checked; - public bool OvfModeOnly { private get; set; } + public List VMsToExport { private get; set; } + + public bool IncludeMemorySnapshot { private get; set; } #endregion @@ -89,97 +91,130 @@ public bool ExportAsXva /// /// Gets the page's title (headline) /// - public override string PageTitle { get { return Messages.EXPORT_APPLIANCE_PAGE_TITLE; } } + public override string PageTitle => Messages.EXPORT_APPLIANCE_PAGE_TITLE; /// /// Gets the page's label in the (left hand side) wizard progress panel /// - public override string Text { get { return Messages.EXPORT_APPLIANCE_PAGE_TEXT; } } + public override string Text => Messages.EXPORT_APPLIANCE_PAGE_TEXT; /// /// Gets the value by which the help files section for this page is identified /// - public override string HelpID { get { return "Appliance"; } } + public override string HelpID => ExportAsXva ? "ApplianceXva" : "ApplianceOvf"; protected override bool ImplementsIsDirty() { return true; } - protected override void PageLoadedCore(PageLoadedDirection direction) - { - if (direction == PageLoadedDirection.Forward) - { - m_textBoxFolderName.Text = Win32.GetKnownFolderPath(Win32.KnownFolders.Downloads); - PerformCheck(CheckPathValid); - } - } - protected override void PageLeaveCore(PageLoadedDirection direction, ref bool cancel) { if (direction == PageLoadedDirection.Forward && IsDirty) { m_textBoxFolderName.Text = m_textBoxFolderName.Text.Trim(); m_textBoxApplianceName.Text = m_textBoxApplianceName.Text.Trim(); - cancel = !PerformCheck(CheckDestinationFolderExists, CheckApplianceExists, CheckPermissions); + cancel = !m_ctrlError.PerformCheck(CheckPathValid, CheckDestinationFolderExists, CheckApplianceExists, CheckPermissions, CheckSpaceRequirements); + OnPageUpdated(); } } public override void PopulatePage() - { - m_comboBoxFormat.Items.Clear(); - var ovfItem = new ToStringWrapper(false, Messages.EXPORT_APPLIANCE_PAGE_FORMAT_OVFOVA); - var xvaItem = new ToStringWrapper(true, Messages.EXPORT_APPLIANCE_PAGE_FORMAT_XVA); + { + m_ctrlError.HideError(); - if (OvfModeOnly) - m_comboBoxFormat.Items.Add(ovfItem); - else - m_comboBoxFormat.Items.AddRange(new[] {ovfItem, xvaItem}); + var bigDiskExists = BigDiskExists(); + var bigDiskMsg = string.Format(Messages.EXPORT_ERROR_EXCEEDS_MAX_SIZE_VDI_OVA_OVF, + Util.DiskSizeString(SR.DISK_MAX_SIZE, 0)); - m_comboBoxFormat.SelectedItem = ovfItem; - } + if (VMsToExport.Count == 1) + { + m_textBoxApplianceName.Text = VMsToExport[0].Name(); + + radioButtonXva.Enabled = radioButtonXva.Checked = true; + radioButtonOvf.Enabled = !IncludeMemorySnapshot && !bigDiskExists; + + if (IncludeMemorySnapshot) + labelOvf.Text = Messages.EXPORT_ERROR_INCLUDES_SNAPSHOT; + else if (bigDiskExists) + labelOvf.Text = bigDiskMsg; + + _tlpInfoXva.Visible = false; + _tlpInfoOvf.Visible = !radioButtonOvf.Enabled; + } + else + { + var vAppRef = VMsToExport.Select(v => v.appliance).Distinct().FirstOrDefault(); + var vApp = Connection.Resolve(vAppRef); + if (vApp != null) + m_textBoxApplianceName.Text = vApp.Name(); + + radioButtonXva.Enabled = false; + radioButtonOvf.Enabled = radioButtonOvf.Checked = !bigDiskExists; + + if (bigDiskExists) + labelOvf.Text = bigDiskMsg; + + _tlpInfoXva.Visible = true; + _tlpInfoOvf.Visible = !radioButtonOvf.Enabled; + } + + CheckVtpm(); + OnPageUpdated(); + } + + private void CheckVtpm() + { + 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 = radioButtonOvf.Checked; + } + else + { + labelWarning.Text = Messages.VTPM_EXPORT_UNSUPPORTED_FOR_ALL; + _tlpWarning.Visible = true; + } + } public override bool EnableNext() { - return m_buttonNextEnabled; + return (radioButtonXva.Enabled && radioButtonXva.Checked || + radioButtonOvf.Enabled && radioButtonOvf.Checked) && + !m_ctrlError.Visible; } #endregion #region Private methods - /// - /// Performs certain checks on the pages's input data and shows/hides an error accordingly - /// - /// The checks to perform - private bool PerformCheck(params CheckDelegate[] checks) - { - m_buttonNextEnabled = m_ctrlError.PerformCheck(checks); - OnPageUpdated(); - return m_buttonNextEnabled; - } - private bool CheckPathValid(out string error) { error = string.Empty; - if (String.IsNullOrEmpty(ApplianceFileName)) + if (string.IsNullOrEmpty(ApplianceFileName)) return false; if (!PathValidator.IsFileNameValid(ApplianceFileName, out string invalidNameMsg)) { - error = string.Join(" ", new []{ Messages.EXPORT_APPLIANCE_PAGE_ERROR_INALID_APP , invalidNameMsg}); + error = string.Join(" ", Messages.EXPORT_APPLIANCE_PAGE_ERROR_INALID_APP, invalidNameMsg); return false; } - if (String.IsNullOrEmpty(ApplianceDirectory)) + if (string.IsNullOrEmpty(ApplianceDirectory)) return false; - string path = String.Format("{0}\\{1}", ApplianceDirectory, ApplianceFileName); + string path = $"{ApplianceDirectory}\\{ApplianceFileName}"; if (!PathValidator.IsPathValid(path, out string invalidPathMsg)) { - error = string.Join(" ", new[] { Messages.EXPORT_APPLIANCE_PAGE_ERROR_INVALID_DIR, invalidPathMsg }); + error = string.Join(" ", Messages.EXPORT_APPLIANCE_PAGE_ERROR_INVALID_DIR, invalidPathMsg); return false; } @@ -219,10 +254,9 @@ private bool CheckDestinationFolderExists(out string error) private bool CheckApplianceExists(out string error) { - - ApplianceCheck.FileExtension extension = m_comboBoxFormat.SelectedItem.ToString().Contains("xva") - ? ApplianceCheck.FileExtension.xva - : ApplianceCheck.FileExtension.ovaovf; + ApplianceCheck.FileExtension extension = radioButtonXva.Checked + ? ApplianceCheck.FileExtension.xva + : ApplianceCheck.FileExtension.ovaovf; ApplianceCheck check = new ApplianceExistsCheck(ApplianceDirectory, ApplianceFileName, extension); check.Validate(); @@ -230,6 +264,73 @@ private bool CheckApplianceExists(out string error) return check.IsValid; } + private bool CheckSpaceRequirements(out string errorMsg) + { + errorMsg = string.Empty; + ulong spaceNeeded = 0; + + foreach (var vm in VMsToExport) + { + spaceNeeded += vm.GetTotalSize(); + + if (IncludeMemorySnapshot) + { + var vdi = vm.Connection.Resolve(vm.suspend_VDI); + if (vdi != null) + spaceNeeded += (ulong)vdi.virtual_size; + } + } + + ulong availableSpace = GetFreeSpace(ApplianceDirectory); + + if (spaceNeeded > availableSpace) + { + errorMsg = string.Format(Messages.EXPORT_SELECTVMS_PAGE_ERROR_TARGET_SPACE_NOT_ENOUGH, + Util.DiskSizeString(availableSpace), Util.DiskSizeString(spaceNeeded)); + + return false; + } + + return true; + } + + private bool BigDiskExists() + { + foreach (var vm in VMsToExport) + { + foreach (var vbdRef in vm.VBDs) + { + var vbd = Connection.Resolve(vbdRef); + if (vbd == null) + continue; + + var vdi = Connection.Resolve(vbd.VDI); + if (vdi == null) + continue; + + if (vdi.virtual_size > SR.DISK_MAX_SIZE) + return true; + } + } + + return false; + } + + private ulong GetFreeSpace(string drivename) + { + if (!drivename.EndsWith(@"\")) + drivename += @"\"; + + long space = 0; + long lpTotalNumberOfBytes = 0; + long lpTotalNumberOfFreeBytes = 0; + + if (Win32.GetDiskFreeSpaceEx(drivename, ref space, ref lpTotalNumberOfBytes, ref lpTotalNumberOfFreeBytes)) + return (ulong)space; + + return 0; + } + #endregion #region Control event handlers @@ -249,21 +350,36 @@ private void m_buttonBrowse_Click(object sender, EventArgs e) private void m_textBoxApplianceName_TextChanged(object sender, EventArgs e) { - PerformCheck(CheckPathValid); - IsDirty = true; + IsDirty = true; + m_ctrlError.PerformCheck(CheckPathValid); + OnPageUpdated(); } private void m_textBoxFolderName_TextChanged(object sender, EventArgs e) { - PerformCheck(CheckPathValid); - IsDirty = true; + IsDirty = true; + m_ctrlError.PerformCheck(CheckPathValid); + OnPageUpdated(); } - private void m_comboBoxFormat_SelectedIndexChanged(object sender, EventArgs e) - { - IsDirty = true; - } + private void radioButtonOvf_CheckedChanged(object sender, EventArgs e) + { + if (radioButtonOvf.Checked) + { + IsDirty = true; + CheckVtpm(); + } + } - #endregion - } + private void radioButtonXva_CheckedChanged(object sender, EventArgs e) + { + if (radioButtonXva.Checked) + { + IsDirty = true; + CheckVtpm(); + } + } + + #endregion + } } diff --git a/XenAdmin/Wizards/ExportWizard/ExportAppliancePage.resx b/XenAdmin/Wizards/ExportWizard/ExportAppliancePage.resx index d5664b7419..99e4f88f6a 100644 --- a/XenAdmin/Wizards/ExportWizard/ExportAppliancePage.resx +++ b/XenAdmin/Wizards/ExportWizard/ExportAppliancePage.resx @@ -112,31 +112,133 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + True 3 - - + + True + + + + GrowAndShrink + + + 2 + + + NoControl + + + + 3, 3 + + + 16, 16 + + + 0 + + + pictureBox2 + + + System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + _tlpWarning + + + 0 + + Left, Right + + True + + + NoControl + + + 25, 4 + + + 498, 13 + + + 0 + + + labelWarning + + + labelWarning + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + _tlpWarning + + + 1 + + + Top + + + 3, 229 + + + 3, 10, 3, 3 + + + 1 + + + 526, 22 + + + 7 + + + False + + + _tlpWarning + + + System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanel1 + + + 0 + + + <?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> + + + Left + True - - 3, 52 + 3, 34 - 51, 13 + 38, 13 1 @@ -148,19 +250,19 @@ m_labelApplianceName - System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 tableLayoutPanel1 - 1 + 2 Left, Right - 60, 49 + 60, 31 388, 20 @@ -172,22 +274,22 @@ m_textBoxApplianceName - System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 tableLayoutPanel1 - 2 + 3 - Left, Right + Left True - 3, 78 + 3, 60 51, 13 @@ -202,19 +304,19 @@ m_labelSelect - System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 tableLayoutPanel1 - 3 + 4 Left, Right - 60, 75 + 60, 57 388, 20 @@ -226,19 +328,19 @@ m_textBoxFolderName - System.Windows.Forms.TextBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 tableLayoutPanel1 - 4 + 5 Left - 454, 73 + 454, 55 3, 0, 3, 0 @@ -256,102 +358,384 @@ m_buttonBrowse - System.Windows.Forms.Button, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.Button, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 tableLayoutPanel1 - 5 - - - Left, Right + 6 - + True - - 3, 105 + + GrowAndShrink - - 51, 13 + + Top - - 6 + + + + + 3, 264 + + + 3, 10, 3, 3 + + + 526, 22 - - Fo&rmat: + + 8 - - label1 + + m_ctrlError - - System.Windows.Forms.Label, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + XenAdmin.Controls.Common.PasswordFailure, [XenCenter], Version=0.0.0.0, Culture=neutral, PublicKeyToken=null - + tableLayoutPanel1 - - 6 + + 7 + + + True + + + GrowAndShrink + + + True + + + GrowAndShrink + + + 1 + + + True + + + GrowAndShrink + + + 2 + + + NoControl + + + 3, 3 - + + 16, 16 + + + 0 + + + pictureBox3 + + + System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + _tlpInfoOvf + + + 0 + + Left, Right - - 60, 101 + + True - - 388, 21 + + NoControl - - 7 + + 22, 4 - - m_comboBoxFormat + + 0, 0, 3, 0 - - System.Windows.Forms.ComboBox, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + 469, 13 - - tableLayoutPanel1 + + 0 - - 7 + + labelOvf - + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + _tlpInfoOvf + + + 1 + + + Fill + + + 20, 77 + + + 20, 3, 3, 3 + + + 1 + + + 494, 22 + + + 3 + + + False + + + _tlpInfoOvf + + + System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanel2 + + + 0 + + + <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="pictureBox3" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="labelOvf" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /></Controls><Columns Styles="AutoSize,0,Percent,100" /><Rows Styles="Percent,100" /></TableLayoutSettings> + + True - + + 3, 3 + + + 98, 17 + + + 0 + + + &XVA File (*.xva) + + + radioButtonXva + + + System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanel2 + + + 1 + + + True + + GrowAndShrink - + + 2 + + + NoControl + + + 3, 3 + + + 16, 16 + + + 0 + + + pictureBox1 + + + System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + _tlpInfoXva + + + 0 + + + Left, Right + + + True + + + 22, 4 + + + 0, 0, 3, 0 + + + 469, 13 + + + 0 + + + vApps and multiple VMs cannot be exported as an XVA file. + + + labelXva + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + _tlpInfoXva + + + 1 + + Fill - - + + 20, 26 - - 57, 125 + + 20, 3, 3, 3 - - 0, 0, 0, 0 + + 1 - - 394, 22 + + 494, 22 - - 8 + + 1 - - m_ctrlError + + False - - XenAdmin.Controls.Common.PasswordFailure, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + + _tlpInfoXva - + + System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanel2 + + + 2 + + + <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="pictureBox1" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="labelXva" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /></Controls><Columns Styles="AutoSize,0,Percent,100" /><Rows Styles="Percent,100" /></TableLayoutSettings> + + + True + + + 3, 54 + + + 181, 17 + + + 2 + + + &OVF/OVA Package (*.ovf, *.ova) + + + radioButtonOvf + + + System.Windows.Forms.RadioButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tableLayoutPanel2 + + + 3 + + + Top + + + 6, 19 + + + 4 + + + 517, 102 + + + 0 + + + tableLayoutPanel2 + + + System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + groupBoxFormat + + + 0 + + + <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="_tlpInfoOvf" Row="3" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="radioButtonXva" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="_tlpInfoXva" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="radioButtonOvf" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /></Controls><Columns Styles="Percent,100" /><Rows Styles="AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0" /></TableLayoutSettings> + + + Top + + + 3, 92 + + + 3, 12, 3, 3 + + + 6, 6, 3, 3 + + + 526, 124 + + + 6 + + + Format + + + groupBoxFormat + + + System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + tableLayoutPanel1 - + 8 @@ -361,10 +745,10 @@ 0, 0 - 7 + 6 - 532, 186 + 532, 350 0 @@ -373,7 +757,7 @@ tableLayoutPanel1 - System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 $this @@ -382,7 +766,7 @@ 0 - <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="m_labelIntro" Row="0" RowSpan="1" Column="0" ColumnSpan="3" /><Control Name="m_labelApplianceName" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="m_textBoxApplianceName" Row="2" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="m_labelSelect" Row="3" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="m_textBoxFolderName" Row="3" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="m_buttonBrowse" Row="3" RowSpan="1" Column="2" ColumnSpan="1" /><Control Name="label1" Row="4" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="m_comboBoxFormat" Row="4" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="m_ctrlError" Row="5" RowSpan="1" Column="1" ColumnSpan="1" /></Controls><Columns Styles="AutoSize,0,Percent,100,AutoSize,0" /><Rows Styles="AutoSize,0,Absolute,20,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,Percent,100" /></TableLayoutSettings> + <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="_tlpWarning" Row="4" RowSpan="1" Column="0" ColumnSpan="3" /><Control Name="m_labelIntro" Row="0" RowSpan="1" Column="0" ColumnSpan="3" /><Control Name="m_labelApplianceName" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="m_textBoxApplianceName" Row="1" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="m_labelSelect" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="m_textBoxFolderName" Row="2" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="m_buttonBrowse" Row="2" RowSpan="1" Column="2" ColumnSpan="1" /><Control Name="m_ctrlError" Row="5" RowSpan="1" Column="0" ColumnSpan="3" /><Control Name="groupBoxFormat" Row="3" RowSpan="1" Column="0" ColumnSpan="3" /></Controls><Columns Styles="AutoSize,0,Percent,100,AutoSize,0" /><Rows Styles="AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,Percent,100,Absolute,20" /></TableLayoutSettings> Fill @@ -390,41 +774,43 @@ 3, 0 + + 3, 0, 3, 15 + - 526, 26 + 526, 13 0 - vApps and multiple VMs can be exported as an OVF/OVA package. -A single VM can be exported as an OVF/OVA package or as an XVA file. + Specify the name and format of the exported package and select a location to save it. m_labelIntro - XenAdmin.Controls.Common.AutoHeightLabel, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + XenAdmin.Controls.Common.AutoHeightLabel, [XenCenter], Version=0.0.0.0, Culture=neutral, PublicKeyToken=null tableLayoutPanel1 - 0 + 1 - + True 96, 96 - 532, 186 + 532, 350 ExportAppliancePage - XenAdmin.Wizards.GenericPages.ImExPortPage, XenCenterMain, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + XenAdmin.Controls.XenTabPage, [XenCenter], Version=0.0.0.0, Culture=neutral, PublicKeyToken=null \ No newline at end of file diff --git a/XenAdmin/Wizards/ExportWizard/ExportApplianceWizard.cs b/XenAdmin/Wizards/ExportWizard/ExportApplianceWizard.cs index 549db229f2..f96ecd72e5 100644 --- a/XenAdmin/Wizards/ExportWizard/ExportApplianceWizard.cs +++ b/XenAdmin/Wizards/ExportWizard/ExportApplianceWizard.cs @@ -56,8 +56,8 @@ internal partial class ExportApplianceWizard : XenWizardBase private readonly ExportFinishPage m_pageFinish; #endregion - private IXenObject m_selectedObject; - private bool? m_exportAsXva; + private bool _xvaMode = true; + private bool _rbacRequired; public ExportApplianceWizard(IXenConnection con, SelectedItemCollection selection) : base(con) @@ -71,21 +71,25 @@ public ExportApplianceWizard(IXenConnection con, SelectedItemCollection selectio m_pageExportOptions = new ExportOptionsPage(); m_pageFinish = new ExportFinishPage(); - m_selectedObject = selection.FirstAsXenObject; - - if (selection.Count == 1 && (m_selectedObject is VM || m_selectedObject is VM_appliance)) - m_pageExportAppliance.ApplianceFileName = m_selectedObject.Name(); - - m_pageExportAppliance.OvfModeOnly = m_selectedObject is VM_appliance; m_pageFinish.SummaryRetriever = GetSummary; m_pageExportSelectVMs.SelectedItems = selection; - AddPages(m_pageExportAppliance, m_pageExportSelectVMs, m_pageFinish); - } + AddPages(m_pageExportSelectVMs, m_pageExportAppliance, m_pageFinish); + + _rbacRequired = Helpers.ConnectionRequiresRbac(xenConnection); + + if (_rbacRequired) + AddAfterPage(m_pageExportAppliance, m_pageRbac); + + if (selection.Count == 1 && selection[0].XenObject is VM_appliance || selection.Count > 1) + _xvaMode = false; + + UpdateMode(); + } protected override void FinishWizard() { - if ((bool)m_exportAsXva) + if (_xvaMode) { var filename = Path.Combine(m_pageExportAppliance.ApplianceDirectory, m_pageExportAppliance.ApplianceFileName); if (!filename.EndsWith(".xva")) @@ -120,78 +124,62 @@ protected override void UpdateWizardContent(XenTabPage page) { Type type = page.GetType(); - if (type == typeof(ExportAppliancePage)) - { - var oldExportasXva = m_exportAsXva; - m_exportAsXva = m_pageExportAppliance.ExportAsXva; //this ensures that m_exportAsXva is assigned a value - - var ovfPages = new XenTabPage[] {m_pageExportEula, m_pageExportOptions}; - - if (oldExportasXva != m_exportAsXva) - { - RemovePage(m_pageRbac); - - if ((bool)m_exportAsXva) - { - Text = Messages.MAINWINDOW_XVA_TITLE; - pictureBoxWizard.Image = Images.StaticImages.export_32; - RemovePages(ovfPages); - } - else - { - Text = Messages.EXPORT_APPLIANCE; - pictureBoxWizard.Image = Images.StaticImages._000_ExportVirtualAppliance_h32bit_32; - AddAfterPage(m_pageExportSelectVMs, ovfPages); - } - - if (Helpers.ConnectionRequiresRbac(xenConnection)) - AddRbacPage(); + if (type == typeof(ExportSelectVMsPage)) + { + m_pageExportAppliance.VMsToExport = m_pageExportSelectVMs.VMsToExport; + m_pageExportAppliance.IncludeMemorySnapshot = m_pageExportSelectVMs.IncludeMemorySnapshot; + + if (_xvaMode && m_pageExportSelectVMs.VMsToExport.Count > 1) + { + _xvaMode = false; + UpdateMode(); + RemovePages(m_pageFinish); + AddPages(m_pageExportEula, m_pageExportOptions, m_pageFinish); } - m_pageExportSelectVMs.ExportAsXva = (bool)m_exportAsXva; - - if (m_pageExportSelectVMs.ApplianceDirectory != m_pageExportAppliance.ApplianceDirectory) - NotifyNextPagesOfChange(m_pageExportSelectVMs); - - m_pageExportSelectVMs.ApplianceDirectory = m_pageExportAppliance.ApplianceDirectory; + NotifyNextPagesOfChange(m_pageExportAppliance); + } + else if (type == typeof(ExportAppliancePage)) + { + var oldXvaMode = _xvaMode; + _xvaMode = m_pageExportAppliance.ExportAsXva; //this ensures that m_exportAsXva is assigned a value + + if (_xvaMode != oldXvaMode) + { + UpdateMode(); + + if (_xvaMode) + { + RemovePages(m_pageExportEula, m_pageExportOptions); + } + else + { + RemovePages(m_pageFinish); + AddPages(m_pageExportEula, m_pageExportOptions, m_pageFinish); + } + } - m_pageFinish.ExportAsXva = (bool)m_exportAsXva; + m_pageFinish.ExportAsXva = _xvaMode; } if (type != typeof(ExportFinishPage)) NotifyNextPagesOfChange(m_pageFinish); } - private void AddRbacPage() - { - var exportAsXva = m_exportAsXva.HasValue && m_exportAsXva.Value; - - var rbacDependencies = exportAsXva ? ExportVmAction.StaticRBACDependencies : ExportApplianceAction.StaticRBACDependencies; - var message = exportAsXva ? Messages.RBAC_WARNING_EXPORT_WIZARD_XVA : Messages.RBAC_WARNING_EXPORT_WIZARD_APPLIANCE; - - m_pageRbac.SetPermissionChecks(xenConnection, - new WizardRbacCheck(message, rbacDependencies) {Blocking = true}); - - AddAfterPage(m_pageExportAppliance, m_pageRbac); - } - protected override string WizardPaneHelpID() { var curPageType = CurrentStepTabPage.GetType(); if (curPageType == typeof(RBACWarningPage)) - return FormatHelpId((bool)m_exportAsXva ? "RbacExportXva" : "RbacExportOvf"); - - if (curPageType == typeof(ExportFinishPage)) - return FormatHelpId((bool)m_exportAsXva ? "ExportFinishXva" : "ExportFinishOvf"); + return FormatHelpId(_xvaMode ? "RbacExportXva" : "RbacExportOvf"); return base.WizardPaneHelpID(); } protected override IEnumerable GetSummary() - { - return (bool)m_exportAsXva ? GetSummaryXva() : GetSummaryOvf(); - } + { + return _xvaMode ? GetSummaryXva() : GetSummaryOvf(); + } private IEnumerable GetSummaryOvf() { @@ -236,5 +224,28 @@ private IEnumerable GetSummaryXva() return temp; } + + private void UpdateMode() + { + Text = _xvaMode ? Messages.MAINWINDOW_XVA_TITLE : Messages.EXPORT_APPLIANCE; + + pictureBoxWizard.Image = _xvaMode + ? Images.StaticImages.export_32 + : Images.StaticImages._000_ExportVirtualAppliance_h32bit_32; + + if (_rbacRequired) + { + var dependencies = _xvaMode + ? ExportVmAction.StaticRBACDependencies + : ExportApplianceAction.StaticRBACDependencies; + + var message = _xvaMode + ? Messages.RBAC_WARNING_EXPORT_WIZARD_XVA + : Messages.RBAC_WARNING_EXPORT_WIZARD_APPLIANCE; + + m_pageRbac.SetPermissionChecks(xenConnection, + new WizardRbacCheck(message, dependencies) { Blocking = true }); + } + } } } diff --git a/XenAdmin/Wizards/ExportWizard/ExportFinishPage.cs b/XenAdmin/Wizards/ExportWizard/ExportFinishPage.cs index 33b9afbc61..da8ddf4026 100644 --- a/XenAdmin/Wizards/ExportWizard/ExportFinishPage.cs +++ b/XenAdmin/Wizards/ExportWizard/ExportFinishPage.cs @@ -50,6 +50,8 @@ public ExportFinishPage() #region Base class (XenTabPage) overrides + public override string HelpID => ExportAsXva ? "ExportFinishXva" : "ExportFinishOvf"; + /// /// The pages' label in the (left hand side) wizard progress panel /// diff --git a/XenAdmin/Wizards/ExportWizard/ExportSelectVMsPage.Designer.cs b/XenAdmin/Wizards/ExportWizard/ExportSelectVMsPage.Designer.cs index 024a879d52..27018ea43f 100644 --- a/XenAdmin/Wizards/ExportWizard/ExportSelectVMsPage.Designer.cs +++ b/XenAdmin/Wizards/ExportWizard/ExportSelectVMsPage.Designer.cs @@ -30,14 +30,10 @@ private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ExportSelectVMsPage)); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); - this.m_ctrlError = new XenAdmin.Controls.Common.PasswordFailure(); this.m_labelIntro = new XenAdmin.Controls.Common.AutoHeightLabel(); this.m_buttonSelectAll = new System.Windows.Forms.Button(); this.m_buttonClearAll = new System.Windows.Forms.Button(); this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); - this.m_tlpInfo = new System.Windows.Forms.TableLayoutPanel(); - this.pictureBox1 = new System.Windows.Forms.PictureBox(); - this.autoHeightLabel1 = new XenAdmin.Controls.Common.AutoHeightLabel(); this.m_dataGridView = new System.Windows.Forms.DataGridView(); this.columnTick = new System.Windows.Forms.DataGridViewCheckBoxColumn(); this.columnImage = new System.Windows.Forms.DataGridViewImageColumn(); @@ -50,30 +46,18 @@ private void InitializeComponent() this.tableLayoutPanel4 = new System.Windows.Forms.TableLayoutPanel(); this.m_searchTextBox = new XenAdmin.Controls.SearchTextBox(); this.label2 = new System.Windows.Forms.Label(); - this._tlpWarning = new System.Windows.Forms.TableLayoutPanel(); - this.pictureBox2 = new System.Windows.Forms.PictureBox(); - this.labelWarning = new System.Windows.Forms.Label(); this.groupBoxSuspended = new System.Windows.Forms.GroupBox(); this.tableLayoutPanelSuspended = new System.Windows.Forms.TableLayoutPanel(); this.radioButtonDiscardSnapshot = new System.Windows.Forms.RadioButton(); this.radioButtonIncludeSnapshot = new System.Windows.Forms.RadioButton(); this.tableLayoutPanel2.SuspendLayout(); - this.m_tlpInfo.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.m_dataGridView)).BeginInit(); this.tableLayoutPanel3.SuspendLayout(); this.tableLayoutPanel4.SuspendLayout(); - this._tlpWarning.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit(); this.groupBoxSuspended.SuspendLayout(); this.tableLayoutPanelSuspended.SuspendLayout(); this.SuspendLayout(); // - // m_ctrlError - // - resources.ApplyResources(this.m_ctrlError, "m_ctrlError"); - this.m_ctrlError.Name = "m_ctrlError"; - // // m_labelIntro // resources.ApplyResources(this.m_labelIntro, "m_labelIntro"); @@ -96,35 +80,13 @@ private void InitializeComponent() // tableLayoutPanel2 // resources.ApplyResources(this.tableLayoutPanel2, "tableLayoutPanel2"); - this.tableLayoutPanel2.Controls.Add(this.m_ctrlError, 0, 7); this.tableLayoutPanel2.Controls.Add(this.m_labelIntro, 0, 0); - this.tableLayoutPanel2.Controls.Add(this.m_tlpInfo, 0, 5); this.tableLayoutPanel2.Controls.Add(this.m_dataGridView, 0, 2); this.tableLayoutPanel2.Controls.Add(this.tableLayoutPanel3, 0, 3); this.tableLayoutPanel2.Controls.Add(this.tableLayoutPanel4, 0, 1); - this.tableLayoutPanel2.Controls.Add(this._tlpWarning, 0, 6); this.tableLayoutPanel2.Controls.Add(this.groupBoxSuspended, 0, 4); this.tableLayoutPanel2.Name = "tableLayoutPanel2"; // - // m_tlpInfo - // - resources.ApplyResources(this.m_tlpInfo, "m_tlpInfo"); - this.m_tlpInfo.Controls.Add(this.pictureBox1, 0, 0); - this.m_tlpInfo.Controls.Add(this.autoHeightLabel1, 1, 0); - this.m_tlpInfo.Name = "m_tlpInfo"; - // - // pictureBox1 - // - this.pictureBox1.Image = global::XenAdmin.Properties.Resources._000_Info3_h32bit_16; - resources.ApplyResources(this.pictureBox1, "pictureBox1"); - this.pictureBox1.Name = "pictureBox1"; - this.pictureBox1.TabStop = false; - // - // autoHeightLabel1 - // - resources.ApplyResources(this.autoHeightLabel1, "autoHeightLabel1"); - this.autoHeightLabel1.Name = "autoHeightLabel1"; - // // m_dataGridView // this.m_dataGridView.AllowUserToAddRows = false; @@ -226,25 +188,6 @@ private void InitializeComponent() resources.ApplyResources(this.label2, "label2"); this.label2.Name = "label2"; // - // _tlpWarning - // - resources.ApplyResources(this._tlpWarning, "_tlpWarning"); - this._tlpWarning.Controls.Add(this.pictureBox2, 0, 0); - this._tlpWarning.Controls.Add(this.labelWarning, 1, 0); - this._tlpWarning.Name = "_tlpWarning"; - // - // pictureBox2 - // - this.pictureBox2.Image = global::XenAdmin.Properties.Resources._000_Alert2_h32bit_16; - resources.ApplyResources(this.pictureBox2, "pictureBox2"); - this.pictureBox2.Name = "pictureBox2"; - this.pictureBox2.TabStop = false; - // - // labelWarning - // - resources.ApplyResources(this.labelWarning, "labelWarning"); - this.labelWarning.Name = "labelWarning"; - // // groupBoxSuspended // resources.ApplyResources(this.groupBoxSuspended, "groupBoxSuspended"); @@ -266,12 +209,14 @@ private void InitializeComponent() this.radioButtonDiscardSnapshot.Name = "radioButtonDiscardSnapshot"; this.radioButtonDiscardSnapshot.TabStop = true; this.radioButtonDiscardSnapshot.UseVisualStyleBackColor = true; + this.radioButtonDiscardSnapshot.CheckedChanged += new System.EventHandler(this.radioButtonDiscardSnapshot_CheckedChanged); // // radioButtonIncludeSnapshot // resources.ApplyResources(this.radioButtonIncludeSnapshot, "radioButtonIncludeSnapshot"); this.radioButtonIncludeSnapshot.Name = "radioButtonIncludeSnapshot"; this.radioButtonIncludeSnapshot.UseVisualStyleBackColor = true; + this.radioButtonIncludeSnapshot.CheckedChanged += new System.EventHandler(this.radioButtonIncludeSnapshot_CheckedChanged); // // ExportSelectVMsPage // @@ -281,17 +226,11 @@ private void InitializeComponent() this.Name = "ExportSelectVMsPage"; this.tableLayoutPanel2.ResumeLayout(false); this.tableLayoutPanel2.PerformLayout(); - this.m_tlpInfo.ResumeLayout(false); - this.m_tlpInfo.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.m_dataGridView)).EndInit(); this.tableLayoutPanel3.ResumeLayout(false); this.tableLayoutPanel3.PerformLayout(); this.tableLayoutPanel4.ResumeLayout(false); this.tableLayoutPanel4.PerformLayout(); - this._tlpWarning.ResumeLayout(false); - this._tlpWarning.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit(); this.groupBoxSuspended.ResumeLayout(false); this.groupBoxSuspended.PerformLayout(); this.tableLayoutPanelSuspended.ResumeLayout(false); @@ -304,13 +243,9 @@ private void InitializeComponent() #endregion private XenAdmin.Controls.Common.AutoHeightLabel m_labelIntro; - private XenAdmin.Controls.Common.PasswordFailure m_ctrlError; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2; private System.Windows.Forms.Button m_buttonSelectAll; private System.Windows.Forms.Button m_buttonClearAll; - private System.Windows.Forms.TableLayoutPanel m_tlpInfo; - private System.Windows.Forms.PictureBox pictureBox1; - private XenAdmin.Controls.Common.AutoHeightLabel autoHeightLabel1; private System.Windows.Forms.DataGridView m_dataGridView; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel3; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel4; @@ -323,9 +258,6 @@ private void InitializeComponent() private System.Windows.Forms.DataGridViewTextBoxColumn columnDesc; private System.Windows.Forms.DataGridViewTextBoxColumn columnSize; private System.Windows.Forms.DataGridViewTextBoxColumn columnVapp; - private System.Windows.Forms.TableLayoutPanel _tlpWarning; - private System.Windows.Forms.PictureBox pictureBox2; - private System.Windows.Forms.Label labelWarning; private System.Windows.Forms.TableLayoutPanel tableLayoutPanelSuspended; private System.Windows.Forms.RadioButton radioButtonDiscardSnapshot; private System.Windows.Forms.RadioButton radioButtonIncludeSnapshot; diff --git a/XenAdmin/Wizards/ExportWizard/ExportSelectVMsPage.cs b/XenAdmin/Wizards/ExportWizard/ExportSelectVMsPage.cs index 8cc1d4602f..32d1c4df1a 100644 --- a/XenAdmin/Wizards/ExportWizard/ExportSelectVMsPage.cs +++ b/XenAdmin/Wizards/ExportWizard/ExportSelectVMsPage.cs @@ -34,11 +34,9 @@ using System.Linq; using System.Windows.Forms; using XenAdmin.Commands; -using XenAdmin.Controls.Common; +using XenAdmin.Controls; using XenAdmin.Core; using XenAPI; -using XenAdmin.Controls; -using XenCenterLib; namespace XenAdmin.Wizards.ExportWizard @@ -54,9 +52,6 @@ internal partial class ExportSelectVMsPage : XenTabPage public ExportSelectVMsPage() { InitializeComponent(); - m_tlpInfo.Visible = false; - _tlpWarning.Visible = false; - m_ctrlError.HideError(); } #region Accessors @@ -66,17 +61,13 @@ public ExportSelectVMsPage() /// public List VMsToExport { get; } = new List(); - public string ApplianceDirectory { get; set; } - /// /// The items selected on the main window treeview when the wizard was launched. /// These determine the VMs selected by default. /// public SelectedItemCollection SelectedItems { private get; set; } - public bool ExportAsXva { private get; set; } - - public bool IncludeMemorySnapshot => ExportAsXva && radioButtonIncludeSnapshot.Checked; + public bool IncludeMemorySnapshot => groupBoxSuspended.Enabled && radioButtonIncludeSnapshot.Checked; #endregion @@ -85,9 +76,7 @@ public ExportSelectVMsPage() /// /// Gets the page's title (headline) /// - public override string PageTitle => ExportAsXva - ? Messages.EXPORT_SELECTVMS_PAGE_TITLE_XVA - : Messages.EXPORT_SELECTVMS_PAGE_TITLE_OVF; + public override string PageTitle => Messages.EXPORT_SELECTVMS_PAGE_TITLE; /// /// Gets the page's label in the (left hand side) wizard progress panel @@ -97,7 +86,7 @@ public ExportSelectVMsPage() /// /// Gets the value by which the help files section for this page is identified /// - public override string HelpID => ExportAsXva ? "SelectVMsXva" : "SelectVMsOvf"; + public override string HelpID => "SelectVMs"; protected override bool ImplementsIsDirty() { @@ -106,16 +95,9 @@ protected override bool ImplementsIsDirty() protected override void PageLoadedCore(PageLoadedDirection direction) { - m_ctrlError.HideError(); EnableButtons(); } - protected override void PageLeaveCore(PageLoadedDirection direction, ref bool cancel) - { - if (direction == PageLoadedDirection.Forward && IsDirty) - cancel = !PerformCheck(CheckDiskSizeForTransfer, CheckSpaceRequirements); - } - public override void PopulatePage() { var pool = Helpers.GetPoolOfOne(Connection); @@ -132,18 +114,24 @@ public override void PopulatePage() if (SelectedItems != null && SelectedItems.FirstIs()) applianceVMs.AddRange(((VM_appliance)SelectedItems.FirstAsXenObject).VMs); + var rows = new List(); + foreach (var vm in Connection.Cache.VMs.Where(vm => IsVmExportable(vm) && MatchesSearchText(vm))) { VM curVm = vm; //closure below bool selected = SelectedItems != null && (SelectedItems.AsXenObjects().Contains(vm) || applianceVMs.FirstOrDefault(xenref => xenref.opaque_ref == curVm.opaque_ref) != null); - m_dataGridView.Rows.Add(new VmRow(vm, selected)); + if (vm.power_state == vm_power_state.Suspended) + groupBoxSuspended.Visible = true; + + rows.Add(new VmRow(vm, selected)); if (selected) VMsToExport.Add(vm); } + m_dataGridView.Rows.AddRange(rows.ToArray()); m_dataGridView.Sort(columnTick, ListSortDirection.Descending); } finally @@ -164,17 +152,6 @@ public override bool EnableNext() #region Private methods - /// - /// Performs certain checks on the page's input data and shows/hides an error accordingly - /// - /// The checks to perform - private bool PerformCheck(params CheckDelegate[] checks) - { - m_buttonNextEnabled = m_ctrlError.PerformCheck(checks); - OnPageUpdated(); - return m_buttonNextEnabled; - } - private bool IsVmExportable(VM vm) { if (!vm.IsRealVm()) @@ -197,96 +174,12 @@ private bool MatchesSearchText(VM vm) return m_searchTextBox.Matches(vm.Name()); } - private bool CheckSpaceRequirements(out string errorMsg) - { - errorMsg = string.Empty; - ulong spaceNeeded = 0; - - foreach (DataGridViewRow row in m_dataGridView.Rows) - { - if (!(row is VmRow vmRow) || !vmRow.IsTicked) - continue; - - spaceNeeded += vmRow.VmTotalSize; - - if (IncludeMemorySnapshot) - { - var vdi = vmRow.Vm.Connection.Resolve(vmRow.Vm.suspend_VDI); - if (vdi != null) - spaceNeeded += (ulong)vdi.virtual_size; - } - } - - ulong availableSpace = GetFreeSpace(ApplianceDirectory); - - if (spaceNeeded > availableSpace) - { - errorMsg = string.Format(Messages.EXPORT_SELECTVMS_PAGE_ERROR_TARGET_SPACE_NOT_ENOUGH, - Util.DiskSizeString(availableSpace), Util.DiskSizeString(spaceNeeded)); - - return false; - } - - return true; - } - - private bool CheckDiskSizeForTransfer(out string errorMsg) - { - errorMsg = string.Empty; - var maxDiskSizeString = Util.DiskSizeString(SR.DISK_MAX_SIZE, 0); - - foreach (VM vm in VMsToExport) - { - if (!ExportAsXva && vm.GetTotalSize() > SR.DISK_MAX_SIZE) - { - errorMsg = string.Format(Messages.EXPORT_ERROR_EXCEEDS_MAX_SIZE_VDI_OVA_OVF, maxDiskSizeString); - return false; - } - } - - return true; - } - - //TODO: improve method - private ulong GetFreeSpace(string drivename) - { - if (!drivename.EndsWith(@"\")) - drivename += @"\"; - - long space = 0; - long lpTotalNumberOfBytes = 0; - long lpTotalNumberOfFreeBytes = 0; - - if (Win32.GetDiskFreeSpaceEx(drivename, ref space, ref lpTotalNumberOfBytes, ref lpTotalNumberOfFreeBytes)) - return (ulong)space; - - return 0; - } - private void EnableButtons() { var count = VMsToExport.Count; - m_tlpInfo.Visible = ExportAsXva && count > 1; - - 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; - } - groupBoxSuspended.Visible = ExportAsXva && VMsToExport.Any(v => v.power_state == vm_power_state.Suspended); - m_buttonNextEnabled = ExportAsXva ? count == 1 : count > 0; + groupBoxSuspended.Enabled = count == 1 && VMsToExport[0].power_state == vm_power_state.Suspended; + m_buttonNextEnabled = count > 0; m_buttonClearAll.Enabled = count > 0; m_buttonSelectAll.Enabled = count < m_dataGridView.RowCount; OnPageUpdated(); @@ -415,7 +308,6 @@ private void m_dataGridView_CellValueChanged(object sender, DataGridViewCellEven } } - m_ctrlError.HideError(); UpdateCounterLabel(); IsDirty = true; EnableButtons(); @@ -450,6 +342,18 @@ private void m_dataGridView_SortCompare(object sender, DataGridViewSortCompareEv e.Handled = true; } + private void radioButtonDiscardSnapshot_CheckedChanged(object sender, EventArgs e) + { + if (radioButtonDiscardSnapshot.Checked) + IsDirty = true; + } + + private void radioButtonIncludeSnapshot_CheckedChanged(object sender, EventArgs e) + { + if (radioButtonIncludeSnapshot.Checked) + IsDirty = true; + } + #endregion } } diff --git a/XenAdmin/Wizards/ExportWizard/ExportSelectVMsPage.resx b/XenAdmin/Wizards/ExportWizard/ExportSelectVMsPage.resx index 6c7f36c0d1..6d558812b5 100644 --- a/XenAdmin/Wizards/ExportWizard/ExportSelectVMsPage.resx +++ b/XenAdmin/Wizards/ExportWizard/ExportSelectVMsPage.resx @@ -118,53 +118,17 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - True - - - - GrowAndShrink - - - Fill - - - - - - - 0, 356 - - - 0, 0, 0, 0 - - - 579, 22 - - - 7 - - - m_ctrlError - - - XenAdmin.Controls.Common.PasswordFailure, [XenCenter], Version=0.0.0.0, Culture=neutral, PublicKeyToken=null - - - tableLayoutPanel2 - - - 0 - True + Fill NoControl + 3, 0 @@ -191,7 +155,7 @@ Note that only VMs that are currently shut down or suspended are listed here.tableLayoutPanel2 - 1 + 0 NoControl @@ -256,99 +220,6 @@ Note that only VMs that are currently shut down or suspended are listed here. 1 - - True - - - GrowAndShrink - - - 2 - - - 3, 3 - - - 16, 16 - - - 0 - - - pictureBox1 - - - System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - m_tlpInfo - - - 0 - - - True - - - Fill - - - 25, 0 - - - 545, 26 - - - 0 - - - Only one VM may be selected for export in XVA format. To export multiple VMs, go back to the previous page and select OVF/OVA Package as the export format. - - - MiddleLeft - - - autoHeightLabel1 - - - XenAdmin.Controls.Common.AutoHeightLabel, [XenCenter], Version=0.0.0.0, Culture=neutral, PublicKeyToken=null - - - m_tlpInfo - - - 1 - - - Fill - - - 3, 299 - - - 1 - - - 573, 26 - - - 5 - - - m_tlpInfo - - - System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tableLayoutPanel2 - - - 2 - - - <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="pictureBox1" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="autoHeightLabel1" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /></Controls><Columns Styles="AutoSize,0,Percent,100" /><Rows Styles="Percent,100" /></TableLayoutSettings> - True @@ -386,7 +257,7 @@ Note that only VMs that are currently shut down or suspended are listed here.True - Disk Size + Total Disk Size True @@ -401,10 +272,10 @@ Note that only VMs that are currently shut down or suspended are listed here.3, 68 - 573, 125 + 573, 207 - 2 + 1 m_dataGridView @@ -416,7 +287,7 @@ Note that only VMs that are currently shut down or suspended are listed here.tableLayoutPanel2 - 3 + 1 True @@ -458,7 +329,7 @@ Note that only VMs that are currently shut down or suspended are listed here.Fill - 0, 196 + 0, 278 0, 0, 0, 0 @@ -482,7 +353,7 @@ Note that only VMs that are currently shut down or suspended are listed here.tableLayoutPanel2 - 4 + 2 <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="m_buttonSelectAll" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="m_buttonClearAll" Row="0" RowSpan="1" Column="2" ColumnSpan="1" /><Control Name="m_labelCounter" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /></Controls><Columns Styles="Percent,100,AutoSize,0,AutoSize,0" /><Rows Styles="AutoSize,0" /></TableLayoutSettings> @@ -563,7 +434,7 @@ Note that only VMs that are currently shut down or suspended are listed here.579, 29 - 1 + 2 tableLayoutPanel4 @@ -575,101 +446,11 @@ Note that only VMs that are currently shut down or suspended are listed here.tableLayoutPanel2 - 5 + 3 <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="m_searchTextBox" Row="0" RowSpan="1" Column="1" ColumnSpan="1" /><Control Name="label2" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /></Controls><Columns Styles="Percent,100,AutoSize,0" /><Rows Styles="AutoSize,0" /></TableLayoutSettings> - - True - - - GrowAndShrink - - - 2 - - - 3, 3 - - - 16, 16 - - - 0 - - - pictureBox2 - - - System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - _tlpWarning - - - 0 - - - True - - - Fill - - - 25, 0 - - - 545, 22 - - - 0 - - - labelWarning - - - labelWarning - - - System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - _tlpWarning - - - 1 - - - Fill - - - 3, 331 - - - 1 - - - 573, 22 - - - 6 - - - _tlpWarning - - - System.Windows.Forms.TableLayoutPanel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - tableLayoutPanel2 - - - 6 - - - <?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> - True @@ -785,7 +566,7 @@ Note that only VMs that are currently shut down or suspended are listed here.Fill - 3, 228 + 3, 310 573, 65 @@ -809,7 +590,7 @@ Note that only VMs that are currently shut down or suspended are listed here.tableLayoutPanel2 - 7 + 4 Fill @@ -818,7 +599,7 @@ Note that only VMs that are currently shut down or suspended are listed here.0, 0 - 8 + 5 579, 378 @@ -839,7 +620,7 @@ Note that only VMs that are currently shut down or suspended are listed here.0 - <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="m_ctrlError" Row="7" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="m_labelIntro" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="m_tlpInfo" Row="5" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="m_dataGridView" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="tableLayoutPanel3" Row="3" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="tableLayoutPanel4" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="_tlpWarning" Row="6" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="groupBoxSuspended" Row="4" RowSpan="1" Column="0" ColumnSpan="1" /></Controls><Columns Styles="Percent,100" /><Rows Styles="AutoSize,0,AutoSize,0,Percent,100,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,AutoSize,0,Absolute,20" /></TableLayoutSettings> + <?xml version="1.0" encoding="utf-16"?><TableLayoutSettings><Controls><Control Name="m_labelIntro" Row="0" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="m_dataGridView" Row="2" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="tableLayoutPanel3" Row="3" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="tableLayoutPanel4" Row="1" RowSpan="1" Column="0" ColumnSpan="1" /><Control Name="groupBoxSuspended" Row="4" RowSpan="1" Column="0" ColumnSpan="1" /></Controls><Columns Styles="Percent,100" /><Rows Styles="AutoSize,0,AutoSize,0,Percent,100,AutoSize,0,AutoSize,0" /></TableLayoutSettings> True diff --git a/XenAdmin/Wizards/XenWizardBase.cs b/XenAdmin/Wizards/XenWizardBase.cs index 12b1ee6f31..15435f0b4d 100644 --- a/XenAdmin/Wizards/XenWizardBase.cs +++ b/XenAdmin/Wizards/XenWizardBase.cs @@ -43,6 +43,7 @@ namespace XenAdmin.Wizards public partial class XenWizardBase : Form, IFormWithHelp { private IXenConnection connection; // connection to use + private bool wizardFinished; protected IXenConnection xenConnection { @@ -74,20 +75,12 @@ protected DeprecationBanner Banner } /// - /// Add a given page to the end of the wizard's page collection + /// Insert a page into the wizard's page collection at the specified index. + /// If the index is not specified, the page is added at the end. /// /// The page to add - protected void AddPage(XenTabPage page) - { - AddPage(page, -1); - } - - /// - /// Insert a page into the wizard's page collection at the specified index - /// - /// The page to add - /// The index at which the page will be inserted - protected void AddPage(XenTabPage page, int index) + /// The index at which the page will be inserted. + protected void AddPage(XenTabPage page, int index = -1) { xenTabControlBody.Controls.Add(page); page.Dock = DockStyle.Fill; @@ -244,8 +237,6 @@ protected virtual void OnCancel(ref bool cancel) DialogResult = DialogResult.Cancel; } - bool wizardFinished = false; - protected virtual void FinishWizard() { DialogResult = DialogResult.OK; diff --git a/XenModel/Messages.Designer.cs b/XenModel/Messages.Designer.cs index a6a5aa2de3..4c299784bb 100755 --- a/XenModel/Messages.Designer.cs +++ b/XenModel/Messages.Designer.cs @@ -16834,24 +16834,6 @@ public static string EXPORT_APPLIANCE_PAGE_ERROR_PERMISSIONS { } } - /// - /// Looks up a localized string similar to OVF/OVA Package (*.ovf, *.ova). - /// - public static string EXPORT_APPLIANCE_PAGE_FORMAT_OVFOVA { - get { - return ResourceManager.GetString("EXPORT_APPLIANCE_PAGE_FORMAT_OVFOVA", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to XVA File (*.xva). - /// - public static string EXPORT_APPLIANCE_PAGE_FORMAT_XVA { - get { - return ResourceManager.GetString("EXPORT_APPLIANCE_PAGE_FORMAT_XVA", resourceCulture); - } - } - /// /// Looks up a localized string similar to Export File Details. /// @@ -16888,6 +16870,15 @@ public static string EXPORT_ERROR_EXCEEDS_MAX_SIZE_VDI_OVA_OVF { } } + /// + /// Looks up a localized string similar to A single VM that includes the memory snapshot cannot be exported as an OVF/OVA package.. + /// + public static string EXPORT_ERROR_INCLUDES_SNAPSHOT { + get { + return ResourceManager.GetString("EXPORT_ERROR_INCLUDES_SNAPSHOT", resourceCulture); + } + } + /// /// Looks up a localized string similar to The maximum number of EULAs that can be included in the appliance is {0}. Selected EULA documents exceeding this number will not be added to the appliance. Click OK to proceed or Cancel to go back and change you selection.. /// @@ -17051,20 +17042,11 @@ public static string EXPORT_SELECTVMS_PAGE_TEXT { } /// - /// Looks up a localized string similar to Confirm which VMs to include in the OVF/OVA package. - /// - public static string EXPORT_SELECTVMS_PAGE_TITLE_OVF { - get { - return ResourceManager.GetString("EXPORT_SELECTVMS_PAGE_TITLE_OVF", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Confirm which VM to export. + /// Looks up a localized string similar to Confirm which VMs to export. /// - public static string EXPORT_SELECTVMS_PAGE_TITLE_XVA { + public static string EXPORT_SELECTVMS_PAGE_TITLE { get { - return ResourceManager.GetString("EXPORT_SELECTVMS_PAGE_TITLE_XVA", resourceCulture); + return ResourceManager.GetString("EXPORT_SELECTVMS_PAGE_TITLE", resourceCulture); } } diff --git a/XenModel/Messages.resx b/XenModel/Messages.resx index 0965f193c4..5b207b9a50 100755 --- a/XenModel/Messages.resx +++ b/XenModel/Messages.resx @@ -5905,12 +5905,6 @@ Would you like to eject these ISOs before continuing? You do not have write permission on the destination directory. - - OVF/OVA Package (*.ovf, *.ova) - - - XVA File (*.xva) - Export File Details @@ -5923,6 +5917,9 @@ Would you like to eject these ISOs before continuing? VMs with disks greater than {0} cannot be exported as an OVF/OVA package. + + A single VM that includes the memory snapshot cannot be exported as an OVF/OVA package. + The maximum number of EULAs that can be included in the appliance is {0}. Selected EULA documents exceeding this number will not be added to the appliance. Click OK to proceed or Cancel to go back and change you selection. @@ -5977,11 +5974,8 @@ Would you like to eject these ISOs before continuing? Virtual Machines - - Confirm which VMs to include in the OVF/OVA package - - - Confirm which VM to export + + Confirm which VMs to export &Export Snapshot As Template...