CP-5352: PR-1634: Request and consume list of SRs required to recover a VM / vApp, and add Resolve All button.

1. Added MethodExists method to Helpers class: this method tests wheather given method exists already.
2. Utilized new Helpers method in VM and VM_appliance classes.
3. Fixed ACTION_MULTIPLE_DR_TASK_CREATE_ messages.

Signed-off-by: Adrian Jachacy <Adrian.Jachacy@citrix.com>
This commit is contained in:
Adrian Jachacy 2013-07-03 14:54:05 +01:00
parent fa4c087099
commit 8dc0908f92
5 changed files with 23 additions and 6 deletions

View File

@ -1096,7 +1096,7 @@ namespace XenAdmin {
}
/// <summary>
/// Looks up a localized string similar to Preparing Storage Repositories.
/// Looks up a localized string similar to Storage Repositories prepared.
/// </summary>
public static string ACTION_MULTIPLE_DR_TASK_CREATE_END {
get {
@ -1105,7 +1105,7 @@ namespace XenAdmin {
}
/// <summary>
/// Looks up a localized string similar to Storage Repositories prepared.
/// Looks up a localized string similar to Preparing Storage Repositories.
/// </summary>
public static string ACTION_MULTIPLE_DR_TASK_CREATE_START {
get {

View File

@ -463,10 +463,10 @@
<value>Moving {0} virtual disks to {1}</value>
</data>
<data name="ACTION_MULTIPLE_DR_TASK_CREATE_END" xml:space="preserve">
<value>Preparing Storage Repositories</value>
<value>Storage Repositories prepared</value>
</data>
<data name="ACTION_MULTIPLE_DR_TASK_CREATE_START" xml:space="preserve">
<value>Storage Repositories prepared</value>
<value>Preparing Storage Repositories</value>
</data>
<data name="ACTION_MULTIPLE_DR_TASK_CREATE_TITLE" xml:space="preserve">
<value>Prepare Storage Repositories</value>

View File

@ -1836,5 +1836,17 @@ namespace XenAdmin.Core
return connection.Cache.Hosts.Any(h => h.enabled);
}
/// <summary>
/// Returns true if given method exists already; false otherwise
/// </summary>
/// <param name="session"></param>
/// <param name="methodName"></param>
/// <returns></returns>
public static bool MethodExists(Session session, string methodName)
{
string[] methods = session.proxy.SystemListMethods();
return methods.Contains(methodName);
}
}
}

View File

@ -1423,7 +1423,9 @@ namespace XenAPI
public static List<XenRef<SR>> GetDRMissingSRs(Session session, string vm, string sessionTo)
{
return VM.get_SRs_required_for_recovery(session, vm, sessionTo);
return Helpers.MethodExists(session, "VM.get_SRs_required_for_recovery")
? VM.get_SRs_required_for_recovery(session, vm, sessionTo)
: null;
}
}

View File

@ -31,6 +31,7 @@
using System.Collections.Generic;
using System.Linq;
using XenAdmin.Core;
namespace XenAPI
{
@ -92,7 +93,9 @@ namespace XenAPI
public static List<XenRef<SR>> GetDRMissingSRs(Session session, string vm, string sessionTo)
{
return VM_appliance.get_SRs_required_for_recovery(session, vm, sessionTo);
return Helpers.MethodExists(session, "VM_appliance.get_SRs_required_for_recovery")
? VM_appliance.get_SRs_required_for_recovery(session, vm, sessionTo)
: null;
}
}
}