Merge pull request #1073 from kc284/CA-192541

CA-192541: Added detail to the Import/Export OVF/OVA and Import Disk …
This commit is contained in:
Mihaela Stoica 2016-07-20 10:34:48 +01:00 committed by GitHub
commit d739823b02
6 changed files with 62 additions and 26 deletions

View File

@ -34,6 +34,7 @@ using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Security.Cryptography.X509Certificates; using System.Security.Cryptography.X509Certificates;
using XenAdmin.Core;
using XenAdmin.Network; using XenAdmin.Network;
using XenAPI; using XenAPI;
@ -66,7 +67,9 @@ namespace XenAdmin.Actions.OVFActions
IEnumerable<string> eulas, bool signAppliance, bool createManifest, X509Certificate2 certificate, IEnumerable<string> eulas, bool signAppliance, bool createManifest, X509Certificate2 certificate,
bool encryptFiles, string encryptPassword, bool createOVA, bool compressOVFfiles, bool encryptFiles, string encryptPassword, bool createOVA, bool compressOVFfiles,
string networkUuid, bool isTvmIpStatic, string tvmIpAddress, string tvmSubnetMask, string tvmGateway, bool shouldVerify) string networkUuid, bool isTvmIpStatic, string tvmIpAddress, string tvmSubnetMask, string tvmGateway, bool shouldVerify)
: base(connection, Messages.EXPORT_APPLIANCE, networkUuid, isTvmIpStatic, tvmIpAddress, tvmSubnetMask, tvmGateway) : base(connection,
string.Format(createOVA ? Messages.EXPORT_OVA_PACKAGE : Messages.EXPORT_OVF_PACKAGE, applianceFileName, Helpers.GetName(connection)),
networkUuid, isTvmIpStatic, tvmIpAddress, tvmSubnetMask, tvmGateway)
{ {
m_applianceDirectory = applianceDirectory; m_applianceDirectory = applianceDirectory;
m_applianceFileName = applianceFileName; m_applianceFileName = applianceFileName;

View File

@ -32,6 +32,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using XenAdmin.Core;
using XenAdmin.Mappings; using XenAdmin.Mappings;
using XenAdmin.Network; using XenAdmin.Network;
@ -60,7 +61,8 @@ namespace XenAdmin.Actions.OVFActions
public ImportApplianceAction(IXenConnection connection, EnvelopeType ovfEnv, Package package, Dictionary<string, VmMapping> vmMappings, public ImportApplianceAction(IXenConnection connection, EnvelopeType ovfEnv, Package package, Dictionary<string, VmMapping> vmMappings,
bool verifyManifest, bool verifySignature, string password, bool runfixups, SR selectedIsoSr, bool verifyManifest, bool verifySignature, string password, bool runfixups, SR selectedIsoSr,
string networkUuid, bool isTvmIpStatic, string tvmIpAddress, string tvmSubnetMask, string tvmGateway) string networkUuid, bool isTvmIpStatic, string tvmIpAddress, string tvmSubnetMask, string tvmGateway)
: base(connection, Messages.IMPORT_APPLIANCE, networkUuid, isTvmIpStatic, tvmIpAddress, tvmSubnetMask, tvmGateway) : base(connection, string.Format(Messages.IMPORT_APPLIANCE, GetApplianceName(ovfEnv, package), Helpers.GetName(connection)),
networkUuid, isTvmIpStatic, tvmIpAddress, tvmSubnetMask, tvmGateway)
{ {
m_ovfEnvelope = ovfEnv; m_ovfEnvelope = ovfEnv;
m_package = package; m_package = package;
@ -151,10 +153,7 @@ namespace XenAdmin.Actions.OVFActions
envelopes.Add(envs[0]); envelopes.Add(envs[0]);
} }
var appName = m_ovfEnvelope.Name; var appName = GetApplianceName(m_ovfEnvelope, m_package);
if (string.IsNullOrEmpty(appName))
appName = Path.GetFileNameWithoutExtension(m_package.PackageSourceFile);
EnvelopeType env = OVF.Merge(envelopes, appName); EnvelopeType env = OVF.Merge(envelopes, appName);
try //importVM try //importVM
@ -176,5 +175,13 @@ namespace XenAdmin.Actions.OVFActions
PercentComplete = 100; PercentComplete = 100;
Description = Messages.COMPLETED; Description = Messages.COMPLETED;
} }
private static string GetApplianceName(EnvelopeType ovfEnv, Package package)
{
var appName = ovfEnv.Name;
if (string.IsNullOrEmpty(appName))
appName = Path.GetFileNameWithoutExtension(package.PackageSourceFile);
return appName;
}
} }
} }

View File

@ -33,6 +33,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Linq; using System.Linq;
using XenAdmin.Core;
using XenAdmin.Mappings; using XenAdmin.Mappings;
using XenAdmin.Network; using XenAdmin.Network;
@ -57,7 +58,8 @@ namespace XenAdmin.Actions.OVFActions
public ImportImageAction(IXenConnection connection, EnvelopeType ovfEnv, string directory, Dictionary<string, VmMapping> vmMappings, bool runfixups, SR selectedIsoSr, public ImportImageAction(IXenConnection connection, EnvelopeType ovfEnv, string directory, Dictionary<string, VmMapping> vmMappings, bool runfixups, SR selectedIsoSr,
string networkUuid, bool isTvmIpStatic, string tvmIpAddress, string tvmSubnetMask, string tvmGateway) string networkUuid, bool isTvmIpStatic, string tvmIpAddress, string tvmSubnetMask, string tvmGateway)
: base(connection, Messages.IMPORT_DISK_IMAGE, networkUuid, isTvmIpStatic, tvmIpAddress, tvmSubnetMask, tvmGateway) : base(connection, string.Format(Messages.IMPORT_DISK_IMAGE, ovfEnv.Name, Helpers.GetName(connection)),
networkUuid, isTvmIpStatic, tvmIpAddress, tvmSubnetMask, tvmGateway)
{ {
m_ovfEnvelope = ovfEnv; m_ovfEnvelope = ovfEnv;
m_directory = directory; m_directory = directory;

View File

@ -74,7 +74,7 @@ namespace XenAdmin.Actions
/// <param name="verify"></param> /// <param name="verify"></param>
public ExportVmAction(IXenConnection connection, Host host, public ExportVmAction(IXenConnection connection, Host host,
VM vm, string filename, bool verify) VM vm, string filename, bool verify)
: base(connection, string.Format(Messages.ACTION_EXPORT_VM_FROM_X, vm.Name, Helpers.GetName(connection)), : base(connection, string.Format(Messages.EXPORT_VM_TITLE, vm.Name, Helpers.GetName(connection)),
Messages.ACTION_EXPORT_DESCRIPTION_PREPARING) Messages.ACTION_EXPORT_DESCRIPTION_PREPARING)
{ {
#region RBAC Dependencies #region RBAC Dependencies

View File

@ -960,15 +960,6 @@ namespace XenAdmin {
} }
} }
/// <summary>
/// Looks up a localized string similar to Exporting VM &apos;{0}&apos; from &apos;{1}&apos;.
/// </summary>
public static string ACTION_EXPORT_VM_FROM_X {
get {
return ResourceManager.GetString("ACTION_EXPORT_VM_FROM_X", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Fetch data sources. /// Looks up a localized string similar to Fetch data sources.
/// </summary> /// </summary>
@ -14223,6 +14214,24 @@ namespace XenAdmin {
} }
} }
/// <summary>
/// Looks up a localized string similar to Export OVA package &apos;{0}&apos; from &apos;{1}&apos;.
/// </summary>
public static string EXPORT_OVA_PACKAGE {
get {
return ResourceManager.GetString("EXPORT_OVA_PACKAGE", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Export OVF package &apos;{0}&apos; from &apos;{1}&apos;.
/// </summary>
public static string EXPORT_OVF_PACKAGE {
get {
return ResourceManager.GetString("EXPORT_OVF_PACKAGE", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Certificate file does not exist.. /// Looks up a localized string similar to Certificate file does not exist..
/// </summary> /// </summary>
@ -14349,6 +14358,15 @@ namespace XenAdmin {
} }
} }
/// <summary>
/// Looks up a localized string similar to Export VM &apos;{0}&apos; from &apos;{1}&apos;.
/// </summary>
public static string EXPORT_VM_TITLE {
get {
return ResourceManager.GetString("EXPORT_VM_TITLE", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to &amp;Verify export on completion. /// Looks up a localized string similar to &amp;Verify export on completion.
/// </summary> /// </summary>
@ -17434,7 +17452,7 @@ namespace XenAdmin {
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Import Appliance. /// Looks up a localized string similar to Import Appliance &apos;{0}&apos; to &apos;{1}&apos;.
/// </summary> /// </summary>
public static string IMPORT_APPLIANCE { public static string IMPORT_APPLIANCE {
get { get {
@ -17443,7 +17461,7 @@ namespace XenAdmin {
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Import Disk Image. /// Looks up a localized string similar to Import VM &apos;{0}&apos; from Disk Image to &apos;{1}&apos;.
/// </summary> /// </summary>
public static string IMPORT_DISK_IMAGE { public static string IMPORT_DISK_IMAGE {
get { get {
@ -18229,7 +18247,7 @@ namespace XenAdmin {
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Importing VM from &apos;{0}&apos; to &apos;{1}&apos;. /// Looks up a localized string similar to Import VM from &apos;{0}&apos; to &apos;{1}&apos;.
/// </summary> /// </summary>
public static string IMPORTVM_TITLE { public static string IMPORTVM_TITLE {
get { get {

View File

@ -417,9 +417,6 @@
<data name="ACTION_EXPORT_VERIFY" xml:space="preserve"> <data name="ACTION_EXPORT_VERIFY" xml:space="preserve">
<value>Verifying Export...</value> <value>Verifying Export...</value>
</data> </data>
<data name="ACTION_EXPORT_VM_FROM_X" xml:space="preserve">
<value>Exporting VM '{0}' from '{1}'</value>
</data>
<data name="ACTION_GETTING_DATASOURCES" xml:space="preserve"> <data name="ACTION_GETTING_DATASOURCES" xml:space="preserve">
<value>Fetching data sources</value> <value>Fetching data sources</value>
</data> </data>
@ -5036,6 +5033,12 @@ Would you like to eject these ISOs before continuing?</value>
<data name="EXPORT_OPTIONS_PAGE_TITLE" xml:space="preserve"> <data name="EXPORT_OPTIONS_PAGE_TITLE" xml:space="preserve">
<value>Select the manifest, signing and output file format options you want</value> <value>Select the manifest, signing and output file format options you want</value>
</data> </data>
<data name="EXPORT_OVA_PACKAGE" xml:space="preserve">
<value>Export OVA package '{0}' from '{1}'</value>
</data>
<data name="EXPORT_OVF_PACKAGE" xml:space="preserve">
<value>Export OVF package '{0}' from '{1}'</value>
</data>
<data name="EXPORT_SECURITY_PAGE_ERROR_CERTIFICATE_INVALID" xml:space="preserve"> <data name="EXPORT_SECURITY_PAGE_ERROR_CERTIFICATE_INVALID" xml:space="preserve">
<value>The certificate is invalid.</value> <value>The certificate is invalid.</value>
</data> </data>
@ -5078,6 +5081,9 @@ Would you like to eject these ISOs before continuing?</value>
<data name="EXPORT_UPDATES" xml:space="preserve"> <data name="EXPORT_UPDATES" xml:space="preserve">
<value>Exported updates to {0}</value> <value>Exported updates to {0}</value>
</data> </data>
<data name="EXPORT_VM_TITLE" xml:space="preserve">
<value>Export VM '{0}' from '{1}'</value>
</data>
<data name="EXPORT_VM_VERIFY_POST_INSTALL" xml:space="preserve"> <data name="EXPORT_VM_VERIFY_POST_INSTALL" xml:space="preserve">
<value>&amp;Verify export on completion</value> <value>&amp;Verify export on completion</value>
</data> </data>
@ -6136,7 +6142,7 @@ Click Configure HA to alter the settings displayed below.</value>
<value>Starting VM...</value> <value>Starting VM...</value>
</data> </data>
<data name="IMPORTVM_TITLE" xml:space="preserve"> <data name="IMPORTVM_TITLE" xml:space="preserve">
<value>Importing VM from '{0}' to '{1}'</value> <value>Import VM from '{0}' to '{1}'</value>
</data> </data>
<data name="IMPORTVM_UPDATING_NETWORKS" xml:space="preserve"> <data name="IMPORTVM_UPDATING_NETWORKS" xml:space="preserve">
<value>Updating VM networking...</value> <value>Updating VM networking...</value>
@ -6148,10 +6154,10 @@ Click Configure HA to alter the settings displayed below.</value>
<value>Waiting for Import VM wizard to complete...</value> <value>Waiting for Import VM wizard to complete...</value>
</data> </data>
<data name="IMPORT_APPLIANCE" xml:space="preserve"> <data name="IMPORT_APPLIANCE" xml:space="preserve">
<value>Import Appliance</value> <value>Import Appliance '{0}' to '{1}'</value>
</data> </data>
<data name="IMPORT_DISK_IMAGE" xml:space="preserve"> <data name="IMPORT_DISK_IMAGE" xml:space="preserve">
<value>Import Disk Image</value> <value>Import VM '{0}' from Disk Image to '{1}'</value>
</data> </data>
<data name="IMPORT_DOWNLOAD_ERROR" xml:space="preserve"> <data name="IMPORT_DOWNLOAD_ERROR" xml:space="preserve">
<value>Error downloading file '{0}'. {1}</value> <value>Error downloading file '{0}'. {1}</value>