mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-24 22:06:59 +01:00
CP-8547: Add button in XenCenter to initiate space reclamation on an SR: Changes following code review.
- Added check for null for sm.features in SR.SupportsTrim; - Better error messages; - Moved error messages from Messages to FriendlyNames; - Removed the check for actions in progress from TrimSRCommand.CanExecute(). - Signed-off-by: Mihaela Stoica <mihaela.stoica@citrix.com>
This commit is contained in:
parent
1f217b9983
commit
1ff55016c8
@ -74,7 +74,7 @@ namespace XenAdmin.Commands
|
||||
|
||||
private static bool CanExecute(SR sr)
|
||||
{
|
||||
return sr != null && sr.SupportsTrim && !HelpersGUI.GetActionInProgress(sr);
|
||||
return sr != null && sr.SupportsTrim;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -131,8 +131,7 @@ namespace XenAdmin.Actions
|
||||
{
|
||||
if (errCode == null)
|
||||
return null;
|
||||
var messageKey = "SR_TRIM_ERROR_" + errCode.ToUpper();
|
||||
return Messages.ResourceManager.GetString(messageKey);
|
||||
return PropertyManager.GetFriendlyName("Message.name-" + errCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
27
XenModel/FriendlyNames.Designer.cs
generated
27
XenModel/FriendlyNames.Designer.cs
generated
@ -4094,6 +4094,33 @@ namespace XenAdmin {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Cannot reclaim freed space because the SR is already busy.
|
||||
/// </summary>
|
||||
public static string Message_name_SRUnavailable {
|
||||
get {
|
||||
return ResourceManager.GetString("Message.name-SRUnavailable", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to An unknown error occurred when reclaiming freed space.
|
||||
/// </summary>
|
||||
public static string Message_name_UnknownTrimException {
|
||||
get {
|
||||
return ResourceManager.GetString("Message.name-UnknownTrimException", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Reclaiming freed space not supported on this SR.
|
||||
/// </summary>
|
||||
public static string Message_name_UnsupportedSRForTrim {
|
||||
get {
|
||||
return ResourceManager.GetString("Message.name-UnsupportedSRForTrim", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to VM Disk QoS Failed.
|
||||
/// </summary>
|
||||
|
@ -1679,4 +1679,13 @@
|
||||
<data name="Label-host.edition-free/libre" xml:space="preserve">
|
||||
<value>Citrix XenServer</value>
|
||||
</data>
|
||||
<data name="Message.name-SRUnavailable" xml:space="preserve">
|
||||
<value>Cannot reclaim freed space because the SR is already busy</value>
|
||||
</data>
|
||||
<data name="Message.name-UnknownTrimException" xml:space="preserve">
|
||||
<value>An unknown error occurred when reclaiming freed space</value>
|
||||
</data>
|
||||
<data name="Message.name-UnsupportedSRForTrim" xml:space="preserve">
|
||||
<value>Reclaiming freed space not supported on this SR</value>
|
||||
</data>
|
||||
</root>
|
27
XenModel/Messages.Designer.cs
generated
27
XenModel/Messages.Designer.cs
generated
@ -28327,33 +28327,6 @@ namespace XenAdmin {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Unable to get SR lock.
|
||||
/// </summary>
|
||||
public static string SR_TRIM_ERROR_SRUNAVAILABLE {
|
||||
get {
|
||||
return ResourceManager.GetString("SR_TRIM_ERROR_SRUNAVAILABLE", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to An unknown exception occurred.
|
||||
/// </summary>
|
||||
public static string SR_TRIM_ERROR_UNKNOWNTRIMEXCEPTION {
|
||||
get {
|
||||
return ResourceManager.GetString("SR_TRIM_ERROR_UNKNOWNTRIMEXCEPTION", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Operation not supported.
|
||||
/// </summary>
|
||||
public static string SR_TRIM_ERROR_UNSUPPORTEDSRFORTRIM {
|
||||
get {
|
||||
return ResourceManager.GetString("SR_TRIM_ERROR_UNSUPPORTEDSRFORTRIM", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Unable to connect to iSCSI target.
|
||||
/// </summary>
|
||||
|
@ -9866,15 +9866,6 @@ Do you want to connect to the pool master '{1}'?</value>
|
||||
<data name="SR_SIZE_USED" xml:space="preserve">
|
||||
<value>{0} used of {1} total ({2} allocated)</value>
|
||||
</data>
|
||||
<data name="SR_TRIM_ERROR_SRUNAVAILABLE" xml:space="preserve">
|
||||
<value>Unable to get SR lock</value>
|
||||
</data>
|
||||
<data name="SR_TRIM_ERROR_UNKNOWNTRIMEXCEPTION" xml:space="preserve">
|
||||
<value>An unknown exception occurred</value>
|
||||
</data>
|
||||
<data name="SR_TRIM_ERROR_UNSUPPORTEDSRFORTRIM" xml:space="preserve">
|
||||
<value>Operation not supported</value>
|
||||
</data>
|
||||
<data name="SR_UNABLE_TO_CONNECT_TO_SCSI_TARGET" xml:space="preserve">
|
||||
<value>Unable to connect to iSCSI target</value>
|
||||
</data>
|
||||
|
@ -1044,7 +1044,7 @@ namespace XenAPI
|
||||
System.Diagnostics.Trace.Assert(Connection != null, "Connection must not be null");
|
||||
|
||||
SM sm = SM.GetByType(Connection, type);
|
||||
return sm != null && sm.features.ContainsKey("SR_TRIM");
|
||||
return sm != null && sm.features != null && sm.features.ContainsKey("SR_TRIM");
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user