diff --git a/XenModel/Actions/VM/ImportVmAction.cs b/XenModel/Actions/VM/ImportVmAction.cs index fd227a643..d8e72cdb7 100644 --- a/XenModel/Actions/VM/ImportVmAction.cs +++ b/XenModel/Actions/VM/ImportVmAction.cs @@ -31,6 +31,7 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; using XenAdmin.Core; using XenAPI; @@ -103,7 +104,7 @@ namespace XenAdmin.Actions { SafeToExit = false; - string vmRef = ApplyFile(out string importTaskRef); + string vmRef = UploadFile(out string importTaskRef); if (string.IsNullOrEmpty(vmRef)) return; @@ -243,37 +244,37 @@ namespace XenAdmin.Actions return name; } - private string ApplyFile(out string importTaskRef) + private string UploadFile(out string importTaskRef) { - log.DebugFormat("Importing XVA from {0} to SR {1}", m_filename, SR.Name()); - Host host = SR.GetStorageHost(); - string hostURL; + string hostUrl; if (host == null) { Uri uri = new Uri(Session.Url); - hostURL = uri.Host; + hostUrl = uri.Host; + log.InfoFormat("SR {0} is shared or disconnected or SR host could not be resolved. Uploading XVA {1} to {2}", SR.Name(), m_filename, hostUrl); } else { - log.DebugFormat("SR is not shared -- redirecting to {0}", host.address); - hostURL = host.address; + hostUrl = host.address; + log.InfoFormat("Resolved host for SR {0}. Uploading XVA {1} to {2}", SR.Name(), m_filename, hostUrl); } - log.DebugFormat("Using {0} for import", hostURL); - try { - RelatedTask = Task.create(Session, "put_import_task", hostURL); + RelatedTask = Task.create(Session, "put_import_task", hostUrl); //at the end of polling, the RelatedTask is destroyed; make a note of it for later use importTaskRef = RelatedTask.opaque_ref; - log.DebugFormat("HTTP PUTTING file from {0} to {1}", m_filename, hostURL); + log.DebugFormat("HTTP PUTTING file from {0} to {1}", m_filename, hostUrl); - HTTP_actions.put_import(percent => PercentComplete = percent, + HTTP_actions.put_import(percent => + { + Tick(percent, string.Format(Messages.IMPORTVM_UPLOADING, Path.GetFileName(m_filename), Pool.Name(), percent)); + }, () => XenAdminConfigManager.Provider.ForcedExiting || GetCancelling(), - HTTP_PUT_TIMEOUT, hostURL, + HTTP_PUT_TIMEOUT, hostUrl, XenAdminConfigManager.Provider.GetProxyFromSettings(Connection), m_filename, RelatedTask.opaque_ref, Session.opaque_ref, false, false, SR.opaque_ref); diff --git a/XenModel/Messages.Designer.cs b/XenModel/Messages.Designer.cs index 7b32cedeb..310ff9b0e 100755 --- a/XenModel/Messages.Designer.cs +++ b/XenModel/Messages.Designer.cs @@ -21391,15 +21391,6 @@ namespace XenAdmin { } } - /// - /// Looks up a localized string similar to Importing VM.... - /// - public static string IMPORTVM_IMPORTING { - get { - return ResourceManager.GetString("IMPORTVM_IMPORTING", resourceCulture); - } - } - /// /// Looks up a localized string similar to Preparing to Import VM. /// @@ -21436,6 +21427,15 @@ namespace XenAdmin { } } + /// + /// Looks up a localized string similar to Uploading '{0}' to '{1}' ({2}% done).... + /// + public static string IMPORTVM_UPLOADING { + get { + return ResourceManager.GetString("IMPORTVM_UPLOADING", resourceCulture); + } + } + /// /// Looks up a localized string similar to Waiting for Import VM wizard to complete.... /// diff --git a/XenModel/Messages.resx b/XenModel/Messages.resx index f6c7efdf4..d87873485 100755 --- a/XenModel/Messages.resx +++ b/XenModel/Messages.resx @@ -7445,9 +7445,6 @@ This might result in failure to migrate VMs to this server during the RPU or to Import VM complete - - Importing VM... - Preparing to Import VM @@ -7460,6 +7457,9 @@ This might result in failure to migrate VMs to this server during the RPU or to Updating VM... + + Uploading '{0}' to '{1}' ({2}% done)... + Waiting for Import VM wizard to complete...