mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-23 20:36:33 +01:00
Do not expose the Ovf project's settings to the other projects in the solution.
Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
This commit is contained in:
parent
0024bb9f09
commit
57b8d8f5cb
@ -30,6 +30,7 @@
|
||||
*/
|
||||
|
||||
using XenAdmin.Controls;
|
||||
using XenAdmin.Actions.VMActions;
|
||||
|
||||
namespace XenAdmin.Wizards.ImportWizard
|
||||
{
|
||||
@ -77,8 +78,37 @@ namespace XenAdmin.Wizards.ImportWizard
|
||||
|
||||
#region Accessors
|
||||
|
||||
public Actions.VMActions.BootMode SelectedBootMode { get { return bootModesControl1.SelectedOption; } }
|
||||
|
||||
public BootMode SelectedBootMode => bootModesControl1.SelectedOption;
|
||||
|
||||
public string BootParams
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (SelectedBootMode)
|
||||
{
|
||||
case BootMode.UEFI_BOOT:
|
||||
case BootMode.UEFI_SECURE_BOOT:
|
||||
return "firmware=uefi;";
|
||||
default:
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string PlatformSettings
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (SelectedBootMode)
|
||||
{
|
||||
case BootMode.UEFI_SECURE_BOOT:
|
||||
return "secureboot=true;";
|
||||
default:
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -255,8 +255,14 @@ namespace XenAdmin.Wizards.ImportWizard
|
||||
}
|
||||
else if (type == typeof(ImageVMConfigPage))
|
||||
{
|
||||
//then use it to create an ovf for the import
|
||||
m_envelopeFromVhd = InitialiseOvfEnvelope();
|
||||
//then use it to create an ovf for the import
|
||||
|
||||
m_envelopeFromVhd = OVF.CreateOvfEnvelope(m_pageVMconfig.VmName,
|
||||
m_pageVMconfig.CpuCount, m_pageVMconfig.Memory,
|
||||
m_pageBootOptions.BootParams, m_pageBootOptions.PlatformSettings,
|
||||
m_pageImportSource.DiskCapacity, m_pageImportSource.IsWIM, m_pageVMconfig.AdditionalSpace,
|
||||
m_pageImportSource.FilePath, m_pageImportSource.ImageLength);
|
||||
|
||||
m_pageStorage.SelectedOvfEnvelope = m_envelopeFromVhd;
|
||||
lunPerVdiMappingPage.SelectedOvfEnvelope = m_envelopeFromVhd;
|
||||
m_pageNetwork.SelectedOvfEnvelope = m_envelopeFromVhd;
|
||||
@ -694,40 +700,6 @@ namespace XenAdmin.Wizards.ImportWizard
|
||||
return Guid.NewGuid().ToString();
|
||||
}
|
||||
|
||||
private EnvelopeType InitialiseOvfEnvelope()
|
||||
{
|
||||
EnvelopeType env = OVF.CreateEnvelope(m_pageVMconfig.VmName);
|
||||
|
||||
string systemID = OVF.AddVirtualSystem(env, m_pageVMconfig.VmName);
|
||||
string hdwareSectionId = OVF.AddVirtualHardwareSection(env, systemID);
|
||||
string guid = Guid.NewGuid().ToString();
|
||||
OVF.AddVirtualSystemSettingData(env, systemID, hdwareSectionId, env.Name, Messages.VIRTUAL_MACHINE,
|
||||
Messages.OVF_CREATED, guid, "hvm-3.0-unknown");
|
||||
|
||||
var bootMode = m_pageBootOptions.SelectedBootMode;
|
||||
OVF.AddOtherSystemSettingData(env, systemID, "HVM_boot_policy", XenOvf.Properties.Settings.Default.xenBootOptions, OVF.GetContentMessage("OTHER_SYSTEM_SETTING_DESCRIPTION_2"));
|
||||
var bootParams = XenOvf.Properties.Settings.Default.xenBootParams + (bootMode == BootMode.UEFI_BOOT || bootMode == BootMode.UEFI_SECURE_BOOT ? "firmware=uefi;" : string.Empty);
|
||||
OVF.AddOtherSystemSettingData(env, systemID, "HVM_boot_params", bootParams, OVF.GetContentMessage("OTHER_SYSTEM_SETTING_DESCRIPTION_6"));
|
||||
var platformSetting = XenOvf.Properties.Settings.Default.xenPlatformSetting + (bootMode == BootMode.UEFI_SECURE_BOOT ? "secureboot=true;" : string.Empty);
|
||||
OVF.AddOtherSystemSettingData(env, systemID, "platform", platformSetting, OVF.GetContentMessage("OTHER_SYSTEM_SETTING_DESCRIPTION_3"));
|
||||
|
||||
OVF.SetCPUs(env, systemID, m_pageVMconfig.CpuCount);
|
||||
OVF.SetMemory(env, systemID, m_pageVMconfig.Memory, "MB");
|
||||
|
||||
string netId = Guid.NewGuid().ToString();
|
||||
OVF.AddNetwork(env, systemID, netId, string.Format(Messages.NETWORK_NAME, 0), Messages.OVF_NET_DESCRIPTION, null);
|
||||
|
||||
string diskId = Guid.NewGuid().ToString();
|
||||
ulong capacity = m_pageImportSource.DiskCapacity;
|
||||
if (m_pageImportSource.IsWIM)
|
||||
capacity += m_pageVMconfig.AdditionalSpace;
|
||||
OVF.AddDisk(env, systemID, diskId, m_pageImportSource.FilePath, true, Messages.OVF_DISK_CAPTION,
|
||||
Messages.OVF_CREATED, m_pageImportSource.ImageLength, capacity);
|
||||
|
||||
OVF.FinalizeEnvelope(env);
|
||||
return env;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void m_pageXvaStorage_ImportVmCompleted()
|
||||
|
27
XenModel/Messages.Designer.cs
generated
27
XenModel/Messages.Designer.cs
generated
@ -27264,33 +27264,6 @@ namespace XenAdmin {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Created by [XenCenter] Disk Image Import.
|
||||
/// </summary>
|
||||
public static string OVF_CREATED {
|
||||
get {
|
||||
return ResourceManager.GetString("OVF_CREATED", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Virtual Disk.
|
||||
/// </summary>
|
||||
public static string OVF_DISK_CAPTION {
|
||||
get {
|
||||
return ResourceManager.GetString("OVF_DISK_CAPTION", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Virtual Network.
|
||||
/// </summary>
|
||||
public static string OVF_NET_DESCRIPTION {
|
||||
get {
|
||||
return ResourceManager.GetString("OVF_NET_DESCRIPTION", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Parent folder.
|
||||
/// </summary>
|
||||
|
@ -9493,15 +9493,6 @@ However, there is not enough space to perform the repartitioning, so the current
|
||||
<data name="OVERVIEW_UNITS" xml:space="preserve">
|
||||
<value>(avg / max KBs)</value>
|
||||
</data>
|
||||
<data name="OVF_CREATED" xml:space="preserve">
|
||||
<value>Created by [XenCenter] Disk Image Import</value>
|
||||
</data>
|
||||
<data name="OVF_DISK_CAPTION" xml:space="preserve">
|
||||
<value>Virtual Disk</value>
|
||||
</data>
|
||||
<data name="OVF_NET_DESCRIPTION" xml:space="preserve">
|
||||
<value>Virtual Network</value>
|
||||
</data>
|
||||
<data name="PARENT_FOLDER" xml:space="preserve">
|
||||
<value>Parent folder</value>
|
||||
</data>
|
||||
|
45
XenOvfApi/Messages.Designer.cs
generated
45
XenOvfApi/Messages.Designer.cs
generated
@ -213,6 +213,15 @@ namespace XenOvf {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Network {0}.
|
||||
/// </summary>
|
||||
public static string NETWORK_NAME {
|
||||
get {
|
||||
return ResourceManager.GetString("NETWORK_NAME", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Failed to find section with type {0} and id {1}..
|
||||
/// </summary>
|
||||
@ -267,6 +276,15 @@ namespace XenOvf {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Created by [XenCenter] Disk Image Import.
|
||||
/// </summary>
|
||||
public static string OVF_CREATED {
|
||||
get {
|
||||
return ResourceManager.GetString("OVF_CREATED", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Failed to find deployment configuration section..
|
||||
/// </summary>
|
||||
@ -294,6 +312,15 @@ namespace XenOvf {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Virtual Disk.
|
||||
/// </summary>
|
||||
public static string OVF_DISK_CAPTION {
|
||||
get {
|
||||
return ResourceManager.GetString("OVF_DISK_CAPTION", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Failed to find the disk section..
|
||||
/// </summary>
|
||||
@ -321,6 +348,15 @@ namespace XenOvf {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Virtual Network.
|
||||
/// </summary>
|
||||
public static string OVF_NET_DESCRIPTION {
|
||||
get {
|
||||
return ResourceManager.GetString("OVF_NET_DESCRIPTION", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Failed to find the post-install section..
|
||||
/// </summary>
|
||||
@ -788,5 +824,14 @@ namespace XenOvf {
|
||||
return ResourceManager.GetString("VERSION_PROMPT", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Virtual Machine.
|
||||
/// </summary>
|
||||
public static string VIRTUAL_MACHINE {
|
||||
get {
|
||||
return ResourceManager.GetString("VIRTUAL_MACHINE", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -168,6 +168,9 @@
|
||||
<data name="INVALID_DATA_IN_OVF" xml:space="preserve">
|
||||
<value>Failed to deserialize OVF descriptor.</value>
|
||||
</data>
|
||||
<data name="NETWORK_NAME" xml:space="preserve">
|
||||
<value>Network {0}</value>
|
||||
</data>
|
||||
<data name="OVF_CANNOT_FIND_SECTION" xml:space="preserve">
|
||||
<value>Failed to find section with type {0} and id {1}.</value>
|
||||
</data>
|
||||
@ -186,6 +189,9 @@
|
||||
<data name="OVF_COULD_NOT_OPEN_STREAM" xml:space="preserve">
|
||||
<value>Failed to open {0}.</value>
|
||||
</data>
|
||||
<data name="OVF_CREATED" xml:space="preserve">
|
||||
<value>Created by [XenCenter] Disk Image Import</value>
|
||||
</data>
|
||||
<data name="OVF_DEPLOYMENT_CFG_SECTION_MISSING" xml:space="preserve">
|
||||
<value>Failed to find deployment configuration section.</value>
|
||||
</data>
|
||||
@ -195,6 +201,9 @@
|
||||
<data name="OVF_DEVICE_OUT_OF_RANGE" xml:space="preserve">
|
||||
<value>Device number {0} is less than zero or greater than 15.</value>
|
||||
</data>
|
||||
<data name="OVF_DISK_CAPTION" xml:space="preserve">
|
||||
<value>Virtual Disk</value>
|
||||
</data>
|
||||
<data name="OVF_DISK_SECTION_MISSING" xml:space="preserve">
|
||||
<value>Failed to find the disk section.</value>
|
||||
</data>
|
||||
@ -204,6 +213,9 @@
|
||||
<data name="OVF_INSTALL_SECTION_MISSING" xml:space="preserve">
|
||||
<value>Failed to find the install section.</value>
|
||||
</data>
|
||||
<data name="OVF_NET_DESCRIPTION" xml:space="preserve">
|
||||
<value>Virtual Network</value>
|
||||
</data>
|
||||
<data name="OVF_POST_INSTALL_MISSING" xml:space="preserve">
|
||||
<value>Failed to find the post-install section.</value>
|
||||
</data>
|
||||
@ -360,4 +372,7 @@
|
||||
<data name="VERSION_PROMPT" xml:space="preserve">
|
||||
<value>Version:</value>
|
||||
</data>
|
||||
<data name="VIRTUAL_MACHINE" xml:space="preserve">
|
||||
<value>Virtual Machine</value>
|
||||
</data>
|
||||
</root>
|
@ -1560,6 +1560,42 @@ namespace XenOvf
|
||||
|
||||
#region CREATEs
|
||||
|
||||
public static EnvelopeType CreateOvfEnvelope(string vmName, ulong cpuCount, ulong memory,
|
||||
string bootParams, string platformSettings, ulong diskCapacity, bool isWim, ulong additionalSpace,
|
||||
string diskPath, ulong imageLength)
|
||||
{
|
||||
EnvelopeType env = CreateEnvelope(vmName);
|
||||
string systemID = AddVirtualSystem(env, vmName);
|
||||
|
||||
string hdwareSectionId = AddVirtualHardwareSection(env, systemID);
|
||||
string guid = Guid.NewGuid().ToString();
|
||||
AddVirtualSystemSettingData(env, systemID, hdwareSectionId, env.Name, Messages.VIRTUAL_MACHINE, Messages.OVF_CREATED, guid, "hvm-3.0-unknown");
|
||||
|
||||
AddOtherSystemSettingData(env, systemID, "HVM_boot_policy", Properties.Settings.Default.xenBootOptions, GetContentMessage("OTHER_SYSTEM_SETTING_DESCRIPTION_2"));
|
||||
|
||||
bootParams = Properties.Settings.Default.xenBootParams + bootParams;
|
||||
AddOtherSystemSettingData(env, systemID, "HVM_boot_params", bootParams, GetContentMessage("OTHER_SYSTEM_SETTING_DESCRIPTION_6"));
|
||||
|
||||
var platformSetting = Properties.Settings.Default.xenPlatformSetting + platformSettings;
|
||||
AddOtherSystemSettingData(env, systemID, "platform", platformSetting, GetContentMessage("OTHER_SYSTEM_SETTING_DESCRIPTION_3"));
|
||||
|
||||
SetCPUs(env, systemID, cpuCount);
|
||||
SetMemory(env, systemID, memory, "MB");
|
||||
|
||||
string netId = Guid.NewGuid().ToString();
|
||||
AddNetwork(env, systemID, netId, string.Format(Messages.NETWORK_NAME, 0), Messages.OVF_NET_DESCRIPTION, null);
|
||||
|
||||
string diskId = Guid.NewGuid().ToString();
|
||||
ulong capacity = diskCapacity;
|
||||
|
||||
if (isWim)
|
||||
capacity += additionalSpace;
|
||||
|
||||
AddDisk(env, systemID, diskId, diskPath, true, Messages.OVF_DISK_CAPTION, Messages.OVF_CREATED, imageLength, capacity);
|
||||
|
||||
FinalizeEnvelope(env);
|
||||
return env;
|
||||
}
|
||||
|
||||
public EnvelopeType Create(DiskInfo[] vhdExports, string pathToOvf, string ovfName)
|
||||
{
|
||||
|
4
XenOvfApi/Properties/Settings.Designer.cs
generated
4
XenOvfApi/Properties/Settings.Designer.cs
generated
@ -12,8 +12,8 @@ namespace XenOvf.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
|
||||
public sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
|
@ -129,7 +129,7 @@
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>PublicSettingsSingleFileGenerator</Generator>
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<None Include="Schemas\xmldsig-core-schema.xsd">
|
||||
@ -184,7 +184,7 @@
|
||||
</PropertyGroup>
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
<UserProperties Reset="1" AssemblyVersion="1" AssemblyFileVersion="1" StartDate="20090814" />
|
||||
<UserProperties StartDate="20090814" AssemblyFileVersion="1" AssemblyVersion="1" Reset="1" />
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
</Project>
|
Loading…
Reference in New Issue
Block a user