mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-25 06:16:37 +01:00
Improved logging and reporting percentage when importing an XVA.
Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
This commit is contained in:
parent
b4afd3ce4c
commit
1225e98225
@ -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);
|
||||
|
||||
|
18
XenModel/Messages.Designer.cs
generated
18
XenModel/Messages.Designer.cs
generated
@ -21391,15 +21391,6 @@ namespace XenAdmin {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Importing VM....
|
||||
/// </summary>
|
||||
public static string IMPORTVM_IMPORTING {
|
||||
get {
|
||||
return ResourceManager.GetString("IMPORTVM_IMPORTING", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Preparing to Import VM.
|
||||
/// </summary>
|
||||
@ -21436,6 +21427,15 @@ namespace XenAdmin {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Uploading '{0}' to '{1}' ({2}% done)....
|
||||
/// </summary>
|
||||
public static string IMPORTVM_UPLOADING {
|
||||
get {
|
||||
return ResourceManager.GetString("IMPORTVM_UPLOADING", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Waiting for Import VM wizard to complete....
|
||||
/// </summary>
|
||||
|
@ -7445,9 +7445,6 @@ This might result in failure to migrate VMs to this server during the RPU or to
|
||||
<data name="IMPORTVM_IMPORTCOMPLETE" xml:space="preserve">
|
||||
<value>Import VM complete</value>
|
||||
</data>
|
||||
<data name="IMPORTVM_IMPORTING" xml:space="preserve">
|
||||
<value>Importing VM...</value>
|
||||
</data>
|
||||
<data name="IMPORTVM_PREP" xml:space="preserve">
|
||||
<value>Preparing to Import VM</value>
|
||||
</data>
|
||||
@ -7460,6 +7457,9 @@ This might result in failure to migrate VMs to this server during the RPU or to
|
||||
<data name="IMPORTVM_UPDATING_VM" xml:space="preserve">
|
||||
<value>Updating VM...</value>
|
||||
</data>
|
||||
<data name="IMPORTVM_UPLOADING" xml:space="preserve">
|
||||
<value>Uploading '{0}' to '{1}' ({2}% done)...</value>
|
||||
</data>
|
||||
<data name="IMPORTVM_WAITING_FOR_WIZARD" xml:space="preserve">
|
||||
<value>Waiting for Import VM wizard to complete...</value>
|
||||
</data>
|
||||
|
Loading…
Reference in New Issue
Block a user